NserviceBus问题 - 订阅者没有收到消息

时间:2014-12-12 21:48:38

标签: nservicebus

我正在使用2.5.0.1442版本的NserviceBus与发布者和订阅者配置,并且在本地计算机上运行时设置正常。我可以看到订阅者接收消息并处理它,但是当我发布到Windows 2008 R2服务器时它没有收到任何消息。这是配置:

使用Web应用程序发布消息和窗口服务以侦听已发布的消息。 Web应用程序和Windows服务都在同一台服务器上。

出版商:

var bus = NServiceBus.Configure.WithWeb()
                .Log4Net()
                .DefaultBuilder()
                .XmlSerializer()
                .MsmqTransport()
                    .IsTransactional(true)
                    .PurgeOnStartup(false)
                .MsmqSubscriptionStorage()
                .UnicastBus()
                .CreateBus()
                .Start();

<MsmqTransportConfig InputQueue="tnt_publisherinput" ErrorQueue="tnt_error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
  <MessageEndpointMappings></MessageEndpointMappings>
</UnicastBusConfig>
<MsmqSubscriptionStorageConfig Queue="tnt_subscriptions" />

订户:

NServiceBus.Configure.With() 
.Log4Net() 
.DefaultBuilder() 
.XmlSerializer() 
.UnicastBus() 
.LoadMessageHandlers();


<MsmqTransportConfig InputQueue="timetrace_subscriberinput" ErrorQueue="timetrace_error" NumberOfWorkerThreads="1" MaxRetries="1" />
<UnicastBusConfig>
  <MessageEndpointMappings>
    <add Messages="Tnt.Messages" Endpoint="tnt_publisherinput" />
  </MessageEndpointMappings>
</UnicastBusConfig>

启动服务时,发布者和订阅者队列中都有完成消息:

<?xml version="1.0" ?>
<Messages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.net/NServiceBus.Unicast.Transport">
  <CompletionMessage>
    <ErrorCode>0</ErrorCode>
  </CompletionMessage>
</Messages>

这是服务启动后日志中的一个片段:

.
.
.

2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Messages.ReadyMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Saga.ISagaMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Saga.TimeoutMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Grid.Messages.ChangeNumberOfWorkerThreadsMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Grid.Messages.GetNumberOfWorkerThreadsMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Grid.Messages.GotNumberOfWorkerThreadsMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Unicast.Transport.CompletionMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message NServiceBus.Unicast.Transport.SubscriptionMessage has been allocated to endpoint .
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Message Tnt.Messages.UpdatedMessage has been allocated to endpoint tnt_publisherinput.
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'Tnt.Messages.UpdatedMessage' message with 'Tnt.UpdatedHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.Grid.Messages.ChangeNumberOfWorkerThreadsMessage' message with 'NServiceBus.Grid.MessageHandlers.ChangeNumberOfWorkerThreadsMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.Grid.Messages.GetNumberOfWorkerThreadsMessage' message with 'NServiceBus.Grid.MessageHandlers.GetNumberOfWorkerThreadsMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.IMessage' message with 'NServiceBus.Grid.MessageHandlers.GridInterceptingMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Associated 'NServiceBus.IMessage' message with 'NServiceBus.Sagas.Impl.SagaMessageHandler' handler
2014-12-12 14:20 DEBUG NServiceBus.Utils.MsmqUtilities - Checking if queue exists: timetrace_subscriberinput.
2014-12-12 14:20 DEBUG NServiceBus.Utils.MsmqUtilities - Checking if queue exists: timetrace_error.
2014-12-12 14:20 INFO  NServiceBus.Unicast.Transport.Msmq.MsmqTransport - You are running a community edition of the software which only supports one thread.
2014-12-12 14:20 INFO  NServiceBus.Unicast.UnicastBus - Subscribing to Tnt.Messages.UpdatedMessage, Tnt.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null at publisher queue tnt_publisherinput
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Sending message NServiceBus.Unicast.Transport.CompletionMessage, NServiceBus.Core, Version=2.5.0.1442, Culture=neutral, PublicKeyToken=9fc386479f8a226c with ID 230d6ed0-8ed1-4405-a5a1-f89c5eb0b959\219324 to destination tnt_publisherinput.
ToString() of the message yields: NServiceBus.Unicast.Transport.CompletionMessage
Message headers:
SubscriptionMessageType:Tnt.Messages.UpdatedMessage, Tnt.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, EnclosedMessageTypes:
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Calling 'HandleBeginMessage' on NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule
2014-12-12 14:20 INFO  NServiceBus.Unicast.UnicastBus - timetrace_subscriberinput initialized.
2014-12-12 14:20 DEBUG NServiceBus.Unicast.UnicastBus - Calling 'HandleEndMessage' on NServiceBus.SagaPersisters.NHibernate.NHibernateMessageModule

但每当我通过网络应用程序发送消息时,都没有任何反应(我确认该消息实际上是从Web应用程序发布的,并且消息程序集名称是正确的)。没有错误,日志中没有记录任何内容。我已经在队列中打开日志,除了完成消息之外没有消息。不确定还需要配置什么。

请帮忙。

2 个答案:

答案 0 :(得分:1)

您是否将订户的端点映射更改为指向远程服务器?

即。 <MessageEndpointMappings> <add Messages="Tnt.Messages" Endpoint="tnt_publisherinput@servername" /> </MessageEndpointMappings>

为什么要使用这样一个旧版本的NServiceBus?

注意:如果您使用Web服务器作为发布者,您将只能拥有一个逻辑发布者,因此,如果您要扩展Web层,您可以考虑构建一个订阅管理器(一个集中管理所有订阅的过程)对于Web层)

答案 1 :(得分:0)

使其工作的原因是卸载MSMQ并在没有&#34; Active Directory集成的情况下重新安装它。服务器上的选项。重启服务器后,一切正常。

感谢您的时间和回应Sean Farmar。