Order of @EventHandler's inside a Listener

Hi all.

I know we can define the order the listeners are invoked by using @Order

public class ModelListener

Hi Antonio,

Do note, that you can only set the order between Listeners/Event Handling Components within the same Event Processing Group.
As soon as you begin to split your Event Handling Components, the ordering is not guaranteed.

Added, the @Order annotation is a Spring Framework annotation which orders the beans in a list (the list of Event Handling Components within a Event Processing Group to be exact). However, the event handling functions aren’t beans, so I’d say adding the @Order annotation does not have any effect on the ordering. You could however always run a test to verify this.

Apart from all this though, I generally try not to rely on ordering to much on the event handling side of things.

Ideally each component can work in isolation without relying on others; thus make it so it does not have to many dependencies.
Ordering mostly signals you’ve got dependencies between components, which easily reals in other components until you’ve got one big dependent event handling structure.

Hope this helps you out Antonio!


Hi, thanks for your quick reply.

I forgot to say I’m using 2.4.6, I think Event Processing Group exist only in Axon 3, right?

I understand all the logic of not having dependencies between listeners and thus not to rely on order. However I had to change a already existing app that behavior.

I’m doing some tests with the @Order, until now I think it doesn’t have any influence on methods, but I’ll test a little more.

Well, thanks again for your reply.


Hi Antonio,

Ah, yea it works a little different in Axon 2.4.6. But it’s mainly how the Event Handling Components are grouped.

The Event Invokers, which a component is wrapped in, haven’t changed that much; those weren’t beans and aren’t now either.

So my hunch here would be that my assumption for 3.+ is similar as for 2.4.6.

No prob for the reply! If you find out it does work through your tests, feel free to comment again of course.