RabbitMQ plugin to remove duplicate messages

后端 未结 3 1043
情书的邮戳
情书的邮戳 2021-02-06 10:53

I have a RabbitMQ queues for documents generation. Basically, each document has type and state (new, processing, ready), so I use topic exchange with r

3条回答
  •  迷失自我
    2021-02-06 11:46

    Ok, i've read about RabbitMQ inner architecture and find out it's impossible. So the way around for somebody looking for it.

    1. Send only document ID in message body
    2. Create a key-value store for worker (i use memcached for this). Key is ID value is timestamp of last worker run for this ID.
    3. When worker receives the message it checks if message timestamp greater then the one from key-value store. If it is, then update timestamp in the store and run the task, otherwise just skip it.

提交回复
热议问题