ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » message selectors in MQ V7

Post new topic  Reply to topic Goto page 1, 2  Next
 message selectors in MQ V7 « View previous topic :: View next topic » 
Author Message
ArthurNL
PostPosted: Fri Jul 31, 2009 3:51 am    Post subject: message selectors in MQ V7 Reply with quote

Newbie

Joined: 07 Apr 2008
Posts: 5

Hi,

I am having a look at MQ V7 Publish/Subscribe.
One of the options in MQ V7 is the use of message selectors on the MQOPEN and MQSUB calls. Using this message selectors, it is possible to filter messages using the SQL92 specification.
The use of message selectors is also described in:
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wmq_v7/wmq/7.0/MQI/iea_330_wmqv7_API_3_Selectors.pdf

On a MQSUB call, you can specify a filter in the SelectionString field of the Subscription Descriptor structure. Subsequent MQGET calls will get only those messages that match the filter.

However, the following issues are not clear to me:
1. To what part of the message is the filtering applied, message header of message data?
2. If applicable to message header, how do I set this selection criteria using MQPUT?

Thanks for your response !!

Arthur
Back to top
View user's profile Send private message
manicminer
PostPosted: Fri Jul 31, 2009 5:12 am    Post subject: Reply with quote

Disciple

Joined: 11 Jul 2007
Posts: 177

1. See slide 3 of your linked PDF

"The query can select based on the values of ANY message property", so you will need to have some message properties on the message that you MQPUT for the selector to select on.

2. use the message properties api when you put.
_________________
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 31, 2009 6:00 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Note that message properties are NOT contained in the BODY of the message.

If you need to do subscription filtering based on the BODY of the message, you need Message Broker.

Also note that message selectors are assigned at MQOPEN time and are not changeable at MQGET time.
Back to top
View user's profile Send private message
shashikanth_in
PostPosted: Fri Jul 31, 2009 10:52 am    Post subject: Reply with quote

Centurion

Joined: 26 Feb 2009
Posts: 123

You could look at MQSETMP - MQ Set Message properties API and other related APIs which are used to create and set message properties to a MQ message.

HTH
Back to top
View user's profile Send private message
ArthurNL
PostPosted: Sun Aug 02, 2009 11:33 pm    Post subject: Reply with quote

Newbie

Joined: 07 Apr 2008
Posts: 5

Thank you all for your replies.
I managed to get it work using the MQSETMP call.

Arthur.
Back to top
View user's profile Send private message
WBIMaestro
PostPosted: Fri Sep 28, 2012 1:54 pm    Post subject: Reply with quote

Acolyte

Joined: 18 Feb 2005
Posts: 53

at the risk of being chided for posting on an old post - what MQMD fields can I use selector API on? it is not too clear to me from the documentation. it looks like I can use any MQ MEssage properties fields, but the broker dosent really recognize Message properties does it? If I update the MQRFH2 header fields in the message will it show up as an MQ Message property when browsed using selector API from the queue?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Sep 28, 2012 8:30 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

WBIMaestro wrote:
at the risk of being chided for posting on an old post - what MQMD fields can I use selector API on? it is not too clear to me from the documentation. it looks like I can use any MQ MEssage properties fields, but the broker dosent really recognize Message properties does it? If I update the MQRFH2 header fields in the message will it show up as an MQ Message property when browsed using selector API from the queue?


What have you tried and with what type of results?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Fri Sep 28, 2012 9:21 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Broker selectors work on logical message tree paths.

MQ selectors work on message properties.

Broker currently acts as a non-property aware application that converts all properties to RFH2 fields and vice versa. So if you want to create a broker selector on an mq message property, you'll need to use a Trace node to dump out the message tree to find out what the path to the property you want is - likely Root.MQRFH2.usr.<property>, but it's best not to guess, just test.
Back to top
View user's profile Send private message
WBIMaestro
PostPosted: Mon Oct 01, 2012 7:22 am    Post subject: Reply with quote

Acolyte

Joined: 18 Feb 2005
Posts: 53

I set the MQRFH2.usr folder with name value pairs and dumped it out to a trace file. I dont see it showing up as an MQ message Property. only as MQMD.MQRFH2.usr...

How/where does this broker conversion from MQRFH2 to message property occur?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Oct 01, 2012 7:32 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

WBIMaestro wrote:
How/where does this broker conversion from MQRFH2 to message property occur?

When the message is written to the queue, MQ does the conversion. Not broker.

If you pass it to an MQOutput, then amqsbcg should show properties and not the rfh2.

it might still show an RFH2, though, but applications that ask for properties will get properties anyway.
Back to top
View user's profile Send private message
WBIMaestro
PostPosted: Tue Oct 02, 2012 9:45 am    Post subject: Reply with quote

Acolyte

Joined: 18 Feb 2005
Posts: 53

so, my data looks as follows in the Msg Browse :

Code:

'RFH ........"...'
'....MQSTR   ....'
'....d...<usr><Pr'
'operty1>AAAA</Pr'
'operty1><Propert'
'y2>BBBB</Propert'
'y2><Property3>CC'
'CCCCCCCCC</Prope'
'ty3></usr>......'
'<mcd><Msd>xmlnsc'
'</Msd></mcd><?xm'
'l version="1.0" '
'encoding="iso-88'
'59-1"?>..


What should the selector API be querying on - MQProperty.usr.Property1?
what would be the path to the property set in this way?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 03, 2012 8:15 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Have you tried to use a selector with a very simple:
Code:
propertyname=propertyvalue

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
WBIMaestro
PostPosted: Mon Oct 08, 2012 5:50 am    Post subject: Reply with quote

Acolyte

Joined: 18 Feb 2005
Posts: 53

I checked in Mq Explorer and can see the properties set under 'named properties'. However having a tough time putting together code to browse/get the messages based on properties. the information seems to be scattered all over the api guide and mixed up between jms, pub sub and simple MQ API based calls to get from a queue based on properties. Would you know of a sample program and source code(C/C++) that I can look at for the latter (simple MQ API based calls to get from a queue based on properties)? thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Oct 08, 2012 12:09 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Read up in the programming manual on how to use a selector outside of JMS / XMS. This should guide you in the right direction.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
sojourner
PostPosted: Sat Jun 21, 2014 1:55 pm    Post subject: Reply with quote

Newbie

Joined: 21 Jun 2014
Posts: 1

I concur with Arthur, I have read the manual and scoured the internet but still can not figure out how to set the message selector on the queue open or queue manager using the java mq api. If someone has accomplished this a simple code snippet would be awesome.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » message selectors in MQ V7
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.