A topic is generally in the form “topic/subtopic,” for example “sport/baseball.”
You can specify a wildcard, such as “*” or “?” within a topic.
When specifying multiple topics, separate the topics with a colon. For instance, “topic1:topic2:topic3:..”.
If a topic contains spaces or commas, the entire topic list must be placed in quotes. Since topics can appear in message header or message property clauses as strings, if the option string is passed as a quoted scalar value, the enclosed quotes must be escaped by doubling them. Furthermore, if the topic is contains also embedded double quotes, the embedded double quotes must be escaped by quadruple quotes. For example:
-- Topic has embedded spaces, we need to quote with escaped quotes select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics=''Sport/Football/Hometown Bulldogs''') -- Topic has embedded spaces, we can quote with double quotes select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics="Sport/Football/Hometown Bulldogs"') -- Topic has embedded spaces and embedded double quotes, the inner -- double quotes need to be escaped. set quoted_identifier off select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics="quoted ""topic"" here"') -- Topic has embedded spaces and embedded double quotes, double the -- quotes around the topic, and quadruple the embedded quotes. select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property "topics=""quoted """"topic"""" here""")
When topics have embedded spaces or quotes, the topic is quoted in the MQRF header. If the topic has embedded quotes, the quotes are escaped before being put into the MQRF header.
In the following example, there is one topic, which is placed in the MQRF header as ‘“Sport/Football/Hometown Bulldogs”’. Another example is:
select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics=''Sport/Football/Hometown Bulldogs''')
In the following example, there is one topic, which is placed in the MQRF header as ‘“Books/””Recipes Of Spain”””’.
select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics=''Books/''Recipes Of Spain"''')
You can escape topic name by using “::”; and any single, non-escaped trailing “:” is ignored.
In the following example, there are three topics, “baseball”, “baseball/anytown”, and “baseball/scores”.
select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics=baseball:baseball/anytown:baseball/scores')
In this example, there are three topics, “subject1”, “subject:2”, and “subject3”. Note that “::” is used to escape the embedded “:”.
select msgsend(NULL, 'ibm_mq:channel1/tcp/host1(5678)?qmgr=QM1,queue=SAMPLE.STREAM' option 'msgType=datagram,rfhCommand=publish' message property 'topics=subject1:subject::2:subject3')
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |