0
点赞
收藏
分享

微信扫一扫

JMS中queue和topic区别


JMS中queue和topic区别

2008-07-08 13:16

What is the difference between queue and topic?

A connection is created between the client and the server from a connection factory. Connections can be shared by several threads. The user credentials are supplied at this level. It is probably common for a client application to share access to a single connection to the server (unless different security credentials are required for different destinations).
A session is created from a connection. The session may only be used by one thread at one time. The user credentials are inherited from the parent connection. It is probably common for each MessageProducer (TopicPublisher or QueueSender) or MessageConsumer (TopicSubscriber or QueueReceiver) to have their own session due to the threading restriction.
You can look at it like a tree. At the top you have a connection factory, beneath this you have your connections and then beneath the connections you have sessions. The leaves of the tree are the JMS actors (MessageProducers and MessageConsumers).

References: Creating Robust JMS Applications : http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMS6.html

两种JMS的实现方法:
Topic==>消息主题 是发布/订阅 机制 一个消息产生多个对应 1:N
Queue==>消息队列 是点到点 一个消息产生一个对应 1:1  

g

举报

相关推荐

0 条评论