[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xmlblaster] multiple callbacks #2
Wolfgang Kleinertz wrote:
Hi!
Just a little question:
Is it possible to have a callback for each subscibtion and not just one
for per client?
I know that it was impossible in earlier version ...
Possibly i understood your question wrong,
here is another answer:
If you want to dispatch the subscription to your client java class
which can handle it, this feature is implemented already,
for example:
XmlBlasterConnection con = ... // login etc.
...
SubscribeKeyWrapper key = new SubscribeKeyWrapper("//stock", "XPATH");
SubscribeQosWrapper qos = new SubscribeQosWrapper();
try {
con.subscribe(key.toXml(), qos.toXml(), new I_Callback() {
public void update(String name, UpdateKey updateKey, byte[]
content, UpdateQoS updateQoS) {
System.out.println("Receiving message for '//stock'
subscription ...");
}
});
} catch(XmlBlasterException e) {
System.out.println(e.reason);
}
You can pass your own specialized I_Callback handling class for each
subscribe.
So you don't need to dispatch incoming messages in a central update()
implementation with ugly switch() case coding.
Marcel