Mass-Transit Courier and two-phase transaction with tasks execute in parallel

212 Views Asked by At

Is it possible to implement two-phase transaction pattern if we want to get tasks execute in parallel instead of serial?

I mean, let us have two tasks: A, B. This tasks may be performed independently in parallel. A transaction is considered complete when both tasks, A and B, completed successfully. If task A succeeds but task B failed, then we should compensate task A. Can this behaviour be configured by means of Mass-Transit Courier?

2

There are 2 best solutions below

1
Chris Patterson On

MassTransit Courier is a routing slip implementation in which activities are executed sequentially. There is no facility for parallel execution.

0
gopher On

There is a project that support parallel execution of tasks.

https://github.com/dtm-labs/dtm

https://github.com/dtm-labs/dtmcli-csharp

What you want is the saga pattern with the option Concurrent on.