2013-10-24 87 views
0

我的ICommand處理程序被調用兩次!
我在IIS中自我託管nservicebus(並使用卡西尼進行調試)。nservicebus加載雙訂閱

 Configure.ScaleOut(_ => _.UseSingleBrokerQueue()); 
     Configure.With() 
      .AutofacBuilder(container) 
      .InMemorySubscriptionStorage() 
      .UseInMemoryTimeoutPersister()     
      .UseTransport<SqlServer>("myconnectionstring") 
      .UnicastBus() 
      .PurgeOnStartup(true) 
      .CreateBus() 
      .Start(() => Configure.Instance.ForInstallationOn<Windows>().Install()); 

下面是在SQL服務器的消息標題[審計]表啓動之後,有兩個訂閱同一事件的處理程序

我與ICommand處理器遇到了同樣的問題,它是在響應被稱爲兩次到bus.Send(new CommandInstance())

{"NServiceBus.MessageId":"2a02a10c-9e97-4bc7-9fe9-a26100912bc5","NServiceBus.CorrelationId":"2a02a10c-9e97-4bc7-9fe9-a26100912bc5","NServiceBus.OriginatingEndpoint":"Aureus.Web","NServiceBus.OriginatingMachine":"ARWEN","NServiceBus.MessageIntent":"Subscribe","NServiceBus.ControlMessage":"True","SubscriptionMessageType":"Aureus.Messages.Invoicing.IBalanceCapturedEvent, Aureus.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","WinIdName":"PALANTIR\\Craig","NServiceBus.Version":"4.0.0","NServiceBus.TimeSent":"2013-10-24 06:48:33:086263 Z","NServiceBus.ConversationId":"fcef12be-9904-4fd3-9807-a26100912bc6","NServiceBus.ProcessingEndpoint":"Aureus.Web","NServiceBus.ProcessingMachine":"ARWEN","NServiceBus.ProcessingStarted":"2013-10-24 06:48:33:419799 Z","NServiceBus.ProcessingEnded":"2013-10-24 06:48:33:425799 Z","NServiceBus.OriginatingAddress":"Aureus.Web"} 
{"NServiceBus.MessageId":"3c8d0bdd-4951-44af-aff7-a26100912bc5","NServiceBus.CorrelationId":"3c8d0bdd-4951-44af-aff7-a26100912bc5","NServiceBus.OriginatingEndpoint":"Aureus.Web","NServiceBus.OriginatingMachine":"ARWEN","NServiceBus.MessageIntent":"Subscribe","NServiceBus.ControlMessage":"True","SubscriptionMessageType":"Aureus.Messages.Invoicing.IBalanceCapturedEvent, Aureus.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","WinIdName":"PALANTIR\\Craig","NServiceBus.Version":"4.0.0","NServiceBus.TimeSent":"2013-10-24 06:48:33:176271 Z","NServiceBus.ConversationId":"5c47ca76-b2ea-4108-836e-a26100912be1","NServiceBus.ProcessingEndpoint":"Aureus.Web","NServiceBus.ProcessingMachine":"ARWEN","NServiceBus.ProcessingStarted":"2013-10-24 06:48:33:440801 Z","NServiceBus.ProcessingEnded":"2013-10-24 06:48:33:440801 Z","NServiceBus.OriginatingAddress":"Aureus.Web"} 

我有在組裝一個特定的命令一個命令處理程序。它被稱爲兩次。

該事件被調用兩次

/// <summary> 
/// The balance captured handler. 
/// </summary> 
public class BalanceCapturedEvt : IHandleMessages<IBalanceCapturedEvent> 
{ 
    ... 
} 
+0

事件處理程序是否託管在同一端點上(自託管的IIS)? –

+0

是的,它在同一個進程中託管。 – Jim

+0

該命令似乎也會被觸發不止一次,即使它是完全不同的界面。 – Jim

回答

1

我的結論必須是NServiceBus不工作以及相當自我主辦。 我還沒有找到這方面的補救措施,並得出結論,它'不可能。