Callback support

Component: RabbitMQ Transport
NuGet Package NServiceBus.RabbitMQ (3.x)
Target NServiceBus Version: 5.x

When scaling out an endpoint, any of the endpoint instances can consume messages from the same shared broker queue. However, this behavior can cause problems when dealing with callback messages because the reply message for the callback needs to go to the specific instance that requested the callback.

Callbacks are enabled by default, and the transport will create a separate callback receiver queue, named {endpointname}.{machinename}, to which all callbacks are routed.

DisableCallbackReceiver

If callbacks are not being used, the callback receiver can be disabled using the following setting:

var transport = busConfiguration.UseTransport<RabbitMQTransport>();
transport.DisableCallbackReceiver();

This means that the queue will not be created and no extra threads will be used to fetch messages from that queue.

CallbackReceiverMaxConcurrency

By default, 1 dedicated thread is used for the callback receiver queue. To add more threads, due to a high rate of callbacks, use the following:

var transport = busConfiguration.UseTransport<RabbitMQTransport>();
transport.CallbackReceiverMaxConcurrency(10);

Related Articles

  • Client side Callbacks
    The client (or sending process) has its own queue. When messages arrive in the queue, they are handled by a message handler.

Last modified