No Axon Server
I have an aggregate that represents a delivery, with a date. On certain arbitrarily defined days since the delivery, a communication task may need to be performed. I will not know ahead of time which day since delivery, nor which task, so I will have to check a configuration once per day to let me know if there are any tasks for today.
I want to use the DeadlineManager to create an interval scheduler where, once per day, a Saga related to this delivery:
- wakes up
- calculates how many days ago the delivery was
- checks to see if there are tasks for the today (for example, if the delivery was 5 days ago, are there any Day 5 tasks?)
3.a. performs the task(s) if there are any to be performed
- schedules another deadline for tomorrow, to start the process all over again
I do not want all the deadlines to be at the same time of day (ie all tasks run at 3pm), since that would cause potentially thousands of Saga’s to wake up at once. Instead, I want each Saga to pick a random time tomorrow to schedule its next task deadline at. These deadlines will continue to be scheduled, ran, and rescheduled until a global timeout is reached (normally 60 days after delivery).
I was attempting to do this without applying events because:
- I need to operate off of realtime right now, not based off the date of any event
- the ability to replay events would be counterproductive, since the communication tasks need to be sent out in realtime
- Most days there will not be any task to perform, so it seems like applying the event would just fill the Event Store with noise.
I was also trying to do this without scheduling all 60 deadlines ahead of time, because it seemed like a lot to schedule all at once.
Is the above possible in Axon? I have noticed that the SagaTestFixture only allows for the assertion of scheduled deadlines at specific Instants, but I need to assert that the scheduled deadline is between an upper and lower bound (ie, just some time tomorrow).
Moreover, I have deployed my implementation of the above logic to our Dev environment, and have noticed that Quartz regularly will acquire a scheduled trigger, but fail to invoke the corresponding DeadlineHandler in the Saga, which effectively breaks the chain of daily tasks since the DeadlineHandler is responsible for scheduling the next deadline. I am using the DeadlineManager elsewhere in the application without issue, which makes me think that there is something in the above implementation that framework cannot guarantee can be performed correctly.