2
votes

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!

1
Is the attatchments q transactional? Does anything end up in the msmq dead letter queues? Turn on the journaling on the q to see if there are messages beeing processed from that q.Andreas Öhlund
@AndreasÖhlund I believe the q is transactional. The queue is created by NServiceBus automatically - does NSB create transactional queues by default? I can see no messages in the dead letter queue. With journalling on I can see other message types going on the queue but the ProcessAttachmentCommand message is not reaching the Attachments queue.Matt Hogan-Jones
Yes NSB create them transactional. Does it work if you disable your mutator?Andreas Öhlund
Removing the mutator doesn't have any effect unfortunately. Messages sent to the same endpoint from other assemblies are working OK, so I think there's something up with sending from this specific one. There are no messages appearing in the error q and NSB isn't reporting anything wrong.Matt Hogan-Jones
I'll grab the source code and see if I can find out anything by debugging into NSB.Matt Hogan-Jones

1 Answers

3
votes

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!