TTL(time to live) on message/queue


(rvesyliv) #1

Hi All,

I use NSB + RabbitMq as transport and need to set TTL from C# code on queue level

To set TimeToBeRecieved I use the following code snippet

var conventions = endpointConfiguration.Conventions();

Is it possible to set TTL in the same way ?

Thanks, Ruslan

(Ramon Smits) #2

Are you referring to the queue TTL as documented on the following location?

We do not have an API to configure RabbitMQ specific queue settings. I would recommend to script these or to use the RabbitMQ code API as is also demonstrated at the previous link.

(Brandon Ording) #3

As @ramonsmits has mentioned, we don’t directly expose a way to set per-queue message TTL values at queue declaration time. If this is something you need, I recommend using a RabbitMQ policy on the broker to add that value.

We do set per-message TTL values on messages when you use our TimeToBeReceived feature.

If you do decide to use a policy to set a per-queue message TTL via a policy, be sure to scope the policy so that it only applies to the specific queues you need it for. As part of our delayed delivery feature, we create queues with specific per-queue message TTL values, and altering those would prevent delayed messages from working correctly.