ActiveMQ NMS - Queue And Topic

Storage in Queue & Topic

 

Messages for Queues and Topics are stored slightly differently, and match delivery semantics for the point-to-point and publish/subscribe message domains. Storage of Queues are straightforward, they are basically stored in first in, first out order (FIFO) - see Figure 4.1, with only one message being dispatched between one of potentially many consumers. When that message has been consumed, it can be deleted from the store.

 

For durable subscribers on a Topic, each consumer gets a copy of the message - but in order to save space (some messages can be very large!) messages are in fact only stored once. A durable subscriber object in the store maintains a pointer to its next stored message - and dispatches a copy of it to its consumer - as shown in Figure 4.2. A message store is implemented in this way for durable subscribers because durable subscribers will be consuming messages at different rates; and may not be active at the same time. In addition, as every message can potentially have many consumers, a message cannot be deleted from the store until it has been delivered to every interested consumer.

 

NMS Code in Queue & Topic

 

- Topic or Queue Publisher

 

- Topic or Queue Subscriber

 

Result:

 

Queue:

 

 

Topic:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值