什么开源消息队列软件可以提供严格排序的耐用性?
我们需要的是实际上作为队列工作的 RabbitMQ 并且不这样做 。消息应该保留在队列的头部,直到客户端明确地将它们出队。
这似乎是一个非常简单的场景,但由于某种原因我找不到任何代理来支持它。代理应该在 Windows 操作系统上运行。
What we need is RabbitMQ that actually works as a queue and doesn't do this. Messages should stay at the head of a queue untill client dequeues them explicitly.
It seems like a very straightforward scenario, but for some reason I can't find any broker to support it.. A broker should run on Windows OS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Apache Qpid 可能是您的最佳选择。在所有消息队列中,这个消息队列有很多有趣的地方,包括 严格排序。
Apache Qpid is probably your best option. Of all of the message queues, this one has a number of interesting things going for it, including strict ordering.
如果只有一条消息有问题,为什么不在处理该消息之前将其写入文件(并刷新文件)。确认消息后,删除文件。
如果您担心消息代理崩溃,第一步是将其升级到在 Erlang R14B02 上运行的 RabbitMQ 2.4.1。第二步是将其集群化,以便有多个服务器充当 MQ 代理。然后,更改您的应用程序以通过时间戳或保存消息 ID 来跟踪已处理的消息。然后,如果 RabbitMQ 重新排队一条消息,您将已经拥有该消息并将对其进行处理并记住它。当它第二次出现时,你就会忽略它。
您可能需要将预取设置为 0 才能正常工作。
还有另一种选择。您可以考虑编写自己的 RabbitMQ 插件来提供您需要的确切行为。 Erlang 乍一看可能很复杂,但对于已经学习了几种语言的经验丰富的程序员来说,学习它实际上并不难。特别是,如果您有任何具有 Haskell 或 CAML 等语言的函数式编程经验的人,他们将很快掌握足够的 Erlang 来完成这项工作。
由于 Erlang 的消息传递过程的内部模型,RabbitMQ 插件本质上可以做任何他们想做的事情。他们不需要遵守特定的有限插件 API。
换句话说,如果 RabbitMQ 只完成了您需要的 99%,那么您很幸运,只需少量工作,您就可以利用这 99% 并实现您需要的一切。但为了做到这一点,您必须摆脱 RabbitMQ 是您使用系统的软件包安装工具安装的另一个软件包的想法。在像您这样的情况下,RabbitMQ 应该被视为一个关键任务工具,您应该从源代码安装 Erlang 和 RabbitMQ,并根据您的需求配置它们,而不让您的操作系统限制您。
If it is only one message that is the problem, why not write it to a file (and flush the file) before you process the message. After acking the message, delete the file.
And if you are concerned about the message broker crashing, first step is to upgrade it to RabbitMQ 2.4.1 running on Erlang R14B02. Second step is to cluster it so that you have multiple servers acting as the MQ broker. And only then, change your app to track the messages that have been processed, either by timestamp or by saving message IDs. Then, if RabbitMQ requeues a message, you will already have it and will process it and remember it. When it comes around a second time you will ignore it.
You may need to set prefetch to 0 for this to work right.
And there is another alternative too. You could consider writing your own RabbitMQ plugin to provide the exact behaviour that you need. Erlang may look complex at first sight, but it really isn't that hard to learn for an experienced programmer who has already learned a few languages. In particular, if you have anyone with functional programming experience in languages like Haskell or CAML, they will quickly pick up enough Erlang to do the job.
Because of Erlang's internal model of message-passing processes, RabbitMQ plugins can essentially do anything that they want. There is no specific limited plugin API that they need to conform to.
In other words, if RabbitMQ only does 99% of what you need, consider yourself lucky that with a small amount of work, you can leverage that 99% and achieve everything that you need. But in order to do this you have to get away from the idea that RabbitMQ is yet another package that you install with your system's package installation tools. In cases like yours RabbitMQ should be considered to be a mission critical tool, and you should install Erlang and RabbitMQ from source, and configure them to your needs without letting your OS limit you.
RabbitMQ 还支持自版本 2.7.0 起严格排序,因此应该是您的一个选项场景再次出现。
RabbitMQ also supports strict ordering as of release 2.7.0 and so should be an option for your scenario again.