EventScheduler in Saga can schedule events, but doesn't seem to store them

Hi Allard,

I have the following situation. I have a Saga that wants to schedule some event to happen after a certain other event. I use an @Autowired transient EventScheduler, for which the impl is QuartzScheduler. After I do:
eventScheduler.schedule(new DateTime(System.currentTimeMillis() + 10 * 1000), new SomeEvent());

The event is handled by the @EventHandlers, but is not stored in the event store db. Is this an expected behavior or have i messed up my transaction/DefaultUnitOfWork config for sagas?

Here is question in a nutshell:

Events created by normal flow do get saved in events store (i use a jpa event store).
Events scheduled by an EventScheduler in a Saga get handled by their corresponding EventHandlers but don’t get saved in the events store.
Is this intended, or am I doing something that I shouldn’t be doing?



Hi Nikola,

events scheduled like this aren’t stored in the event store. Only events generated by an Aggregate are stored there. You can consider the scheduled events as application events.
Typically, these events triggers activity that will leave a trace in the event store (see discussion about scheduling commands instead).