[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] XPath Filtering



leduke4223 at gmx.net wrote:
If I understand you right, the first message published has to contain all markup possibly used in a XPath expression.


What I do is the following:


message = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<message><type>configuration</type><origin>subsystem</origin><time>1154588557390</time><destination>NE0001</destination><data><name>change-state</name><jobID>0</jobID><sleep-time>10</sleep-time></data></message>";

I_XmlBlasterAccess con=null;
con = glob.getXmlBlasterAccess();

ConnectQos qos;
try {
qos = new ConnectQos(glob);
con.connect(qos, this);
//TODO Define Keys for the NEs
con.subscribe("<key oid='config'/>", "<qos></qos>");


// TODO process list not single value
con.publish(
new MsgUnit(glob,"<key oid='config'/>",message.getBytes(),"<qos/>"));
Here the topic is configured as

"<key oid='config'/>"

without any additional tags, you could a well send for example:

"<key oid='config'><foo><bar/></bar></key>"


this markup could help to characterize the topic, but this depends on your use case
if you need this.



The message.getBytes() is the content 'blob', xmlBlaster doesn't care what is inside this.
However - we have plugins to further filter messages depending on the content, see
http://www.xmlblaster.org/xmlBlaster/doc/requirements/mime.plugin.access.xpath.html
http://www.xmlblaster.org/xmlBlaster/doc/requirements/mime.plugin.access.regex.html


Be aware of the difference between a "topic" (named by the key oid)
and a "message instance".
Many "message instances" can be send to the same "topic".
The subscribe oid (or xpath) chooses the topic, and the above mentioned mime plugins
further filter each "message instance" flowing through the the topic.


regards
Marcel