Share via


More Information on Processing MSMQ Messages in FIFO Order

In two of my previous posts  I talked about processing MSMQ messages in FIFO order with WCF.

The way that WCF, along with the MSMQ binding, works there could be a couple of situations in which messages may actually not process in FIFO order. 

The most prevalent is a rollback.  When a message is rolled back the process is asynchronous and thus end up not only having that message take time to get back to the head of the queue but may also lead to messages being processed while the rolled back message is in flight. 

However, not all is lost.  By adding the changes below you can further ensure that you can make WCF behave like a pure System.Messaging coded system and still get your messages in FIFO order.

So, add

<transactedBatching maxBatchSize="1"/>

as an endpoint behavior and setting

ReleaseServiceInstanceOnTransactionComplete = false

on the Service Behavior (along with the InstanceContextMode and the ConcurrencyMode)