One of the things I love about Java is its native, compiler-level support for annotations, a form of syntactic metadata which can be applied to source code but also retain at run-time to influence application behavior. I use them almost daily in my projects.
I do a fair amount of consulting and development on event sourced applications and these usually use Axon, a popular CQRS & event sourcing framework. Recently, Axon version 3 was released, supporting a number of annotations that can turn any POJO (Plain Old Java Object) into an event-sourced aggregate.
The annotations in Axon inspired me to experiment with adding support for similar annotations to prooph, a PHP framework which I occasionally reference in my PHP conference talks and consulting. This experiment is now available online as a PHP package, on GitHub: https://github.com/prooph/annotations. It works with the last versions of the core prooph components.
The package, like Axon, introduces a number of annotations which allow you to turn any regular PHP class into an event-sourced aggregate. Unfortunately, annotations are not natively supported in PHP. They are written inside documentation blocks and require an additional parser to get working (in the case of my package, Doctrine Annotations). The following example snippet shows how these annotations are applied:
@CommandHandler helps to get rid of some of the boilerplate code usually associated with command handlers in prooph (see this example). @EventHandler turns any annotated function into an event listener.
One of the things I like most about my work is the ability to help teams improve, by sharing my experiences and knowledge in training sessions. These sessions can be conducted in the form of interactive workshops or talks.
I’m offering training sessions on DevOps, Continuous Delivery, Event Sourcing, Microservices and many other topics. Contact me if you’re interested in details or pricing!
This amazing photo was taken by Chris Heijmans in 2012. Last year, I ordered a canvas print, which is now proudly displayed in my home. Admittedly, current conditions (partly cloudy, windy, 8 degrees celcius) are nowhere near what’s pictured, but one can hope 😉
2016 has been interesting! I’ve met loads of cool people and been part of some amazing projects. Thank you for reading this blog, attending my talks, following me on Twitter, or listening to me advocate (rant?) in person.
From my cozy, little hometown Utrecht I wish you and yours happy holidays, see you in 2017!