Discussion:
Using QALIAS to distribute the same message to multiple queues (A solution)
Coombs, Lawrence
2013-10-04 03:43:55 UTC
Permalink
Thanks to Michael Dag for figuring this out, it now works!!!!

Here are the definitions.

There are three queue managers, QM1 (sender), QM2 (receiver-1) and QM3(receiver2).
Define on QM1 (The sending queue manager):


* Define an alias queue of type TOPIC
def qalias('NQSX.IAS.INVENTORY.QA99') +
TARGET('NQSXRTIINVY') +
DEFBIND(NOTFIXED) +
TARGTYPE(TOPIC) replace


* Define a TOPIC where the topic string matches the TARGET attribute in the QALIAS above
def TOPIC('NQSXRTIINVY') +
TOPICSTR('NQSXRTIINVY') replace


* Define a subscription for the Topic String above
def sub(NQSXRTIINV8) TOPICSTR('NQSXRTIINVY') +
DEST('NQSX.IAS.INVENTORY.QA98') replace **** Note: This is a cluster alias that is defined on BOTH QM2 and QM2 ******

Define on QM2 (Receiver-1 queue manager):


* Define cluster alias
def qalias('NQSX.IAS.INVENTORY.QA98') +
TARGET('NQSXRTIINVZ') +
DEFBIND(NOTFIXED) +
CLUSTER('MDS0TCL3') +
TARGTYPE(TOPIC) replace


* Define a TOPIC (LOCAL)
def topic('NQSXRTIINVZ') +
TOPICSTR('NQSXRTIINVZ') replace


* Define two subscriptions to the above TOPIC (one for each LOCAL queue)
def sub(sub1) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL01') replace

def sub(sub2) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL02') replace


* Define the two LOCAL queues
def ql('NQSX.IAS.INVENTORY.QL01') replace
def ql('NQSX.IAS.INVENTORY.QL02') replace

Define on QM3(Receiver-2 queue manager):


* Define cluster alias
def qalias('NQSX.IAS.INVENTORY.QA98') +
TARGET('NQSXRTIINVZ') +
DEFBIND(NOTFIXED) +
CLUSTER('MDS0TCL3') +
TARGTYPE(TOPIC) replace


* Define a TOPIC (LOCAL)
def topic('NQSXRTIINVZ') +
TOPICSTR('NQSXRTIINVZ') replace


* Define two subscriptions to the above TOPIC (one for each LOCAL queue)
def sub(sub1) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL01') replace

def sub(sub2) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL02') replace


* Define the two LOCAL queues
def ql('NQSX.IAS.INVENTORY.QL01') replace
def ql('NQSX.IAS.INVENTORY.QL02') replace

============================================================================================================================================
Notes:

CURDEPTH on QM2 AFTER putting 13 messages twice to the alias:
Starting MQSC for queue manager SQAT0261.


dis ql(nqsx.ias.*) curdepth
1 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(0)

dis ql(nqsx.ias.*) curdepth
2 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(7)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(7)

dis ql(nqsx.ias.*) curdepth
3 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(13)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(13)


CURDEPTH on QM3 AFTER putting 13 messages twice to the alias:

Starting MQSC for queue manager SQAT0264.


dis ql(nqsx.ias.*) curdepth
1 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(0)

dis ql(nqsx.ias.*) curdepth
2 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(6)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(6)

dis ql(nqsx.ias.*) curdepth
3 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(13)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(13)
==========================================================================================================
This is the amqsput:

./amqsput NQSX.IAS.INVENTORY.QA99 SQAT0001
Sample AMQSPUT0 start
target queue is NQSX.IAS.INVENTORY.QA99
1
2
3
4
5
6
7
8
9
10
11
12
13

Sample AMQSPUT0 end

$ ./amqsput NQSX.IAS.INVENTORY.QA99 SQAT0001
Sample AMQSPUT0 start
target queue is NQSX.IAS.INVENTORY.QA99
1
2
3
4
5
6
7
8
9
10
11
12
13

Sample AMQSPUT0 end

This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.

To unsubscribe, write to LISTSERV-0lvw86wZMd9k/bWDasg6f+***@public.gmane.org and,
in the message body (not the subject), write: SIGNOFF MQSERIES
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://listserv.meduniwien.ac.at/archives/mqser-l.html
Potkay, Peter M (CTO Architecture + Engineering)
2013-10-04 11:11:58 UTC
Permalink
A side benefit to the way you have it now over what you had before is you cut your MQ traffic between QMs in half, since the destination QM is doing the duplication. Kewl!

You've also avoided clustering any topics, so technically you don't have a Pub Sub cluster and that's not necessarily a bad thing. Check out the Pub/Sub section of the Clustering Presentation from the 2013 MQ Tech Conference. There are some good pages on why you need to be careful clustering topics, as it causes every QM to start talking to every other QM in the cluster. The PSCLUS QM Property as of MQ 7.1 can offer protection in this regard if want to avoid clustered topics and you can get what you need the way you defined things below.

Thanks for sharing the details on how you got it to work, and thanks Michael for the original suggestion.



Peter Potkay


From: MQSeries List [mailto:MQSERIES-0lvw86wZMd9k/bWDasg6f+***@public.gmane.org] On Behalf Of Coombs, Lawrence
Sent: Thursday, October 03, 2013 11:44 PM
To: MQSERIES-0lvw86wZMd9k/bWDasg6f+***@public.gmane.org
Subject: Re: Using QALIAS to distribute the same message to multiple queues (A solution)

Thanks to Michael Dag for figuring this out, it now works!!!!

Here are the definitions.

There are three queue managers, QM1 (sender), QM2 (receiver-1) and QM3(receiver2).

Define on QM1 (The sending queue manager):


* Define an alias queue of type TOPIC
def qalias('NQSX.IAS.INVENTORY.QA99') +
TARGET('NQSXRTIINVY') +
DEFBIND(NOTFIXED) +
TARGTYPE(TOPIC) replace


* Define a TOPIC where the topic string matches the TARGET attribute in the QALIAS above
def TOPIC('NQSXRTIINVY') +
TOPICSTR('NQSXRTIINVY') replace


* Define a subscription for the Topic String above
def sub(NQSXRTIINV8) TOPICSTR('NQSXRTIINVY') +
DEST('NQSX.IAS.INVENTORY.QA98') replace **** Note: This is a cluster alias that is defined on BOTH QM2 and QM2 ******

Define on QM2 (Receiver-1 queue manager):


* Define cluster alias
def qalias('NQSX.IAS.INVENTORY.QA98') +
TARGET('NQSXRTIINVZ') +
DEFBIND(NOTFIXED) +
CLUSTER('MDS0TCL3') +
TARGTYPE(TOPIC) replace


* Define a TOPIC (LOCAL)
def topic('NQSXRTIINVZ') +
TOPICSTR('NQSXRTIINVZ') replace


* Define two subscriptions to the above TOPIC (one for each LOCAL queue)
def sub(sub1) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL01') replace

def sub(sub2) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL02') replace


* Define the two LOCAL queues
def ql('NQSX.IAS.INVENTORY.QL01') replace
def ql('NQSX.IAS.INVENTORY.QL02') replace

Define on QM3(Receiver-2 queue manager):


* Define cluster alias
def qalias('NQSX.IAS.INVENTORY.QA98') +
TARGET('NQSXRTIINVZ') +
DEFBIND(NOTFIXED) +
CLUSTER('MDS0TCL3') +
TARGTYPE(TOPIC) replace


* Define a TOPIC (LOCAL)
def topic('NQSXRTIINVZ') +
TOPICSTR('NQSXRTIINVZ') replace


* Define two subscriptions to the above TOPIC (one for each LOCAL queue)
def sub(sub1) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL01') replace

def sub(sub2) TOPICSTR('NQSXRTIINVZ') +
DEST('NQSX.IAS.INVENTORY.QL02') replace


* Define the two LOCAL queues
def ql('NQSX.IAS.INVENTORY.QL01') replace
def ql('NQSX.IAS.INVENTORY.QL02') replace

============================================================================================================================================
Notes:

CURDEPTH on QM2 AFTER putting 13 messages twice to the alias:
Starting MQSC for queue manager SQAT0261.


dis ql(nqsx.ias.*) curdepth
1 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(0)

dis ql(nqsx.ias.*) curdepth
2 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(7)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(7)

dis ql(nqsx.ias.*) curdepth
3 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(13)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(13)


CURDEPTH on QM3 AFTER putting 13 messages twice to the alias:

Starting MQSC for queue manager SQAT0264.


dis ql(nqsx.ias.*) curdepth
1 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(0)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(0)

dis ql(nqsx.ias.*) curdepth
2 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(6)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(6)

dis ql(nqsx.ias.*) curdepth
3 : dis ql(nqsx.ias.*) curdepth
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL01) TYPE(QLOCAL)
CURDEPTH(13)
AMQ8409: Display Queue details.
QUEUE(NQSX.IAS.INVENTORY.QL02) TYPE(QLOCAL)
CURDEPTH(13)
==========================================================================================================
This is the amqsput:

./amqsput NQSX.IAS.INVENTORY.QA99 SQAT0001
Sample AMQSPUT0 start
target queue is NQSX.IAS.INVENTORY.QA99
1
2
3
4
5
6
7
8
9
10
11
12
13

Sample AMQSPUT0 end

$ ./amqsput NQSX.IAS.INVENTORY.QA99 SQAT0001
Sample AMQSPUT0 start
target queue is NQSX.IAS.INVENTORY.QA99
1
2
3
4
5
6
7
8
9
10
11
12
13

Sample AMQSPUT0 end
This message, including any attachments, is the property of Sears Holdings Corporation and/or one of its subsidiaries. It is confidential and may contain proprietary or legally privileged information. If you are not the intended recipient, please delete it without reading the contents. Thank you.

________________________________
List Archive<http://listserv.meduniwien.ac.at/archives/mqser-l.html> - Manage Your List Settings<http://listserv.meduniwien.ac.at/cgi-bin/wa?SUBED1=mqser-l&A=1> - Unsubscribe<mailto:LISTSERV-0lvw86wZMd9k/bWDasg6f+***@public.gmane.org?subject=Unsubscribe&BODY=signoff%20mqseries>

Instructions for managing your mailing list subscription are provided in the Listserv General Users Guide available at http://www.lsoft.com<http://www.lsoft.com/resources/manuals.asp>
************************************************************
This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential and/or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this communication and destroy all copies.
************************************************************

To unsubscribe, write to LISTSERV-0lvw86wZMd9k/bWDasg6f+***@public.gmane.org and,
in the message body (not the subject), write: SIGNOFF MQSERIES
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://listserv.meduniwien.ac.at/archives/mqser-l.html

Loading...