Hi Folks,
I’m curently thinking and discussing with some guys the ability to externalize the execution of Saga out of Axon.
In general we are evaluating the usage of a flow-models for BASE transactions as used in orchestration scenarios with self-contained systems. Many platforms offer solutions for this problems. Axon uses Sagas, AWS uses StepFunctions, Spring uses Spring Cloud Data Flow etc. This approaches have some drawbacks regarding readability and get pretty complex in scenarios with compensation. In doing so, I’m evaluating a possibility to delegate the Saga execution to a process engine, which can execute BASE transactions modelled as BPMN 2.x. BPMN 2.x is very powerful in modeling orchestration and has well-defined concepts for transaction, messaging and compensation and is wide adopted in the industry by developers and business people.
The Saga will then not be a annotated Java class, but rather a configuration mapping of the Axon events to BPMN 2.x signals and the engine will be interacting with the EventBus / CommandBus infrastructure to drive the transaction.
There are several possibilities to do so:
-
The simpliest is to register own MessageConsumer, delegating all events to a component that quits Axon infrastructure and does everything on its own.
-
In the same time, I’m very interesting in keeping Axon Saga at place, but just delegating the execution of the event handler to external component. My goal is to get it running first and then try to create a generic delegating component suitable for all Sagas with the configuration of event mapping. This will also include the storage of Saga internal state not in the Axon infrastructure, but in external process variables inside of the process engine.
As far as I understood the code, I’ll need to implemement a different Saga Manager for that which would do the delegation instead of the current execution.
Some questions so far:
-
Do you think the replacement of Saga Manager is a correct/intended approach?
-
Would I just register a let’s say “MySagaManager” and return it instead of a Subsrcibing / Tracking Saga Manager using the SagaConfiguration?
-
I’m a little locked in the code, since SagaConfiguration needs to be returned, but it has a private constructor and the only factory methods create Tracking/Subscribing SagaConfiguration with a Hard-Coded annotated SagaManager at place. Any ideas how I can by-pass this?
-
If there are no ways to bypass this, what will be the interface I want to implement to “simulate” SagaManager interaction? Does it mean I have to go with 1) instead of 2) ?
Kind regards,
Simon