Axon 3.0.1 - EventScheduler on @Saga won't works

Hi I forked the AxonBank sample project (Axon 3.0.1) and added an EventScheduler on BankTransferManagementSaga to Test EventScheduler.
Here the commit diff

This is the Scheduler config:

`

@Bean
public EventScheduler eventScheduler(EventBus eventBus) {
return new SimpleEventScheduler(Executors.newScheduledThreadPool(5), eventBus);
}

`

on the BankTransferManagementSaga I added one Scheduled DummyScheduledEvent.

On publishing BankTransferCreatedEvent the Saga Schedule DummyScheduledEvent after 30 seconds.

`

eventScheduler.schedule(
Instant.now().plusSeconds(30),
new DummyScheduledEvent(event.getBankTransferId())
);

`

debugging the Scheduler I can see it starts and complete without errors but the eventHandler on the Saga is never called:

`

@SagaEventHandler(associationProperty = “bankTransferId”)
public void on(DummyScheduledEvent event) {
System.out.println("Scheduled Event " + event);
}

`

Is it a Bug or I’m missing something?

Regards

Hi Pietro,

the Event probably does trigger, but the chance is big that the Saga lifecycle has already ended before that. This saga manages a transaction, which is a matter of milliseconds. You scheduled event is published after 30 seconds.

If yo remove the @End annotations from the handlers (especially the on(DestinationBankAccountCreditedEvent event)), you should see the method being invoked.

Cheers,

Allard

Yes, it worked, My fault.

thanks