Arman
Arman

Reputation: 1059

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.

Upvotes: 5

Views: 1792

Answers (2)

Phil Shotton
Phil Shotton

Reputation: 11

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.

Upvotes: 0

T.Rob
T.Rob

Reputation: 31852

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.

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.

Upvotes: 3

Related Questions