互斥量是rabbitmq
RabbitMQ 队列中是否可以有互斥体,即如果客户端正在从队列中读取,则其他客户端不应从队列中读取。这可能吗?
让我解释一下我的场景:
两个应用程序在两个不同的服务器上运行。读取同一个队列。但是,如果一个应用程序正在运行并从队列中读取消息,则另一个应用程序不应执行任何操作。如果主应用程序失败或停止,则其他应用程序应该 开始从此队列中读取。
这是一种故障转移机制。以前有人尝试过这个吗?非常感谢任何帮助。
Is that possible to have mutex in RabbitMQ queue, i.e. If a client is reading from the queue, no other client should read from the queue. is that possible?
Let me explain my scenario:
Two application running in two different servers. reading the same queue. But, if one application is running and reading the messages from the Queue, the other application should not do anything. if the Main application fails or stopped, then the other application should
start reading from this queue.
This is kind of a fail over mechanism. Have anyone tried this before. Any help is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要我搜索过,就找不到解决方案......一个简单的解决方案是
队列中的互斥体,就是这样。
注意:只有当锁定队列中只有消息时,此方法才有效。确保在您的应用程序中处理它。
As long as i have searched, no solutions found...A simple solution is
A Mutex in Queue, that's it.
Note: This approach will work only if there is only message in the lock queue. make sure you handle it in your application.
此演讲明确解释了为什么这是一个坏主意:
http:// www.youtube.com/watch?v=XiXZOF6dZuE&feature=share&t=29m55s
从 ~ 29m 55秒内
This talk explicitly explains why this is a bad idea:
http://www.youtube.com/watch?v=XiXZOF6dZuE&feature=share&t=29m55s
from ~ 29m 55s in