I have some queries since I am new to the MassTransit saga.
Queries:
- Is it feasible to introduce parallelism with MassTransit saga?
- If so what is the proper way?
- If so what about the compensation mechanism?
Scenario:
Let's take an example of food delivery.
- pack cookies
- unpack cookies
- pack tea
- unpack tea
- wrap both in a good package.
- unwrap
- complete the order
- Cancel order
Let's assume I want to perform actions 1 and 2 parallelly and then 3 and finally 4.
** What could be the better way to do actions 1 and 2 parallelly keeping the compensation mechanism in mind?
N.B.
masstransit-discuss thread link) from this thread, maybe I can perform actions 1 and 2 parallelly with the composite event. If I do this way then how to handle the compensation in case of failure of any one of the actions 1 or 2?
MassTransit sagas (state machine or otherwise) do not support compensation. If the saga orchestrates consumers and/or processes events, the state of those consumers is the responsibility of the developer to track. In the event that subsequent events/behaviors are unsuccessful and compensation of previous behaviors is necessary, that's up to the developer.
If you truly need a distribution transaction behavior using MassTransit, you should be using Courier which is a routing slip implementation with compensation.