I have some queries since I am new to the MassTransit saga.
Queries:
Scenario:
Let's take an example of food delivery.
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.