Order delivery using netMSMQbinding

Is it possible to guarantee custom delivery when using WCF netMSMQbinding?

We put the insert command, followed by several update commands in the same queue, and sometimes one of the updates removes the insert.

By adding an extensive journal, it is clear that they are added to the queue in the correct order and processed in a different order.

I managed to publish several Google articles that say that this behavior is expected, but it seems that it can be customized in some way.

Our queues are transactional, so I don’t think that adding sequence numbers and re-alignment at the destination will work as it will lose the transaction

If I add the attribute [DeliveryRequirements(RequireOrderedDelivery=true, QueuedDeliveryRequirements=QueuedDeliveryRequirementsMode.Require)] , I get the following error:

In the DeliveryRequirementsAttribute attribute in the IService contract, the QueuedDeliveryRequirements value is NotAllowed. However, the configured binding for this contract indicates that it supports queuing. queue binding cannot be used with this contract.

I have no idea why we get this error, since everything "appears" is configured correctly. I was not able to find confirmation that this parameter is enabled for MSMQ, although it appears that the WS-RM parameter, and AFAIK netMSMQBinding does not support WS-RM.

+5
source share
3 answers

MSMQ does not support ordered delivery, so you cannot.

Take a look at System.ServiceModel.Channels.MsmqBindingElementBase + BindingDeliveryCapabilitiesHelper, which is a class that defines MSMQ binding capabilities and how it implements this property:

 bool IBindingDeliveryCapabilities.AssuresOrderedDelivery { get { return false; } } 
+3
source

This post from Simon Gittins looks like it offers the option of ordered delivery:

As it turned out, there is an undocumented function that deals with this situation:

  • Apply a TransactedBatchingBehavior with an ONE batch size to the service endpoint.
  • ReleaseServiceInstanceOnTransactionComplete must be set to true in the service implementation.

As soon as these two things are completed, my test program will no longer issue error messages.

+2
source

It looks like you can group messages, so you can specify the order in the contract. Check out this MSDN article on message grouping .

+1
source

All Articles