Saga pattern: simplification and speedup

Hello everyone!

I am planning to implement a persistent entity for a saga pattern in a microservice built with Lagom, similar to what is described in this forum thread, but more general.

Regarding this I have two questions:

  1. When the saga entity and the entities that should be changed “atomically” live in the same service, can the flow of control somehow be simplified?

  2. Suppose I am 99% sure that the commands issued by the saga pattern are executed without error (and don’t need to be rollbacked) and that speed is an issue, is there any problem if the saga entity issues commands to the other entities in parallel?

Of course then the book-keeping would be slightly more complicated:

  • The saga entities would issue all the commands in parallel.

  • The read-side processor would get all the success / failure events and would issue correspoding “feedback” commands to the saga entity.

  • The saga entity would “mark” the successful commands and, once it gets a failure command, change into “failure mode” and issue rollback commands (in parallel, again) to all successful commands it has already received and will receive in the future.

For all this to work, of course the entities would have to be relatively independent, so that no further cascade of commands is caused by all this.

Waiting for your opinion,

Holger