Author |
Message
|
jdevassy |
Posted: Wed Apr 02, 2008 10:40 pm Post subject: WMB/MQ subscriptions with content filter |
|
|
Apprentice
Joined: 16 Oct 2005 Posts: 37 Location: Melbourne, Australia
|
Hi,
I am usinf MWB pub sub to subscribe to messages. it works ok with just the topic name.
But I want to subscribe with same topic name + content based filter. ie I want to get messages for that topic with a particular value in the message body. I am using RFHUtil to do subscriptions for the queue.
Could anyone tell me how to set the filter for this subscription. The message I use is like this and the value to filter the message is: 'MyVale' = ABC.
<wsnt:Notify xsi:schemaLocation="http://docs.oasis-open.org/wsn/b-2 b-2.xsd" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsad="http://www.w3.org/2005/08/addressing" xmlns:tr="http://www.immi.gov.au/Namespace/TRIPS/Messages/V2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nbts="urn:xml-gov-au:immi:codes:wsnt-topic-space:SFP-IS-NotificationBroker:1.0">
<wsnt:NotificationMessage>
<wsnt:Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple">Sample Topic</wsnt:Topic>
<wsnt:ProducerReference>
<wsad:Address>http://www.immi.gov.au/Namespace/PermanentSystemAddresses/</wsad:Address>
</wsnt:ProducerReference>
<wsnt:Message>
<MyMessage>
<MyValue>ABC</MyValue></MyMessage>
</wsnt:Message>
</wsnt:NotificationMessage>
</wsnt:Notify>
thanks
jo _________________ Thanks & Regards,
Joy Paliakkara Devassy |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Thu Apr 03, 2008 12:32 am Post subject: Re: WMB/MQ subscriptions with content filter |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
jdevassy wrote: |
Hi,
I am usinf MWB pub sub to subscribe to messages. it works ok with just the topic name.
But I want to subscribe with same topic name + content based filter. ie I want to get messages for that topic with a particular value in the message body. I am using RFHUtil to do subscriptions for the queue.
Could anyone tell me how to set the filter for this subscription. The message I use is like this and the value to filter the message is: 'MyVale' = ABC.
<wsnt:Notify xsi:schemaLocation="http://docs.oasis-open.org/wsn/b-2 b-2.xsd" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsad="http://www.w3.org/2005/08/addressing" xmlns:tr="http://www.immi.gov.au/Namespace/TRIPS/Messages/V2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nbts="urn:xml-gov-au:immi:codes:wsnt-topic-space:SFP-IS-NotificationBroker:1.0">
<wsnt:NotificationMessage>
<wsnt:Topic Dialect="http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple">Sample Topic</wsnt:Topic>
<wsnt:ProducerReference>
<wsad:Address>http://www.immi.gov.au/Namespace/PermanentSystemAddresses/</wsad:Address>
</wsnt:ProducerReference>
<wsnt:Message>
<MyMessage>
<MyValue>ABC</MyValue></MyMessage>
</wsnt:Message>
</wsnt:NotificationMessage>
</wsnt:Notify>
thanks
jo |
Quote: |
"JMS provides a mechanism to select a subset of the messages on a queue so that
this subset is returned by a receive call. When creating a QueueReceiver, you can
provide a string that contains an SQL (Structured Query Language) expression to
determine which messages to retrieve. The selector can refer to fields in the JMS
message header as well as fields in the message properties (these are effectively
application-defined header fields)." |
It means that you can not filter by your XML field.
...but this field you can use as parameter in publisher
Code: |
PublishMessage.setStringProperty("MyValue","ABC"); |
and use as selector in subscriber
Code: |
topicSubscriber = topicSession.createSubscriber(topic, "MyValue=ABC", false); |
_________________ Marcin |
|
Back to top |
|
 |
jdevassy |
Posted: Thu Apr 03, 2008 2:01 am Post subject: |
|
|
Apprentice
Joined: 16 Oct 2005 Posts: 37 Location: Melbourne, Australia
|
thanks heaps for a fast reply.
Does it mean that the content based filtering is not possible with XML publications?
what if the message format is changed to MQSTR instead of XML.
thanks
jo |
|
Back to top |
|
 |
jdevassy |
Posted: Thu Apr 03, 2008 2:13 am Post subject: |
|
|
Apprentice
Joined: 16 Oct 2005 Posts: 37 Location: Melbourne, Australia
|
And also I am using MQ subscription.
thanks
jo |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 03, 2008 2:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jdevassy wrote: |
And also I am using MQ subscription.
|
In the original post, you said you were using WMB rather than MQ subscription. Am I missing a point here?  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jdevassy |
Posted: Thu Apr 03, 2008 11:20 pm Post subject: |
|
|
Apprentice
Joined: 16 Oct 2005 Posts: 37 Location: Melbourne, Australia
|
Sorry for the confusion.
I am using WMB publish node to publish the message and the subscriptions are done on MQ queues. I am using RFHUtil to do the MQ subscription. It works just with the topic name. There is an option in the RFHUtil to give the filter, but I am not able to get it wotking. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Apr 04, 2008 3:10 am Post subject: Re: WMB/MQ subscriptions with content filter |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
marcin.kasinski wrote: |
Quote: |
"JMS provides a mechanism to select a subset of the messages on a queue so that
this subset is returned by a receive call. When creating a QueueReceiver, you can
provide a string that contains an SQL (Structured Query Language) expression to
determine which messages to retrieve. The selector can refer to fields in the JMS
message header as well as fields in the message properties (these are effectively
application-defined header fields)." |
It means that you can not filter by your XML field.
...but this field you can use as parameter in publisher
Code: |
PublishMessage.setStringProperty("MyValue","ABC"); |
and use as selector in subscriber
Code: |
topicSubscriber = topicSession.createSubscriber(topic, "MyValue=ABC", false); |
|
Realize however that you now have a selector that looks neither at MessageId nor at CorrelationId (potential performance problem).
I would not recommend this solution because of performance problems.
Rather take all messages from the subscription and look at the property. Discard the ones of no interest...
Have you looked at MessageBroker subscription Point?
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
AkankshA |
Posted: Fri Apr 04, 2008 3:20 am Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Apr 04, 2008 10:45 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Moved to WMB Forum _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Fri Apr 04, 2008 12:14 pm Post subject: Re: WMB/MQ subscriptions with content filter |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
fjb_saper wrote: |
Have you looked at MessageBroker subscription Point?
|
I've never had to use subscription Point.
I always use default subscription Point.
PS.
How to set subscription Point in my JMS subscription application if JMS use RFH not RFH2 in subscription message.
I use JMS app and MBv6.1 can not find it. _________________ Marcin |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Apr 04, 2008 2:05 pm Post subject: Re: WMB/MQ subscriptions with content filter |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
marcin.kasinski wrote: |
fjb_saper wrote: |
Have you looked at MessageBroker subscription Point?
|
I've never had to use subscription Point.
I always use default subscription Point.
PS.
How to set subscription Point in my JMS subscription application if JMS use RFH not RFH2 in subscription message.
I use JMS app and MBv6.1 can not find it. |
MBV6.1 and RFH not RFH2?? How is that working out for you? Well this is just one more reason go look for the RFH2 _________________ MQ & Broker admin |
|
Back to top |
|
 |
jdevassy |
Posted: Fri Apr 04, 2008 3:58 pm Post subject: |
|
|
Apprentice
Joined: 16 Oct 2005 Posts: 37 Location: Melbourne, Australia
|
thnka you all for the replies.
I havent looked at the WMB subscription point. At the momeent MB publishes to the default location.
Apparently the best solution is to do a custom filtering of the messages.
Thanks
Jo |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Fri Apr 04, 2008 10:45 pm Post subject: Re: WMB/MQ subscriptions with content filter |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
fjb_saper wrote: |
MBV6.1 and RFH not RFH2?? How is that working out for you? Well this is just one more reason go look for the RFH2 |
But still there is open question:
How to set subscription Point in my JMS subscription application ?
How to register subscription with custom subscription Point ?
I was thinking about sending subscription request to broker queue. Then in this flow I could change FRH into RFH2 and add subscription point and send this converted message to SYSTEM.BROKER.CONTROL.QUEUE queue.
Is there better way ? _________________ Marcin |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Apr 05, 2008 6:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Have you looked at the publish node?
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Sat Apr 05, 2008 6:37 am Post subject: |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
fjb_saper wrote: |
Have you looked at the publish node?
 |
Publishing is not a problem but I was asking about register subscription .
Quote: |
How to register subscription with custom subscription Point ? |
I have problem only with register subscription message.
My question is how to set subscription Point during subscribing to a topic in my JMS JAVA code.
Code: |
TopicSubscriber tSub = tSess.createDurableSubscriber(t, "A"); |
_________________ Marcin |
|
Back to top |
|
 |
|