1

Can I somehow choose not to create _skipped queues in a request/response scenario?

We have chosen to build our app like this (don't ask why, it has its reasons). We are doing a PublishRequest to multiple consumers and only one consumer responds. all others will generate a skipped queue (timeout error). I don't want to change this structure. But if I could disable the creation of skipped queues in RabbitMQ, then it would be perfect.

BusControl for request:

BusControl = Bus.Factory.CreateUsingRabbitMq(busFactoryConfig =>
{
    busFactoryConfig.Host(new Uri(ServerUrl), hostConfig =>
    {
        hostConfig.Username(Username);
        hostConfig.Password(Password);
    });
    busFactoryConfig.AutoDelete = true;
    busFactoryConfig.Durable = true;
});

Request method:

var requestClient = BusControl.CreatePublishRequestClient<TRequest, TResponse>(TimeSpan.FromMilliseconds(5000));
TResponse response = TaskUtil.Await(() => requestClient.Request(request));

BusControl for respond:

BusControl = Bus.Factory.CreateUsingRabbitMq(busFactoryConfig =>
{
    IRabbitMqHost rabbitMqHost = busFactoryConfig.Host(new Uri(ServerUrl), hostConfig =>
    {
        hostConfig.Username(Username);
        hostConfig.Password(Password);
    });

    busFactoryConfig.ReceiveEndpoint(rabbitMqHost, receiveEndpointConfig =>
    {
        if (RetryLimit > 0)
            receiveEndpointConfig.UseRetry(Retry.Incremental(3, 5000, 5000));
        receiveEndpointConfig.Consumer<TConsumer>();
        receiveEndpointConfig.PurgeOnStartup = false;
        receiveEndpointConfig.AutoDelete = true;
        receiveEndpointConfig.Durable = true;
    });
});

Respond method in consumer:

return context.RespondAsync(response);

If I want to timeout a consumer which will generate a dead-letter message and a skipped queue, then I return this:

return Task.CompletedTask;

But I don't want the skipped queue which is visible in the RabbitMQ GUI, other than that it is working great.

I also asked the same question to Chris Patterson a few months ago but didn't get an answer: https://stackoverflow.com/a/39236139.

I just don't want that the app creates so many skipped queues, if it creates just one skipped queue then I can still live with it but there are so many because there is an identifier in the queuename...: See here

Ozkan
  • 3,880
  • 9
  • 47
  • 78

1 Answers1

1

It is a default middleware so at this moment there is no way to turn it off. However, you can create an empty consumer for JObject and it will consume all messages, which mean no matter what message you receive, there will be at least one consumer. Then dead letter queue middleware will not be engaged.

Alexey Zimarev
  • 17,944
  • 2
  • 55
  • 83
  • Question about the JObject Consumer. Can it interfere with the consumers that I have? What is the priority on these consumers? I have Consumers listening for specific message classes/interfaces. Is there a chance that the JObject Consumer consumes my custom message? – Ozkan Sep 15 '17 at 12:52
  • 1
    It will consume all messages but if you have multiple consumers for certain message type (type hierarchy if using polymorphic dispatch) - they all should get a copy. – Alexey Zimarev Sep 16 '17 at 18:51