[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[xmlblaster] Re: REGEX/XPATH subscriptions - newbie requests assistance
Hi Bret,
First - thanks for the wonderful work on xmlBlaster! I haven't yet figured
it all out, but it
looks like it'll be _enormously_ useful. I've been looking for a MoM/JMS
options that can do HTTP
to a browser as well as standard PtP and Pub/Sub messaging and the
infrastructure for
xmlBlaster seems quite open and workable. :-)
My question is this... I need some guidance on how to implement the
following using xmlBlaster
to achieve optimal performance and usability. Here's the situation:
1) I have a hierarchy of people that looks like this:
enterprise
enterprise data
sites
site data
groups
data for groups
individuals
data for individuals
2) I'd like to report real-time statistics to browsers, stand-alone
applications, pagers, email,
etc. I envision people opening their tool of choice (i.e. the stand-alone
app), which would
subscribe them to a certain class of messages in the hierarchy.
The real-time callback to browsers is tricky.
The idea is that instant callbacks tunnel through all firewalls and
internet proxies.
This works fine for mozilla, but the current IE and Opera don't work, we
have not
investigated yet why (once upon a time IE 5 worked).
Other protocols can be plugged in to xmlBlaster.
But plan some days for each missing protocol, if you donate the plugins
back plan some additional days for automatic testing and documentation.
See
http://www.xmlblaster.org/xmlBlaster/doc/requirements/protocol.html ff
3) I'd like people to get **ONLY** the information to which they're
privileged to see. This
means group managers can only see their subordinates' information.
Individuals can only see their
information. Site administrators can see everything below them. Enterprise
admins can see **
everything**.
Your specific authorization must be done by a plugin as well, see
http://www.xmlblaster.org/xmlBlaster/doc/requirements/security.development.serverPlugin.howto.html
4) I'd like to subscribe using this nomenclature:
ent_companyname.site_siteid.grp_groupnumber.user_usernumber.data
In practice this would look like this:
ent_foobar.site_123.grp_12.agt_2108.x=y (where x=y is the datapoint and
value). The x=y
could be the body of the message, I guess. I suppose the message would look
like this:
<foobar>
<site id = "123">
<grp id = "12">
<agt id="2108">
<datapoint = value/>
</agt>
</grp>
</site>
</foobar>
Group managers would subscribe to the information that includes their group
number (e.g. regex =
".*grp_12.*". Agents would subscribe to only their agent information using
a regex =
".* agt_2108", etc.
Ideally I think I'd subscribe using a regex on the user or groupnumber, but
I don't see that
option -- did I miss it? I see the ability to subscribe to an EXACT match
on an oid, or to
use the REGEX on the *message body*, but not to subscribe using a regex on
the oid.
Sorry, regex is not supported in the core. The internal query interface
is currently XPath
only. Changing this to be pluggable will be some days of work.
You can use XPath to filter the oid directly, so probably you don't need
regex to do what you need,
try 'starts-with()', 'contains()' etc.
As I've only just started using xmlBlaster I'm sure I don't quite understand
the paradigm, so
I'd appreciate any suggestions or guidance you might have. :-) I have built
working versions
of this subscription scheme using XPATH, but is it the most efficient way of
doing this? Have
I just described the "contains()" function of the XPATH? Should I use this
for an XPATH subscription?
//agt [ at id='2108']
Why not. You can gain performance with absolute queries like
/xmlBlaster/key/foobar/site/grp/agt[ at id='2018']
Another quick question - is it possible to have different callback functions
for each
particular use? In a single program I might want to have some callbacks
call the xyz() method,
while others call the abc() method. This would keep the update() method
from being just a
big case-oriented traffic-cop ;-). No big deal if that's what update() is
supposed to do -
again, I'm just asking, trying to understand the architecture better :-).
Over the remote connection we only support update() and 'oneway update()'.
But the java client library has a dispatching possibility:
SubscribeReturnQos qos = con.subscribe(sk, sq, new I_Callback() {
public String update(String cbSessionId, UpdateKey updateKey, byte[]
content, UpdateQos updateQos) {
log.info(ME, "Receiving asynchronous message '" +
updateKey.getOid() +
"' state=" + updateQos.getState() + " in HelloWorld4
handler");
return "";
}
}); // subscribe with our specific update handler
See xmlBlaster/demo/javaclients/HelloWorld4.java
enjoy
Marcel