I’m back to my PoC that by now looks quite OK. The “reading” (and “processing”) part is pretty done using AggregateRoot and Event Sourcing. Now I’m focusing on the “writing” part, where I plan to use Sagas.
Client <----ES+AR-----> Axon Application <----Saga----->Server (DB/WS/Rest,…)
I did a first draft of a very simple Saga, basically it only sends data to a Rest service and controls success/failure/timeout. But now I’m trying to “complicate” this example by invoking several services, control all their success/failure/timeouts and coordinate the final actions (nothing if everything is OK, a bunch of Compensation Actions if any of then fails).
For this I have to keep some kind of state inside the Saga, know how to determine the success/failure/timeouts and how/when to invoke compensation actions.
I have looked to all examples I could find but they are very simple, practically only use timeouts of other scheduled events. I see nothing about coordination and even less Compensation Actions that are fundamental part of Sagas as described in the Garcia-Molina/Salem paper - “(…) each saga transaction T1 should be provided with a compensation transaction C1.”
Moreover, browsing thru the Axon code I don’t see also no specific support for this concerns - success/failure (it does have for timeouts), coordination, Compensation Actions. In my opinion (that again is of someone who little experience in DDD et al.) at least Compensation Actions should be explicitly defined by the framework, and even maybe a “default” handling mechanism for it.
So is there any examples of “complicated” Sagas, or best practices in Axon?
Thanks for all.