ActiveMQ 单消费者多生产者
任何人都可以指出如何实施的参考 activemq 中的单个消费者多个生产者?或者可以给出一个非常简单的实现。 这将非常有帮助。
谢谢
Can anybody point out a reference on how to implement
a single consumer multiple producer in activemq? Or could give a very simple implementation.
This will be very helpful.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Matt Raible 的 AppFuse 项目是一个很好的骨架项目,它是使用不同的库实现的。您可以选择使用 Spring 的一个并引入 ActiveMQ,正如 Bharati Raja 在他的博客文章 jms 中所解释的那样与appfuse1x。
Matt Raible's AppFuse project is a good skeleton project which is implemented using different libraries. You can pick the one which uses Spring and introduce ActiveMQ as Bharati Raja has explained in his blog post jms with appfuse1x.
为此不需要特殊的实现。这是MessageBrokers的核心业务。您唯一需要确保的是:
如果您决定为生产者提供 ID,请确保它们彼此不同。您不能拥有多个具有相同 ID 的生产者。对于消费者来说也是如此。
There is no special implementation required for this. This is the core business of MessageBrokers. The only thing you need to make sure of:
If you decide to give an ID to your producers, make sure they are different from each other.. You cannot have multiple producers with the same ID. Same goes for consumers.
如果您需要保证一条消息只能被一个消费者使用,那么这是 点对点通信模型,可以使用ActiveMQ中的JMS队列来实现。
许多生产者可以将消息发送到同一个队列。只有一个活跃的消费者将从队列中接收消息。
If you need to guarantee that a message can be consumed by only one consumer, then this is the point-to-point communication model which can be implemented using a JMS Queue in ActiveMQ.
Many producers can send messages to the same queue. Only one active consumer will receive a message from the queue.