Matt Hogan-Jones
Matt Hogan-Jones

Reputation: 3103

NServiceBus send messages not appearing at endpoint

I have a problem in NServiceBus 3.

I'm trying to send messages to an endpoint. The message type and endpoint is configured in the config as

<UnicastBusConfig>
    <MessageEndpointMappings>
        <add Messages="GatewayMessages.ProcessAttachmentCommand, GatewayMessages" Endpoint="Attachments"/>
    </MessageEndpointMappings>
</UnicastBusConfig>

The endpoint has, in its EndpointConfig.cs, the following configuration:

        Configure
            .With()
            .DefineEndpointName("Attachments")
            .DefaultBuilder()
            .DBSubcriptionStorage()
            .XmlSerializer()
            .FileShareDataBus(@"C:\Attachments\nservicebus\databus")
            .MsmqTransport()
            .UnicastBus()
            .LoadMessageHandlers()
            .CreateBus()
            .Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());

I also have a IMutateTransportMessages class configured with

        Configure.Instance.Configurer.ConfigureComponent<TransportMessageCompressionMutator>(DependencyLifecycle.InstancePerCall);

The problem I'm getting is when calling Bus.Send with the ProcessAttachmentCommand the endpoint isn't receiving anything. With the endpoint stopped I'm not even seeing any messages appearing in the endpoint queue.

With a breakpoint in the MutateOutgoing method of the TransportMessageCompressionMutator I can see the outgoing message, so it looks like the call to Bus.Send is OK but it doesn't appear to be going to the endpoint.

Is there anywhere else other than the configuration I've included that may influence the delivery of messages? And is there any way at the message level to see where they're being directed?

My NServiceBus host doesn't log any errors, it's like the messages are just vanishing. It's most confusing!

Upvotes: 2

Views: 2636

Answers (1)

Matt Hogan-Jones
Matt Hogan-Jones

Reputation: 3103

Turns out this was an error caused by a change to the MessageEndpointMappings. The version I posted in my question is not actually what was being used. This is the actual version:

<UnicastBusConfig>
    <MessageEndpointMappings>
        <add Messages="GatewayMessages.ProcessAttachmentCommand, GatewayMessages" Endpoint="Attachments"/>
        <add Messages="GatewayMessages" Endpoint="Services.Saga"/>
    </MessageEndpointMappings>
</UnicastBusConfig>

The second MessageEndpointMappings had gone in and NSB was using that config to determine the destination of all message classes within the GatewayMessages assembly.

Ah, human error!

Upvotes: 3

Related Questions