Mass Transit - Are messages still delivered after timeout with RabbitMQ

711 views Asked by At

This may be a very stupid question but I haven't been able to find a definitive answer online. I'm using the Masstransit Request/Response pattern with RabbitMQ as my message broker.

I have a request to add a user to a database and a consumer running in a separate service that consumes that request and sends a response.

The request has a ten second timeout. My question is: If that request timed out before the consumer was able to consume it, is the request removed or will it eventually get consumed by the consumer and the request client just times out and moves on?

1

There are 1 answers

2
Chris Patterson On BEST ANSWER

The request client is for requests, which by default have a 30 second timeout (which you indicated you are changing to ten seconds). This setting applies to both the request client timeout (the point at which it stops waiting for a response) and the time-to-live of the message sent.

If you want to extend the message TimeToLive, you can change that value when sending the request using:

await client.GetResponse<T>(request, x =>
    x.Execute(context => context.TimeToLive = TimeSpan.FromDays(10)));

TL;DR - yes, the request message will expire after 10 seconds and by automatically removed from the queue by the message broker.