nservicebus加载双重订阅

时间:2013-10-24 07:05:12

标签: c# sql nservicebus4

我的ICommand处理程序被调用了两次!
我自己在IIS中托管nservicebus(并使用Cassini进行调试)。

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

以下是启动后SQL Server [audit]表中的邮件头,对同一事件处理程序的两个订阅

我遇到与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>
{
     ...
}

1 个答案:

答案 0 :(得分:1)

我的结论必须是NServiceBus不能自我托管。 我没有为此找到补救措施,必须得出结论认为它“不可能。”