[rabbitmq-discuss] Best practices about expiration of messages

Marek Majkowski majek04 at gmail.com
Tue Sep 6 13:52:31 BST 2011


On Tue, Sep 6, 2011 at 13:42, PADIOU Pierre-Marie (MORPHO)
<pierre-marie.padiou at morpho.com> wrote:
> Here is the thing :
>
> - I’ve got a producer P and a consumer C.
>
> - Pattern is request-response.
>
>
>
> P constantly submit requests to consumers and wait for an answer for a given
> amount of time. Should C take longer to answer, P will consider there was a
> time-out and it just sends message N+1, discarding any answer related to N.
>
> Thing is, if nothing is done, C will still process all messages it receives
> (and send response that will be discarded). This makes C accumulate messages
> in case they take an unusually long time to process.

Have you seen RabbitMQ extension - per queue message TTL?
    http://www.rabbitmq.com/extensions.html#queue-ttl
"... controls for how long a message published to a queue can live
before it is discarded."

> I suppose this is a common problem. I was wondering if anyone had a best
> practice for this. Here are the ideas I got :
>
> - P creates a different response queue for each message, C checks whether
> the response queue exists before processing a message

Slow.

> - Assuming P and C are time synchronized, P sends an expiration date along
> with each message, that C will check before doing anything

Sounds sanely. You should have clocks reasonably synchronized anyway.


Cheers,
  Marek


More information about the rabbitmq-discuss mailing list