Search code examples
design-patternsmsmqmasstransit

Exactly-once-delivery and in-sequence-delivery with MassTransit on MSMQ


Using MassTransit on MSMQ can we automatically support exactly-once-delivery (e.g., when an event store publishes events twice) and in-sequence-delivery (e.g., when two nodes concurrently write/publish events, it is possible that node A stores event #2, then node B reads event #2, node B stores event #3, node B publishes event #3, node A publishes event #2 - a typical race condition)?

And if MassTransit does not support that out of the box (which I am currently assuming), what is the best/common approach to implement these two requirements with MassTransit/MSMQ.


Solution

  • MassTransit follows Actor model's no guarantees for order of message delivery. It does however have Sagas to help with arbitrary handling of order. You may also consider implementing your consumers as idempotent.