Axon 2.3 has been released. And again, it contains a number of new features as well as some improvements and (minor) bugfixes.
Perhaps the biggest newcomer is the ability to apply events in an @EventSourcingHandler. Axon will ensure that these events are only really applied when the aggregate is “live”. When the aggregate is being reconstructed from passed events, call to apply() are ignored. You can also ‘manually’ check for the ‘live’ state of an aggregate, so you can decide whether it’s possible to make decisions on what has just happened. Especially larger, more complex aggregates consisting of several entities will benefit from this feature. Activity in one entity of an aggregate can now cause activity in another entity in that same aggregate based on the events it applied.
We have improved the CommandGateway a bit. You can now use a parameter of type MetaData to attach multiple meta data fields to outgoing commands. You can now also register CommandCallback instances on the GatewayProxyFactory. These callbacks will be invoked for all commands on all gateways created with this factory.
It is now easier to correlate commands and events generated by Sagas with the Event that triggered that process. The SagaManagers allow you to configure a CorrelationDataProvider, which will provide the meta data that should be attached to all outgoing commands and events. This will only work if you use the EventTemplate to publish events and/or a CommandGateway to dispatch commands. This will make it easier to record the information in your Event Store to do a cause-and-effect analysis.
If you want to customize the way events are stored in the Event Store, it’s now easier to do that. You can provide your own entities in the JPA Event Store and you can store the data in any type you want. No just binary columns. This is useful if you use a text based serializer, such as the (default) XStreamSerializer or a JSON serializer. If you prefer your timestamp to be stored as “millis since epoch”, instead of an ISO 6801 date time, that’s now easier to do. Check out the Javadoc on the EventEntryFactory to find out how to specify your own Entities.
Spring users that dislike XML, rest assured. It’s now easier to configure Axon Annotation configuration. Simply put the @AnnotationDriven annotation on your @Configuration bean, and all you @CommandHandler and @EventHandler annotated beans are registered with their respective Bus.
The DisruptorCommandBus is now capable of triggering snapshots. Like the regular repositories, you can now configure a threshold. This will make sure the DisruptorCommandBus will keep on running fast, even if it has to occasionally load an aggregate from its events.
That wasn’t all. There is a number of smaller improvements that you might like. Check out the release notes for more details.