JMS 主题与队列

标签 jms activemq

我想知道 JMS 队列和 JMS 主题之间有什么区别。

ActiveMQ page

Topics

In JMS a Topic implements publish and subscribe semantics. When you publish a message it goes to all the subscribers who are interested - so zero to many subscribers will receive a copy of the message. Only subscribers who had an active subscription at the time the broker receives the message will get a copy of the message.

Queues

A JMS Queue implements load balancer semantics. A single message will be received by exactly one consumer. If there are no consumers available at the time the message is sent it will be kept until a consumer is available that can process the message. If a consumer receives a message and does not acknowledge it before closing then the message will be redelivered to another consumer. A queue can have many consumers with messages load balanced across the available consumers.

我想要“某种东西”,它将按照与 ActiveMQ 代理接收消息的顺序相同的顺序向每个订阅者发送消息的副本。

有什么想法吗?

最佳答案

这意味着主题是合适的。队列意味着一条消息发送给一个且仅一个可能的订阅者。每个订阅者都有一个主题。

关于JMS 主题与队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5576415/

相关文章:

java - Oracle glassfish4.1 jms数据库存储

Java EE 下载链接

java - JBoss EAP6 与外部 HornetQ 实现的连接不起作用,但在 JBoss 7.1.1 中却可以

java - JMS 队列 - 发送和接收对象消息之间有 10 秒的暂停

java - 在 ActiveMQ 消息传递中订阅多个主题目标

spring - 如何使用 Spring 嵌入的 ActiveMQ 代理指定自定义的 activemq.xml?

java - Spring引导自动配置AutoConfigureAfter

java - jms 错误处理程序 : receive a callback only when jms gives up

java - Spring启动Activemq传输连接失败: java. io.EOFException

java - 使用 jdbcPersistenceAdapter 重新启动嵌入式 activeMQ 代理时出现异常