|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to specify retained publications when putting to queue? |
« View previous topic :: View next topic » |
Author |
Message
|
awesomo |
Posted: Tue Jan 19, 2010 11:17 pm Post subject: How to specify retained publications when putting to queue? |
|
|
Newbie
Joined: 19 Jan 2010 Posts: 5
|
Hi,
I'm currently testing WMQ 7.0.1.0 Publish Subscribe capabilities on a 32bit Linux box.
I have set up two queue managers, QM1 and QM2 on the same machine.
QM1 contains an admin-defined "topicA" object. I have also defined a queue alias (QA.topicA) with the Base Object: topicA and Base type: Topic. Putting messages to QA.topicA successfully publishes messages to topicA (amqssub is able to pick these messages up).
On QM2, I have defined a remote queue, QR.QM2 that points to QA.topicA on QM1. Again, I am able to write to this remote queue and have the messages successfully sent to subscribers of topicA.
My question is, am I able to publish RETAINED messages to QR.QM2? I have tried the following which, as I have expected, returns mqrc 2046 MQRC_OPTIONS_ERROR:
Code: |
MQQueueManager queueManager = new MQQueueManager("QM2", properties);
MQMessage messageForPut = new MQMessage();
messageForPut.writeString("hello!");
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = CMQC.MQPMO_FAIL_IF_QUIESCING | CMQC.MQPMO_RETAIN | CMQC.MQPMO_NO_SYNCPOINT;
queueManager.put(CMQC.MQOT_Q, "QR.QM2", messageForPut, pmo);
|
The culprit is MQPMO_RETAIN. Is there an equivalent I can use when I want to write retained publications to a queue? Or is there a queue, QA, topic setting somewhere that I've missed out?
Any help would be great - I am really new to Pub/Sub. Thanks! |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jan 20, 2010 11:25 am Post subject: Re: How to specify retained publications when putting to que |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
awesomo wrote: |
Any help would be great - I am really new to Pub/Sub. Thanks! |
Have you read the Pub/Sub manual through and through straight and crosswise?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mvic |
Posted: Wed Jan 20, 2010 12:39 pm Post subject: Re: How to specify retained publications when putting to que |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
awesomo wrote: |
My question is, am I able to publish RETAINED messages to QR.QM2? I have tried the following which, as I have expected, returns mqrc 2046 MQRC_OPTIONS_ERROR |
Messaging with MQ divides into two "domains". These are typically called "point to point" and "publish subscribe" (or pub/sub).
For point to point messaging you use queues. For publish subscribe you use topics.
The data flow for queues is one-to-one. A message from one application (the putter) reaches one application (the getter). By contrast, for pub/sub it is one-to-many. A publication from one application (the publisher) can reach large numbers of applications (the subscribers)
The two domains do not mix, conceptually.
(Internally, MQ does use queues for publish subscribe. But that is an internal implementation detail, and may not continue always to be the case.)
The thing you need to know here is that, having opened an object of type MQOT_Q (that is, a queue not a topic), you are not then allowed to put to that object using the put option MQPMO_RETAIN.
MQPMO_RETAIN is an option belonging to the pub/sub domain.
If you do really need to use retained publications, then you need to open a topic not a queue. |
|
Back to top |
|
 |
zonko |
Posted: Wed Jan 20, 2010 10:30 pm Post subject: |
|
|
Voyager
Joined: 04 Nov 2009 Posts: 78
|
To expand on what mvic said, there is no such object as a remote topic analogous to a remote queue. To put to a topic such that subscribers on another machine can get the publications, the qmgrs must be members of a cluster, and the topic must be shared in the cluster. |
|
Back to top |
|
 |
awesomo |
Posted: Thu Jan 21, 2010 3:31 am Post subject: Re: How to specify retained publications when putting to que |
|
|
Newbie
Joined: 19 Jan 2010 Posts: 5
|
mvic wrote: |
The two domains do not mix, conceptually.
The thing you need to know here is that, having opened an object of type MQOT_Q (that is, a queue not a topic), you are not then allowed to put to that object using the put option MQPMO_RETAIN.
MQPMO_RETAIN is an option belonging to the pub/sub domain.
If you do really need to use retained publications, then you need to open a topic not a queue. |
Thanks. I do understand and agree that both point-to-point and pub/sub belong in separate domains.
However, the WMQ7 extension that allows alias queues to be mapped to topic objects gives me the impression that it functions as a bridge between both domains. And hence, wondered whether specific attributes, such as retained publications, could be common or have an equivalent in both domains.
zonko wrote: |
To put to a topic such that subscribers on another machine can get the publications, the qmgrs must be members of a cluster, and the topic must be shared in the cluster. |
Agreed. Or a queue manager hierarchy.
fjb_saper wrote: |
Have you read the Pub/Sub manual through and through straight and crosswise? |
Yes! Many times over.  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|