Hi,
We have a requirement that 2 projection writers listen to the same event but one EventHandler should definitely be fired before the other. So I added @ProcessingGroup and @Order.
Class 1
`
@ProcessingGroup(“employeeprocessinggroup”)
@Order(2)
@Component
public class EmployeeCorrelationWriter {
private CorrelationRepository repository;
@Autowired
public EmployeeCorrelationWriter(CorrelationRepository repository) {
this.repository = repository;
}
@EventHandler
public void on(EmployeeEnrolledEvent event) {
LOGGER.debug(“Handling event {}”,event);
Correlation correlation = new Correlation(event.employeeId, null, event.employerId, null);
repository.save(correlation);
`
Class 2
`
@ProcessingGroup(“employeeprocessinggroup”)
@Order(1)
@Component
public class EmployeeWriter {
private static final Logger LOGGER = getLogger(EmployeeWriter.class);
// Eventhandlers for enrollment of an employee
@EventHandler
public void on(EmployeeEnrolledEvent evt) {
LOGGER.debug(“Handling {}”, evt.toString());
// more logic
`
Questions:
-
Is there a way to debug in which sequence axon will run the event handlers?
-
Is there a way to test this behaviour?
Regards, Norbert
@Allard&Steven: Great course last week