I’ve been trying to use Deadline and it wasn’t working as I expected until I realised my mistake was defining the @DeadlineHandler outside of the Aggregate.
Like mentioned here:
When scheduling a deadline, the context from where it was scheduled is taken into account. That means a given scheduled deadline will only be triggered in its originating context. Thus any
@DeadlineHandlerannotated function you wish to be called on a met deadline, must be in the same Aggregate/Saga from which is was scheduled.
Axon calls this Context a Scope. If necessary, implementing and providing your own Scope will allow you to schedule Deadlines in your custom, scoped components.
Is there any reason why it has to be inside the Aggregate? Am I missing some obvious design? Since all our @EventHandler’s are defined in another class I wanted to have the @DeadlineHandler to be defined there as well.
I’m trying to understand how to use the ScopeDescriptor for that but can get me head around it yet. Do you have any example on how to use it?