I'm trying to filter using Xpath.This works fine here:
FYI - I've set "-agent" on the command line to 1000 and I get it in the code via: String agent = glob.getProperty().get("agent", "0001");
I've set the following in my code:
String agentKey = new String("agent_"+agent);
PublishKey pk = new PublishKey(glob, oid, "text/xml", "1.0");
pk.setClientTags("<org.xmlBlaster><demo/><" + agentKey +
">test</" +
agentKey + "></org.xmlBlaster>");
This gets a tag set for agent_1000 above...
I subsequently publish the message.
Now, in my GUI/receiver I sign in as agent 1000, like this:
sk = new SubscribeKey( glob,"//*[contains(name(),'agent_"+ myClient.getJTextField().getText()+ "')]", Constants.XPATH);
which sets my xpath filter to: <key queryType='XPATH'> //*[contains(name(),'agent_1000')] </key>
The messages don't arrive... So, does an Xpath filter apply to the clienttags? I thought it applied to the entire message, but maybe it's just the content?
1. Start xmlBlaster:
java org.xmlBlaster.Main -call[core] true
2. Do a 'cvs update -dP' and compile xmlBlaster to get the new HelloWorldPublish
which now allows to set the client tags from command line:
java javaclients.HelloWorldPublish -clientTags "<org.xmlBlaster><demo/><agent_1000>test</agent_1000></org.xmlBlaster>"
(and hit a key to publish)
3. Start the subscriber
java javaclients.HelloWorldSubscribe -xpath "//*[contains(name(),'agent_1000')]"
(and hit a key to subscribe)
and it works as expected.
regards
Marcel
PS: The XPath is only checking the message key.
PPS: We have plugins for REGEX and XPATH to further filter using message contents.
Thanks,
Bret
