简体   繁体   English

IBM MQ发布/订阅向一个订阅者发送消息

[英]IBM MQ publish/subscribe send message to one subscriber

I want to build a publish/subscribe program to compute matrix manipulation on a cluster. 我想构建一个发布/订阅程序来计算集群上的矩阵操作。

When a publisher send a message to a topic, message copies to all subscribers. 当发布者向主题发送消息时,消息将复制到所有订阅者。

I want a copy of message send to one subscriber and the message deletes and not send to other subscribers. 我想要一个消息副本发送给一个订阅者,该消息删除,而不是发送给其他订阅者。

There are two ways to do this. 有两种方法可以做到这一点。

  1. Make an administrative subscription and have all subscribers read messages off the queue to which the subscription points. 进行管理订阅并让所有订阅者从订阅指向的队列中读取消息。
  2. Use MQ V8.0, the new JMS 2.0 interface, and the Shared Subscription feature. 使用MQ V8.0,新的JMS 2.0接口和共享订阅功能。

Note that in both of these cases, all subscribers are connected to the same queue manager. 请注意,在这两种情况下,所有订户都连接到同一个队列管理器。 Although Pub/Sub creates a single logical message, when it is broadcast to other queue managers it becomes multiple physical messages and their consumption by subscribers is not coordinated across the network. 尽管Pub / Sub创建单个逻辑消息,但当它被广播到其他队列管理器时,它变成多个物理消息,并且订阅者的消费不会在整个网络中协调。

Use a queue, not a topic. 使用队列,而不是主题。 Topics are designed for one-to-many publication, queues allow multiple listeners but each message is delivered to only one listener. 主题是针对一对多发布而设计的,队列允许多个侦听器,但每条消息只传递给一个侦听器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM