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

Re: [xmlblaster] implementing query in addition to publish / subscribe



Michael Atighetchi wrote:
Ok, I tried to use "get" to retrieve all messages for a given topic.

After publishing a bunch of messages, I call get but only receive a
single message. This cannot be the desired semantics for get, is it ?

I double checked that the database tables are large enough to hold
multiple messages for a topic, and that seems to be true.

Here is the code snippet:

try {
GetKey gk = new GetKey (getCurCon().getGlobal(),
xpath,
Constants.XPATH); String qos = "<qos></qos>";
System.err.println ("stub querying synchronously for "+gk.toXml()+" "+qos);
return getCurCon().get (gk.toXml(), qos);
} catch (Exception e) {
e.printStackTrace();
}


xpath="/xmlBlaster/key/MyType[Name='WeatherImage']"

and I have published 12 messages that fit this predicate.

Every topic has its history queue.

The default size is currently 10 (but will change to one),
so every topic holds up to 10 messages.

(See http://www.xmlblaster.org/xmlBlaster/doc/requirements/interface.publish.html
and
http://www.xmlblaster.org/xmlBlaster/doc/requirements/engine.message.lifecycle.html
how to adjust the history depth with the first
published message of a topic).



If you subscribe() or get() messages, only the newest message in a topic is returned.

To query history entries use the QoS markup, e.g.

   <history numEntries='20'/>

If you do a cvs update you get a new demo client
with which you can play on command line (history and filters):

#--------------------------------------------------------
#Deliver all messages, with max. history depth=10:
java javaclients.HelloWorldGet -xpath //key  -numHistory 10

#Filter messages so that content starts with letters '__sys'
java javaclients.HelloWorldGet -xpath //key
         -filter.type GnuRegexFilter -filter.query "^__sys.*"

#Deliver the 5 last messages of topics containing <WeatherImage>:
java javaclients.HelloWorldGet
      -xpath "/xmlBlaster/key/MyType[Name='WeatherImage']"
      -numHistory 5

#the same is possible asynchronous with
java javaclients.HelloWorldSubscribe
      -xpath "/xmlBlaster/key/MyType[Name='WeatherImage']"
      -numHistory 5
#--------------------------------------------------------

best regards,

Marcel


Any clues ?

Michael

On Tue, Mar 04, 2003 at 11:51:53PM +0000, laghi at swissinfo.org wrote:

Hallo Michael,
if you want to make a request synchroneously then "get" is the correct choice.


If the kind of query would be of lets say the kind:

a) "Give me back the last 5 messages of a particular topic" or b) "give me all messages since Christmas for a given topic"

It is what we call history queue queries, that is, queries regarding a specific
topic (a specific msg oid). These are on our high priority list and will
be implemented as a plugin. Fore more exotic queries one can then write
a more specific plugin.

For case a) there is already a way of doing it. See the requirement: http://www.xmlBlaster.org/xmlBlaster/doc/requirements/interface.subscribe.html
for an example or have a look at HelloWorldSubscribe.


Cheers Michele



Date: Tue, 4 Mar 2003 18:23:29 -0500
From: Michael Atighetchi <matighet at bbn.com>
To: xmlblaster at server.xmlblaster.org
Subject: Re: [xmlblaster] implementing query in addition to publish / subscribe
Reply-To: xmlblaster at server.xmlBlaster.org


It seems the get method is doing exactly what I want synchronously. I'll investigate wheather this will do for our use case.

Michael

On Tue, Mar 04, 2003 at 06:10:45PM -0500, Michael Atighetchi wrote:

How difficult would it be to enhance xmlblaster to deal with query
operations in addition to publish & subscribe ?

The query operation would be very similar (ie allow xpath
and regex matching) to a time-limited subscribe operation that only
returns the current set of messages known to xmlblaster and the
terminates.

It could probably be implemented using direct JDBC calls, however, I
would prefer an implementation that goes through xmlblaster utilizing
the parsed messages in the DOM.

Anyone has ideas about how to best approach this ?

Michael





________________________________________ Dreaming of a Swiss Account? Get it here: http://freemail.swissinfo.org