Skip to main content

expiration_ms

Function expiration_ms 

Source
pub fn expiration_ms(delay: Duration) -> String
Expand description

The AMQP expiration string for delay: whole milliseconds, rounded up and clamped to [1, MAX_TTL_MS].

The lower bound exists because RabbitMQ treats an expiration of 0 as “expire immediately unless a consumer is waiting”, which would defeat a backoff delay.

The upper bound exists because RabbitMQ parses expiration as a 32-bit millisecond count and answers anything larger with PRECONDITION_FAILED, killing the channel. MAX_TTL_MS is roughly 49 days, far beyond any sensible retry backoff, so clamping is strictly better than failing.