Hello,
I am using Axon 2.0 with MongoDB and without Spring.
How is it possible to add Sagas during runtime?
The AnnotatedSagaManager doesn’t provide any methods for doing that. Is there a reason for it?
Thanks
Kind Regards
Hello,
I am using Axon 2.0 with MongoDB and without Spring.
How is it possible to add Sagas during runtime?
The AnnotatedSagaManager doesn’t provide any methods for doing that. Is there a reason for it?
Thanks
Kind Regards
Hi,
you mean you want to add Sagas without any event triggerig them? If that's the case, you should use the Repository. The SagaManager is only responsible for invoking the correct Saga instances for each incoming Event. The Repository stores the Sagas.
Cheers,
Allard
PS. Also look at Chapter 7 of the reference guide.
oh sorry, my question was not clear enough:
I would like to add sagaClasses (The types of Saga that this instance should manage) during runtime.
The AnnotatedSagaManager only supports adding sagaClasses over the constructor.
Is there any reason for that?
Thanks
Hannes
Hi Hannes,
the simple answer is: unless I design something for mutability, it’s immutable. It never actually crossed my mind to change the Saga types supported by a SagaManager at runtime.
What you could do, as an alternative, is to create a new SagaManager instance at runtime that supports new saga types. If you register that new manager to an EventBus, it’ll start processing.
Hope that helps.
Cheers,
Allard