eventhandler ordering details

Hi,

Trying to get ordering of @EventHandler to work I made the following observations :

  • It does not work unless you define a cluster. This was surprising to me.
  • I also had to explicitly configure an order resolver :

`
<axon:cluster id=“defaultCluster” default=“true”>
<axon:ordered order-resolver-ref=“eventHandlerOrderResolver”/>
</axon:cluster>

`

and

@Bean public OrderResolver eventHandlerOrderResolver() { return new SpringAnnotationOrderResolver(); }

… even though the documentation AFAIU states otherwise:

Clusters that have been defined in a Spring context using the <axon:cluster /> element automatically check for Spring’s @Order annotation on handler classes. Alternatively, an “order-resolver-ref” attribute can be used to refer to another Order resolver to use.

Note this is still Axon v2.4.5, maybe in 3.x it works differently.

Greetings,
Jorg Heymans

Hmm… it’s actually enough to just mention <axon:ordered />. It then defaults to using the Spring @Order annotation.
So this is the setup required:
<axon:cluster id=“defaultCluster” default=“true”>
<axon:ordered />
</axon:cluster>

Cheers,

Allard