Author |
Message
|
bcostacurta |
Posted: Tue Nov 06, 2012 6:19 am Post subject: Publish / subscribe versus point-to-point : same MQ PUT ? |
|
|
Acolyte
Joined: 10 Dec 2009 Posts: 71 Location: Luxembourg
|
Hello to All,
does a pub /sub implementation request a specific PUT on the sender side ?
In other words is it possible to implement a pub / sub on an existing feed without requesting any modification from the sending application (so just transforming the point-to-point destination queue to a pub / sub queue) ?
Thanks for attention.
Bruno |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 06, 2012 6:27 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It's not called "a pub/sub queue".
It's called a "topic".
And, yes, as of MQ v7 or later, you can administratively delete a queue and create a topic of the same name and then administratively create subscriptions, or allow applications to programatticaly create subscriptions without requiring the sender to change at all. |
|
Back to top |
|
 |
bcostacurta |
Posted: Tue Nov 06, 2012 7:01 am Post subject: |
|
|
Acolyte
Joined: 10 Dec 2009 Posts: 71 Location: Luxembourg
|
Many thanks for precision and reply.
Bruno |
|
Back to top |
|
 |
zpat |
Posted: Tue Nov 06, 2012 7:16 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
It is a queue. It is a topic alias queue.
So yes you can simply change the queue used, to a topic alias queue. Then define durable subscriptions.
I have posted detailed examples of this on the forum, when people asked how to duplicate messages, if you search around you should find them. |
|
Back to top |
|
 |
bcostacurta |
Posted: Tue Nov 27, 2012 2:24 am Post subject: |
|
|
Acolyte
Joined: 10 Dec 2009 Posts: 71 Location: Luxembourg
|
Thanks Jedi Knight.
I searched for the samples (about message duplication via pub/sub) your mentioned but cannot find as there is many posts.
Could you please point me to them ?
Thanks for attention and help.
Bruno |
|
Back to top |
|
 |
zpat |
Posted: Tue Nov 27, 2012 5:09 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
IT is all about using search engines these days! I use the site search (and not google) which you can limit the search to posts from a given user.
Anyway the pertinent information is this
Quote: |
Ensure the PSMODE enabled (only need do this once).
ALTER QMGR PSMODE(ENABLED)
Define topic object with fixed topic string (of your choice)
DEFINE TOPIC(TEST.DUP) TOPICSTR('/MQ/DUPLICATE/TEST1') DURSUB(YES) REPLACE
Define topic alias queue using topic object
DEFINE QALIAS(TEST.ALIAS) DEFPSIST(YES) TARGTYPE(TOPIC) TARGET(TEST.DUP) REPLACE
Define local queues to receive the messages (they could also be remote queues as needed)
DEFINE QLOCAL(TEST.QUEUE1) DEFPSIST(YES) REPLACE
DEFINE QLOCAL(TEST.QUEUE2) DEFPSIST(YES) REPLACE
Define admin durable subscriptions
DELETE SUB(TEST.SUB1)
DEFINE SUB(TEST.SUB1) DEST(TEST.QUEUE1) TOPICOBJ(TEST.DUP) PSPROP(NONE)
DELETE SUB(TEST.SUB2)
DEFINE SUB(TEST.SUB2) DEST(TEST.QUEUE2) TOPICOBJ(TEST.DUP) PSPROP(NONE)
Now - just put a message to TEST.ALIAS and it should appear on both local queues. |
|
|
Back to top |
|
 |
boos |
Posted: Mon Mar 09, 2015 2:26 am Post subject: |
|
|
 Apprentice
Joined: 27 Jan 2004 Posts: 37 Location: Netherlands
|
This is briliant.
I have (based on this example of an Alias queue redirecting to a topic) made a setup of performance tests for topics. Without changing my performance testing application (which could put MQ messages but not publish).
And indeed it's a very easy way to get duplications of messages just by changing the configuration of the queues (we always use alias queues for application to PUT or GET).
Thanks for sharing this simple solution.  |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Mar 09, 2015 3:44 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Just be aware these are not perfect copies. While the payload of the message data will be exactly the same, some fields in the MQMD Header will be different - Message ID for sure. Maybe the Put Time. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
|