1
votes

Having read up on the Deadline and EventScheduler in the Axon Framework, I cannot seem to find any documentation linked to Deadlines being recurring. I need to schedule a command to be executed every X amount of hours. I was hoping to use the Deadline. Are Deadlines recurring for a single Saga or are they once off (the naming "Deadline" implies once off based on my understanding of a deadline LOL)?

Would it be better to schedule an event to be fired ever X hours of type "TimePeriodLapsedEvent" and then publish a command based on that event?

Thanks in advance

1

1 Answers

2
votes

Axon's implementation of deadlines is to provide a @DeadlineHander annotated method in either an aggregate or a saga.

Then, you'd schedule a deadline to occur, within a given scope, by using the DeadlineManager.

The scheduled deadline will at the given time land in the handler, but only on a specific aggregate/saga instance.

Thus, reoccurring operation triggers through deadlines could be achieved, but that mostly feels like you'd be "retrigger" such an operation for every instance. Not sure whether that's desirable.

However it is perfectly doable. To achieve a reoccurring deadline, at the moment you'd simply use the DeadlineManager in the @DeadlineHandler annotated method to schedule a subsequent deadline.

Hope this sheds some light on the situation Kenneth!