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

New feature: Dispatching updated messages ...



Hi,

this is for Java clients only, available on cvs main branch.

The Java client helper class XmlBlasterConnection.java
has now another subscribe() variant.

You may pass a specialized I_Callback implementation
for every subscription.

This allows incoming updates to be dispatched to
dedicated update() methods, for example:


------------------------------------------- ...

  // login:
  XmlBlasterConnection con = new XmlBlasterConnection(args);
  con.login(loginName, passwd, loginQos, this);

  ...

  // subscribe with an anonymous update() method to handle
  // this subscription
  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 with specialized
                                  update() ...");
           }
        });

  ...
-------------------------------------------

This is often smarter than having one centralized update()
only, with the need to look into each message and then
decide what it is for.

See xmlBlaster/demo/javaclients/ClientSubDispatch.java
as an example.

regards,

Marcel



--
Marcel Ruff
mailto:ruff at swand.lake.de
http://www.lake.de/home/lake/swand/
http://www.xmlBlaster.org