I have two Axon @EventHandler's that need to be processed in a certain order (they have DIFFERENT events to handle). I have read that i need to:
- annotate all involved event handlers with org.axonframework.config.ProcessingGroup (order seems only applicable within one processingGroup); annotation is done at class level,
- use org.springframework.core.annotation.Order to determine priority; annotation is done also at class level
But even with this annotation, the events are handled in the order that they have been triggered. Or this functionality is only applicable for the same types of events ? Pseudo-code would look like below :
@Component
@RequiredArgsConstructor
@ProcessingGroup("mytest")
@Order(2)
public class Test2RecordProjection {
@EventHandler
public void on(Test2CreatedEvent evt) {
...
}
}
@Component
@RequiredArgsConstructor
@ProcessingGroup("mytest")
@Order(1)
public class Test1RecordProjection {
@EventHandler
public void on(Test1CreatedEvent evt) {
...
}
}
Axon 4.0