Recently, Axon Framework 2.1 has been released. It comes packed with improvements and some exciting new features. In this post, I'll briefly iterate of what's new in this version.
Furthermore, we have also scheduled a few workshops and trainings.
Axon 2.1 comes with support for Publisher Acknowledgements for the AMQP connector. If the AMQP implementation (such as RabbitMQ) support publisher acknowledgements (also referred to as Confirms), they could be a faster alternative to transactions. You can read more about RabbitMQ Confirms here.
Conflict resolution performance
The CachingEventSourcingRepository deals with version conflicts in a more efficient way. Instead of ignoring the cached aggregate and loading a new instance, it returns the cached version of the aggregate. To resolve a conflict, it loads the events that describe the conflict from the Event Store.
An example: you load an aggregate, and get version 15 instead of the expected version 10. All changes are applied to version 15. Let's say this updates the aggregate to 17 (2 events have been applied). The conflict resolver is provided with events 10-15 and 16-17, allowing it to indicate a potential conflict. Since only 10-15 need to be fetched from the event store, this procedure is slightly more efficient.
You can read more about conflict resolution in section 5.6 of the reference guide.
We have received a lot of feedback since the 2.0 release. Most of it, fortunately, very positive. But there was obviously room for further improvement. In 2.1, we have made some changes that simplify the use of Axon in your project.
Annotation for event sourcing handlers
We have receive many questions about the difference between the
@EventHandler annotation in an aggregate, and that same annotation on an Event Listener (bean). Since both types of handlers are executed in a different way in different situations, the request popped up to use a different annotation for the Event Sourcing handlers in Aggregates. While the
@EventHandler annotation will still work as it did before, it is now also possible (and recommended) to use the
@EventSourcingHandler annotation on Event Sourced Aggregates. The behavior is the same as before, but the different annotation will make it clearer as to when a method is invoked.
Class path scanning for Sagas
Class path scanning for Sagas has been introduced in Axon's Spring support. That means that you only need to provide a base package in your AnnotatedSagaManager configuration, and Axon will automatically manage all Sagas found. That means you can save yourself the time to enumerate them all.
Attaching meta data to events
Attaching meta data to events is no longer limited to the moment they are registered with the Unit of Work. It is now possible to attach meta data to the events when the UoW commits, just before they are stored and published. This allows you to, for example, mark events as being
x of y. Simply extend the
MetaDataMutatingUnitOfWorkListenerAdapter, and attach your meta data.
It was already possible to perform replays in earlier versions of Axon. In 2.1, we've added the possibility to apply a filter on the replay. This could speed up the process significantly if you only need to replay a specific slice of history.
Event handler ordering
Every now an then, the situation pops up that you want a certain event handler class to be triggered before another. It is now possible to indicate the order in which Event Handlers are invoked. Spring users can annotate the class with
@Order. Non-Spring users can implement the
OrderResolver interface to provide an Order for a given instance. Classes with a lower order are invoked before those with a higher value.
Event handler parameters
The first parameter of an annotated event handler doesn't have to be the payload anymore. To omit it, simply provide the expected payload type in the
@EventHandler annotation. In cases where the handler is interested in the entire EventMessage, or just some meta data, this removes the need for the awkward extra parameter.
As of Axon 2.1, all components delivered by Axon are OSGi compatible bundles. While currently this only means the required bundle name, import and exports statements are provided in the manifest, future versions will contain concrete optimizations for OSGi environments. Special thanks go out to Luca Burgazzoli for setting this up.
Axon is built with extensibility and customizability in mind. Obviously, you can't foresee everything. In 2.1, we have included a few changes to improve on this.
Ability to proxy annotated handlers
The AnnotationCommandHandlerAdapter and AnnotationEventHandlerAdapter don't need to be self-subscribing anymore. This allows you to customize behavior by creating a proxy instance. You don't need to be afraid that the proxied object gets subscribed instead. The old behavior is still available, albeit deprecated.
Post-processing on async event handlers
The async cluster implementations allow for a 'commit handler' to be registered. This handler is notified when an event has been handled by a cluster. This allows you to perform actions that must wait until an event is processed, for example sending an Ack to messaging middleware.
Instead of JVM-wide ParameterResolverFactory lookup using a service loader, the factory can be configured using (constructor) parameter. This allows for easier configuration in OSGi environments. The possibility to create custom ParameterResolverFactories using the service load mechanism is still the default.
Getting started with Axon 2.1
If you're eager to get started using Axon 2.1, update your maven settings, or download the full distribution (incl. source code, documentation and dependencies). If you need some help getting started, check out the Axon 2 Quickstart Guide. If you get stuck, just check the mailinglist for an answer.
Other news and upcoming events
The 2.1 release is not the only news we have to bring. We'll be organizing a few trainings and workshops this year. The first training is scheduled for 27th and 28th of March, in Amsterdam, The Netherlands.
Check out the training page for more information. If there is no workshop or training near you, rest assured. Simply get in touch and we'll see if we can organize something near you.
Currently, we have the following trainings scheduled (all in Amsterdam, The Netherlands):
- March 27th-28th,
- June 26th-27th,
- September 25th-26th,
- November 27th-28th.
Check out all upcoming events on our events page. It's updated as soon as something new is organized.
Axon @ QCon London 2014
We'll also be presenting about Axon Framework on QCon London on March 7th. If you haven't registered yet, you should.
Here's the good news: You get a £ 100 discount when you use discount code BUIJ100.