|
REQUIREMENT client.failsafe.ping |
| Type | NEW |
| Priority | LOW |
| Status | CLOSED |
| Topic | Allows Java clients to ping xmlBlaster, to test reliable the connection. |
|
Des cription |
|
|
Example 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
qos.setAddress(address);
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
qos.addCallbackAddress(cbAddress);
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);
...
|
| Configure |
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
| 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