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

Re: [xmlblaster-devel] Using GnuRegexFilter



Matthew Sargent wrote:
Hi,
I have a problem. I subscribe to xmlBlaster using an XPath that specifies a certain value on the key. An initial message is posted that does not have that value in the key, then later an update is posted that does. Since the key is immutable, it is not changed and I do not get the update message. I think I can I use the GnuRegexFilter to register a filter that looks in the body of each message for the value I am seeking, is that true? When I attempt to do that, I get no messages back at all. Does anyone have an example using the GnuRegexFilter for a subscribe? In my code, if I take out the addAccessFilter with my regex expression, I get all the messages posted, which is correct. When I add the addAccessFilter back in with a simple expression that should match anything ".*", I get no messages back at all.
Here is the dump of my subscribe key and subscribe qos
SubscribeKey=
<key queryType='XPATH'>
//key[starts-with( at oid, 'msg-')]
</key>
SubscribeQos=
<qos>
<content/>
<multiSubscribe/>
<local>false</local>
<initialUpdate/>
<filter type='GnuRegexFilter'>
<![CDATA[.*]]>
</filter>
<history numEntries='1000' newestFirst='false'/>
<isSubscribe/>
</qos>
Matt

Hi Matt,

if have played on command line with the clients below,
everthing works as expected here:

-------------------------------------
cd xmlBlaster

#Start server
java -jar lib/xmlBlaster.jar

#Start subscriber
java -cp lib/xmlBlaster.jar javaclients.HelloWorldSubscribe -xpath "//key[starts-with( at oid, 'msg-')]" -filter.type GnuRegexFilter -filter.query ".*"


#Start a ".*A" filtering subscriber
java -cp lib/xmlBlaster.jar javaclients.HelloWorldSubscribe -xpath "//key[starts-with( at oid, 'msg-')]" -filter.type GnuRegexFilter -filter.query ".*A"


#Start first publisher
java -cp lib/xmlBlaster.jar javaclients.HelloWorldPublish -numPublish 100 -oid "msg-1" -content "12A"

#Start second publisher
java -cp lib/xmlBlaster.jar javaclients.HelloWorldPublish -numPublish 100 -oid "msg-2" -content "12B"
-------------------------------------

One note: You have set "<local>false</local>", if your publisher uses
the same login connection as the subscriber the messages
are suppressed.

regards

Marcel

--
http://www.xmlBlaster.org