Saga Templates

Hello,

Sometimes we have SAGAs that are used for a similar problem, but with other types of events.
He would be great, instead of copying the same code in a new Saga type, that we instantiate the saga with different “parameters”… like generic classes -> new XXXSaga<X,Y,Z>() … .

Does Axon provide something like this?

Kind regards,
Koen

Hi Koen,

I am not aware of axon feature that does that. However, what you could do is to, instead of copying logic, is to extract the same logic into a separate (abstract) class and use inheritance / composition with ‘real’ sagas. That way, specific saga will react on its own events and it will reuse the extracted logic.

Hope this helps a bit!

Cheers,
Milan.

I think i can solve this with inheritance. Thanks for your input!