Author |
Message
|
mvsivaiah |
Posted: Tue Jul 21, 2009 12:26 am Post subject: Filter property in Publish Message ?? |
|
|
 Apprentice
Joined: 30 May 2008 Posts: 25
|
Hi All,
I want to publish message messages based on both the conditions: Topics and Sub-Topics. I want to use Sub-Topic as Filter property in the published message. How can I implement this?
My Publish message (a simple XML message) input is:
<PUBSUBTEST><Topic>AIW</Topic><F1>EndofBatch</F1></PUBSUBTEST>
I've used the following ESQL:
SET OutputRoot.MQRFH2.psc.Topic="InputRoot"."XMLNSC"."PUBSUBTEST"."TOPIC"; SET OutputRoot.MQRFH2.psc.Filter= "InputRoot"."XMLNSC"."PUBSUBTEST"."F1";
I observed the messages are publishing based on the Topic only. The Filter condition is inactive.
Could you all please give me suggestions to process the xml input? _________________ Venkat. |
|
Back to top |
|
 |
jbanoop |
Posted: Tue Jul 21, 2009 5:44 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
for registering subscriptions , send a message in the following format to the SYSTEM.BROKER.CONTROL.QUEUE
<Message>
<Command>RegSub</Command>
<Topic>topic name</Topic>
<QMgrName>QMname</QMgrName>
<QName>qname</QName>
<RegOpt>persistant or non persistant registration</RegOpt>
<Filter>filter condition </Filter>
</Message> |
|
Back to top |
|
 |
mvsivaiah |
Posted: Tue Jul 21, 2009 6:35 am Post subject: |
|
|
 Apprentice
Joined: 30 May 2008 Posts: 25
|
Hi jbanoop,
Thanks for your reply.
I knew from Information center aswell that we have Filter property option for subscription.
But my question is whether Filter property is available for Publish message??
I couldn't find about this in information center. _________________ Venkat. |
|
Back to top |
|
 |
jbanoop |
Posted: Tue Jul 21, 2009 6:54 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
if the subscription has a particular filter criteria, the broker will take into account that criteria also while processing the publish message.
Eg: if the topic is A/B/C/D and the filter criteria is
Code: |
Body.customer.custno='001' |
then, when a message is pulished, the subscribers for that subscription would receive the published message only if the message had that topic as well as the filter criteria is satisfied.
In short, while creating the subscription, mention the filter criteria and depending on whether the criteria is satisfied in the published message, it is routed to the subscriber.
Did I answer your question or were you looking at something else ? |
|
Back to top |
|
 |
mvsivaiah |
Posted: Tue Jul 21, 2009 7:11 am Post subject: |
|
|
 Apprentice
Joined: 30 May 2008 Posts: 25
|
Hi jbanoop,
Still I'm trying to understand what you said.
As per my testing, I'm able to register the subscription with xml message into the folder as:
<psc>
<Command>RegSub</Command>
<Topic>AIW</Topic>
<Filter>EndOfBatch</Filter>
</psc>
Similarly I'm trying to publish message as:
<psc>
<Command>Publish</Command>
<Topic>AIW</Topic>
<Filter>EndOfBatch</Filter>
<Data> The AIW Batch is Ended </Data>
</psc>
Here I want to make sure two conditions to be satisfied (Topic aswell as Filter) before publishing the message.
But the message is publishing with the condition of Topic alone. Filter is inactive while publishing.
Correct me please. _________________ Venkat. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 21, 2009 7:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mvsivaiah wrote: |
Filter is inactive while publishing. |
Yes it is. A publication is identified by it's topic. The subscriber decides which publications by subscribing and optionally filtering out publications on that topic which don't satisfy a filter.
If you don't want to publish a message if a filter condition is not met, write code within the publisher.
And what's the requirement here? It's a bit backwards on how publications are typically handled. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jbanoop |
Posted: Tue Jul 21, 2009 8:10 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
What I was talking about was using of filters with topics for selective subscription of the same topic based on the filter criteria.
Eg: if you are publishing employee data using a topic employee/update/1/0 and you want a particular subscriber to process only manager information, then you could have a filter indicating :
Body.Employee.EmployeeDesignation='Manager'
Thus the subscription registered with this filter criteria will cause the broker to route the published message to the subscriber queue only if :
a) topic = employee/update/1/0
b) Body.Employee.EmployeeDesignation='Manager'
Thus you can make use of filters to ensure that messages are routed to a subscriber only if certain criteria are satisfied in addition to the topic.
Does this shed any more light ? |
|
Back to top |
|
 |
mvsivaiah |
Posted: Wed Jul 22, 2009 4:23 am Post subject: |
|
|
 Apprentice
Joined: 30 May 2008 Posts: 25
|
Hi Vitor & jbanoop,
I could draw out the following points,If I understood correctly. Correct me If I'm wrong.
(1)Topic of Publication checks with Topic of Subscriber
(2) But the Content of Published message (say in my case, InputRoot.XMLNSC.PubMsgIn.Event) will be checked with the Filter in the Subscription.
I've tried the flow with the conclusions above. (There are various events published under the same Topic BIW: Start of Batch, End Of Batch, Batch repaired etc. for which subscriptions are made)
I used the following ESQL for Filter in a Subscription:
SET OutputRoot.MQRFH2.psc.Filter='InputRoot.XMLNSC.PubMsgIn.Event=EndOfBatch';
But the Filter is inactive and the publishing is happening with Topic alone. Help me pls.
Another Question is: Where can I find registered subscriptions at z/OS broker domain? _________________ Venkat. |
|
Back to top |
|
 |
jbanoop |
Posted: Wed Jul 22, 2009 4:52 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
the setting of the filter criteria and the topic (basically registration of the subscription) is typically done seperately.
When you use the publication node, you are publishing a particular message. Publishing occurs on a topic only. However , the broker , from the registered subscriptions, identifies the valid subscriptions (topic name + filter conditions) and routes the message to those input queue(s).
Here the point is, when you send a message to the publication node, that is the actual message that needs to be routed to one or more input queues.
The decision as to which input queue(s) the message should go to is made using the registered subscriptions.
Please read through the manuals on how to implement pub sub solutions using MB for further details. |
|
Back to top |
|
 |
|