How to get access to SagaRepository and AnnotatedSagaManager instances?


I want to deliver special events to sagas and need it for that.


Hi Carsten,

I had the check the source code for it, but is seems like the Repository and SagaManager beans aren’t exposed as part of the Spring context when you use auto-configuration.
The workaround would be to configure the components as Spring beans, instead of using the @Saga

Use the AnnotatedSagaRepository(Class, SagaStore<? super T>, ResourceInjector, ParameterResolverFactory) constructor, where the latter three components should be available already (and thus autowirable) in the Spring context.
For the SagaManager, configure a SubscribingEventProcessor, using a SagaManager as the EventHandlerInvoker. The messageSource is most likely your EventStore.

I have created an issue (#303) to improve in this in the 3.0.3 (coincidence) release.



Moin Allard,

many thanks for checking.
But at least my extensive debugging session yesterday gave me a much better understanding of startup and event workflow.

I came to the same idea of creating them myself this morning but didn’t tried it yet.

I will have to figure out where this can be done in axon 3.x resp spring boot.

Are you aware of any problems when subscribing the SagaManager to 2 event busses?

  1. The persistent event store
  2. A non persistent “service” bus

Having lot’s to learn and very much appreciate the help on this list!


Hi Allard,

I don’t think it is possible to keep the auto configuration but change only the creation of the saga configuration
without making changes to the axon framework or copying most of the auto configuration stuff.

There is no extension point that I could locate.


For the record:

Until some idiomatic way is created to access the sage manager I provide as a spring bean an eventbus delegator and intercept the subscribe-call
and subscribe to another simple event bus.

I hope it’s valid for a single saga manager to be subscribed to 2 event busses.