문제

We have an ASP.NET MVC application that currently sends commands to a NServiceBus (v3) service.

The service publishes events that we need to subscribe to within the web application so that we can display real time notifications to our users.

The bus is currently initialised as below within the web application:

private static IBus ConfigureBus()
{
    return NServiceBus.Configure.With()
        .DefaultBuilder()
        .XmlSerializer()
        .MsmqTransport()
            .IsTransactional(false)
            .PurgeOnStartup(true)
        .UnicastBus()
            .LoadMessageHandlers()
        .CreateBus()
        .Start(() => Configure.Instance.ForInstallationOn<Windows>().Install());
}

With the following configuration in web.config:

  <!-- NServiceBus -->
  <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
  <UnicastBusConfig ForwardReceivedMessagesTo="audit">
    <MessageEndpointMappings>
      <add Assembly="Foo.DocumentService.Messages" Endpoint="Foo.DocumentService.Host" />
    </MessageEndpointMappings>
  </UnicastBusConfig>

However, the event handler I have created within the web application is not invoked, no queue is created for the web application and I don't see any subscription messages sent to the host.

Am I missing something?

도움이 되었습니까?

해결책

After enabling logging I could see that NServiceBus was not actually getting initialised (which is why no queues were created).

The issue turned out to be how I had configured Ninject as the bus was being lazily initialised. A quick change to my bindings and everything worked.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top