2009-04-08 9 views
5

WCF netMSMQbindingを使用する場合、発注を保証することは可能ですか?netMSMQbindingによる注文配信

複数の更新コマンドを続けて挿入コマンドを実行し、同じキューに複数の更新プログラムが挿入されていることがあります。

広範なログを追加すると、キューに正しい順序で追加され、別の順序で処理されていることが明らかです。

私はGoogleに、この動作が予想されると述べている記事をいくつか管理していますが、何らかの順序で並べ替えるように設定する必要があるようです。それはトランザクション性

を失うことになると私は属性[DeliveryRequirements(RequireOrderedDelivery=true, QueuedDeliveryRequirements=QueuedDeliveryRequirementsMode.Require)]を追加する場合、私は次のエラーを取得する、

当社のキューは、トランザクションですので、私は先にシーケンス番号および再配列を追加することが仕事に行くされていることはないと思います:

The DeliveryRequirementsAttribute on contract 'IService' specifies a QueuedDeliveryRequirements value of NotAllowed. However, the configured binding for this contract specifies that it does support queued delivery. A queued binding may not be used with this contract.

すべてが正しく設定されているため、このエラーが発生する理由はわかりません。私は、WSM-RM設定であるように見えるので、MSMQに対してこの設定が許可されていることを確認することはできませんでした。また、AFAIK netMSMQBindingはWS-RMをサポートしていません。

+0

私は、このトピックにあなたが持っていたようではない正確に同じ問題を接続バグを提出したが、十分に近い...私はまた、溶液を持っています接続バグで。こちらをご覧ください:https://connect.microsoft.com/VisualStudio/feedback/details/1107645/wcf-receives-messages-from-msmq-out-of-order –

答えて

3

MSMQは発注をサポートしていません。

MSMQの結合能力を指定するクラスですSystem.ServiceModel.Channels.MsmqBindingElementBase + BindingDeliveryCapabilitiesHelperを見て、そしてそれは、そのプロパティを実装する方法:したがって、あなたがグループメッセージをできるよう

bool IBindingDeliveryCapabilities.AssuresOrderedDelivery 
{ 
    get 
    { 
     return false; 
    } 
} 
+0

パーフェクト。私が探していたちょうどdefinitveの答え。 – Modan

1

はルックスをあなた契約の順序を指定することができます。このMSDN article on grouping messagesを確認してください。それは注文した配信が可能であることを示唆しているよう

2

This post from Simon Gittinsが見えます:

As it turns out, there's an undocumented feature that deals with this situation:

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

Once these two things are done, my test program no longer produces out of order messages.

+0

実際には、 'ReleaseServiceInstanceOnTransactionComplete'を' false'に設定する必要があります([同じスレッド]の最後の投稿に書かれているように)http://social.msdn.microsoft.com/forums/ja-us/wcf/thread/D5E62C68-08FA-492C-BA05-182EC313A54B))。これをtrueに設定すると、実行時に起動例外が発生します。それ以外の場合は、順序を修正するようです。 – htuomola