XmlBlaster Logo



XmlBlaster Logo

Type NEW
Priority LOW
Topic Allows Java clients to ping xmlBlaster, to test reliable the connection.
The xmlBlaster interface has a ping method. This allows checking the CORBA/RMI/XmlRpc connection. The Java I_XmlBlasterAccess class uses this ping (if in fail save mode) and starts login polling if the ping fails. Use method I_XmlBlasterAccess.registerConnectionListener() to activate the ping feature and set the ping interval. Note that this is a pure client behavior, and for the moment the only reference implementation is in Java.
import org.xmlBlaster.client.I_ConnectionStateListener;
import org.xmlBlaster.util.dispatch.ConnectionStateEnum;
import org.xmlBlaster.client.I_XmlBlasterAccess;
import org.xmlBlaster.client.I_ConnectionHandler;

Address address = new Address(glob);
address.setDelay(4000L);      // retry connecting every 4 sec
address.setRetries(-1);       // -1 == forever
address.setPingInterval(0L);  // switched off

CallbackAddress cbAddress = new CallbackAddress(glob);
cbAddress.setDelay(4000L);      // retry connecting every 4 sec
cbAddress.setRetries(-1);       // -1 == forever
cbAddress.setPingInterval(4000L); // ping every 4 seconds

con.registerConnectionListener(new I_ConnectionStateListener() {
      public void reachedAlive(ConnectionStateEnum oldState,
                               I_ConnectionHandler connectionHandler) {
         conRetQos = connectionHandler.getConnectReturnQos();
         log.info(ME, "I_ConnectionStateListener: We were lucky, connected to " +
                      glob.getId() + " as " + conRetQos.getSessionName());
         // we can access the queue via connectionHandler and for example erase the entries ...
      public void reachedPolling(ConnectionStateEnum oldState,
                                 I_ConnectionHandler connectionHandler) {
         log.warn(ME, "I_ConnectionStateListener: No connection to " +
                      glob.getId() + ", we are polling ...");
      public void reachedDead(ConnectionStateEnum oldState,
                              I_ConnectionHandler connectionHandler) {
         log.warn(ME, "I_ConnectionStateListener: Connection to " +
                      glob.getId() + " is DEAD");

ConnectReturnQos conRetQos = con.connect(qos, this);


NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

See API org.xmlBlaster.client.I_XmlBlasterAccess
See TEST org.xmlBlaster.test.qos.TestFailSavePing

This page is generated from the requirement XML file xmlBlaster/doc/requirements/client.failsafe.ping.xml

Back to overview