Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using Broker Clients | Broker Connection Descriptors | Using Client Keep-Alive
 
Using Client Keep-Alive
 
Setting the Keep-Alive Parameters
Getting the Current Keep-Alive Parameters
Using the Keep-Alive Feature with a Shared Connection
You can use the Broker client keep-alive feature for two purposes:
*To quickly detect dropped client connections. This feature is useful in network configurations that might not notify the Broker until long after a client becomes disconnected (which, with some types of connections might be hours later).
*To keep the client connection open through firewalls.
If client state is not shared, an undetected broken connection does not pose a problem. The Broker will automatically redeliver unacknowledged events to the client when it reconnects. However, when a client's state is shared, the Broker cannot distinguish the reconnection of a disconnected client from the ordinary reconnections of the other clients that are sharing the same state (shared clients all use the same client ID). As a result, the Broker will continue to hold that client's unacknowledged events in the queue until it receives an explicit disconnect notice from the network (generally, when the TCP/IP connection finally times out). If the shared-state client requires ordered events by publisher, the unacknowledged events will also prevent further processing of any additional events from their publishers.
You can avoid this condition by enabling the keep-alive feature in the connection descriptor. When enabled, the keep-alive feature causes the Broker to periodically check its connection to clients that are connected through the descriptor. To test the connection, the Broker sends a keep-alive message to any client that is idle for a specified period of time. If the client does not respond to the keep-alive message within a certain interval, the Broker explicitly disconnects it. By explicitly disconnecting the client, the client's unacknowledged events immediately become available for redelivery and can be retrieved by the other shared-state clients.