2017-09-27 8 views
0

サービスバストピックサブスクリプションでフィルタルールを作成しようとしています。Azure Service Busトピックサブスクリプションフィルタルールを追加できません

foreach(var reciver in recivers) 
     { 
      try 
      { 
       var client = SubscriptionClient.CreateFromConnectionString(ServiceBusConnectionString, reciver.TopicName, reciver.SubscriptionName); 

       string ruleName = "customRule2"; 
       client.RemoveRule(ruleName); 

       var filter = reciver.Reciver.GetFilter(); 
       var ruleDescription = new RuleDescription(ruleName, filter); 

       client.AddRule(ruleDescription); 
       client.RemoveRule("$Default"); 

       client.OnMessage((msg) => { 
        reciver.Reciver.Recive(msg); 
       });      
      } 
      catch(Exception ex) 
      { 

      } 
     } 

例外は私が

client.RemoveRule(ruleName); 

次の行を削除し、それは拳の時間のために適切に働いているとしようとした

client.AddRule(ruleDescription); 

からなっています。しかし、アプリケーションが2回目に実行されると、例外が発生します。「メッセージングエンティティは既に存在しています」

しかし、既存のルールを削除し、サブスクリプションを開始するときに同じルールを追加する必要があります。

フル例外メッセージを以下に示し

Microsoft.ServiceBus.Messaging.MessagingException:サービスが要求を処理できませんでした。操作を再試行してください。例外タイプと適切な例外処理の詳細については、http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:a08300d4-9f59-4455-8519-5410198ba444_G16、SystemTracker:vp-servicebus-poc:トピック:test-topic2、タイムスタンプ:9/27/2017を参照してください。9: 17:35 AM ---> System.ServiceModel.FaultException 1[System.ServiceModel.ExceptionDetail]: The service was unable to process the request; please retry the operation. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:a08300d4-9f59-4455-8519-5410198ba444_G16, SystemTracker:vp-servicebus-poc:Topic:test-topic2, Timestamp:9/27/2017 9:17:35 AM at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.ThrowIfFaultMessage(Message wcfMessage) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.HandleMessageReceived(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory 1.RequestSessionChannel.RequestAsyncResult。 < Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory 1.RequestSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory 1.RedirectContainerSessionChannel.RequestAsyncResultでMicrosoft.ServiceBus.Messaging.IteratorAsyncResult 1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult 1.End(たIAsyncResult asyncResult) で> c.b__9_3(RequestAsyncResult thisPtr、たIAsyncResult R) 。 <> c__DisplayClass8_1.b__4(RequestAsyncResult thisPtr、たIAsyncResult R) Microsoft.ServiceBus.Messaging.IteratorAsyncResult 1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult 1.End(たIAsyncResult asyncResult) でMicrosoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory 1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result) at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory 1.RequestSessionChannel.RequestAsyncResultました。 < Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory > c.b__18_3でMicrosoft.ServiceBus.Messaging.IteratorAsyncResult 1.StepCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.ServiceBus.Common.AsyncResult 1.End(たIAsyncResult asyncResult) で> c.b__9_3(RequestAsyncResult thisPtr、たIAsyncResult R) スタックトレースの(TIteratorAsyncResult thisPtr、たIAsyncResult A) Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(たIAsyncResult結果)で ---エンド例外がスローされた--- Microsoft.ServiceBus.Commonで以前の位置から。 AsyncResult.End [TAsyncResult](IAsyncResult result) 、Microsoft.ServiceBus.Messaging.Sbmp.SbmpSubscriptionClient.OnEndAddRule(IAsyncResult result) ---内部のexの終了ceptionスタックトレース--- GでMicrosoft.ServiceBus.Messaging.SubscriptionClient.AddRuleでMicrosoft.ServiceBus.Messaging.Sbmp.SbmpSubscriptionClient.OnEndAddRuleで (たIAsyncResult結果) ServiceBusReciver.ServiceBusReciverBuilder.InitReciversで(RuleDescription記述) (): \プロジェクト\ ServiceBusReciver \ ServiceBusReciver \ Visual Studioの2015 \ ServiceBusReciverBuilder.cs \ドキュメント:ライン42

答えて

0

WindowsAzure.ServiceBus.dllバージョンでは問題がありました。 WindowsAzure.ServiceBus.dllのバージョンを4.1.3から4.1.2にダウングレードしました。これは完璧に機能しています。

EDIT:この問題は、ループO/Wオペレーションのシーケンスを持っているだろうシンプルなREPROコードを試してみて、再び

+0

私はちょうど4.1.3で試してみました、それはあまりにも私のために働いた... – Mikhail

+0

を得ています。ブレークポイントとして、エンティティを検査します。 –

+0

ここでは、複数のサブスクライバを動的に作成し、foreachループを使用してフィルタルールを動的に追加します。時にはそれはうまく動作しています。しかし、このエラーが発生することもあります。これは散発的な問題です。 –

関連する問題