好,我已经阅读了RabbitMQ内部架构,并发现这是不可能的.所以有人寻找它的方法.
Ok, i've read about RabbitMQ inner architecture and find out it's impossible. So the way around for somebody looking for it.
- 仅在邮件正文中发送文档
ID
- 为工作者创建键值存储(为此,我使用memcached).关键是
ID
值是为此ID
运行的上一个工作程序的时间戳.
- 当worker收到消息时,它将检查消息时间戳是否大于键值存储中的消息时间戳.如果是这样,则更新存储中的时间戳并运行任务,否则就跳过它.
- Send only document
ID
in message body
- 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
.
- 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.