Load saga properties from various contexts


We are using Axon in combination with a process engine. Our current approach is to control the whole process engine flow via a saga. This seems to work well but now we want to move also some remaining process variables into the saga. However, this means that we have to access the saga from various contexts (e.g. The ui).

How do we do this? We tried to use the SagaRepository, but there is no bean for this in our Spring context. Is there maybe even another approach more suitable?

Thank you and best regards,


Hi Nils,

I do not fully comprehend why you need to access the Saga’s state from for example the UI.
The state of the Saga is solely intended so that the Saga can resolve the ‘Complex Business Transaction’ at hand.
Thus, it is not meant to be queried for, for example, the UI.

If you need the accumulation of the state of the Saga, I’d recommend you introduce another Event Handling Component that is capable of creating this state for you.
I understand that this means you’re duplicating this View-Model logic, but I feel the segregation of concerns is important in this case.
To ensure both the Saga state and your view model are created identical, you could share this ‘State Object’ and let it handle the events to update itself.
Doing so ensure that, given that your Saga and (regular) Event Handling Component handle the same events, that the end result is identical.

If you really need to query the SagaRepository yourself by the way, then you should know that you need to use the Association Values table as well (also accessible through the SagaRepository).
This table forms a cross reference between the association values you set for a Saga instance and the actual Saga Id.
Then, with the Saga Id, you can retrieve a specific Saga instance from the repository.
However, as pointed out, I do not think that’s the best approach to take, as it is mixing concerns.

That’s my two cents to the situation.