Two @StartSaga in the same Saga

Hello,

is it possible to put two StartSaga in the same Saga like the example below ?

in my case, the saga can be started by the event A or B, in the case it’s started by A, the execution of events will be as follows: A → B → C → D, in the case it’s started by B, the execution of events will be as follows: B → C → D

@StartSaga
@SagaEventHandler(associationProperty = KEY)
public void on(A evt) { }

@StartSaga
@SagaEventHandler(associationProperty = KEY)
public void on(B evt) { }

@SagaEventHandler(associationProperty = KEY)
public void on(C evt) { }

@EndSaga
@SagaEventHandler(associationProperty = KEY)
public void on(D evt) { }

Hi,

In general it is not a problem to have any arbitrary number of start and end methods for a saga. If the saga of already exists the association property is responsible for routing events to correct instance.

I don’t see any problems with your example. Is it not working?

Cheers,

Simon