AMQP 中每个队列的唯一消息?
这与 另一个问题类似,但有一点不同:我在规范中读到AMQP消息的message-id应该由应用程序本身设置,所以理论上我可以用它来保证一定程度的唯一性,对吧?
现在我的主要问题是:在什么范围内该消息 ID 保证是唯一的?对于当前在特定队列中排队的消息?超过所有队列?宇宙之上? :-)
这种行为标准化了吗?我计划在这里使用 RabbitMQ,但最好有一些非供应商特定的东西:-)
谢谢。
This is similar to this other question but with a bit of a twist: I read in the specification that the message-id for AMQP messages should be set by the application itself, so in theory I could use that to guarantee a certain degree of uniqueness, right?
My main question is now: In what scope is that message-id garantueed to be unique? For the messages currently enqueued inside a specific queue? Over all queues? Over the universe? :-)
And is this behaviour standardized? I plan to use RabbitMQ here, but it would be nice to have something not vendor specifc :-)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一个建议是根据转储管道 - 智能端点学校的思想。
您可以使用某种共享状态来处理应用程序中的唯一性。
从 Gearman 切换到 RabbitMQ 时,我们遇到了同样的问题。我们使用 memcached 来跟踪发布的唯一消息 ID,以及消费者删除消息 ID 已存储在 memcache 中的消息(重复项)。您还可以在将内存缓存完全放入队列之前检查它。
这使您无需在消息总线层中使用此功能(因此您可以更轻松地在代理之间进行切换,也可以在那些不保证唯一性的代理之间进行切换)
Another suggestion is according to the dump pipes - smart endpoints school of thought.
You could handle uniqueness in your application, using some sort of shared state.
We had the same problem when switching from Gearman to RabbitMQ. We use memcached to keep track of unique message ID's posted and consumers drop messages for which the message ID is already stored in memcache (duplicates). You could also check memcache before putting it on the queue altogether.
This frees you from using this feature in your message bus layer (so you can more easily switch between brokers, also those who do not guarantee uniqueness)
消息 ID 仅特定于应用程序,可能根本不唯一。你必须自己照顾独特性。
Message Id is application-specific only and may be not unique at all. You have to take care of uniqueness by yourself.