DeadlineManager vs EventScheduler

Hi Everyone,

I have been reading the docs of the DeadlineManager and the EventScheduler provided by Axon. Although they do have some differences they have some common ground too in that both can take care of publishing events in the future. What is the long term vision for both within Axon? Will both converge or will either one be deprecated?

The most prominent differences I notice:

  1. the DeadlineManager targets an aggregate instance which is not possible with the EventScheduler. Targeting a saga instance is possible with both DeadlineManager and EventScheduler though with different semantics: the DeadlineManager resolves the saga by saga identifier while the EventScheduler resolves the saga by association value.
  2. Events published by the DeadlineManager are not stored in the EventStore. I assume though, a @DeadlineHandler annotated method in an aggregate could still call AggregateLifycle.apply() to store events.

Am I correct?


Hi Benoît,

We envision to keep both alive, as both are definitely very valuable.

What we however noticed in practice, is that the EventScheduler was being used to set up a deadline for a specific Saga.

Additionally, setting up deadlines for Aggregates was also a reoccurring request we had.

Hence we figured introducing a Deadline mechanism dedicated to setting a deadline for a specific Scope (thus an Aggregate or Saga Scope, but also something we might expand in the future) was a worthwhile exertion.

Your assumptions are also correct. The EventScheduler schedules an Event to be published on the Event Bus. Handling that event in a Saga is thus through the association value, but could just as well be handled by anyone. A deadline however typically is in regards of a complex transaction (Saga) or a time limit of a given model (the Aggregate), thus fully belong to that single entry.

As such we viewed it shouldn’t be broadcast like a regular event, but remain within it’s scope.
Your second assumption is also correct. When you hit a @DeadlineHandler annotated function in an Aggregate, you will enter the Aggregate its life cycle. As such, you can use the AggregateLifecycle.apply() function to publish a new event.

I hope this gives you the necessary background :slight_smile:


Thanks for that Steven!