Broker 10.5 | webMethods Broker Documentation | webMethods Broker Client Java API Programmer's Guide | Using Broker Clients | Broker Connection Descriptors | Using Client Keep-Alive | Setting the Keep-Alive Parameters
Setting the Keep-Alive Parameters
To specify the behavior of the Broker's keep-alive feature, use the BrokerConnectionDescriptor.setKeepAlive method. This method sets the following parameters in the BrokerConnectionDescriptor object:
*KeepAlivePeriod. The number of seconds of idle time the Broker waits before issuing a keep-alive message to a client. To suppress keep-alive messages entirely, set KeepAlivePeriod to Integer.MAX_VALUE.
*MaxResponseTime. The number of seconds the Broker waits for a response from the client after issuing a keep-alive message. This value must be greater than 0 and less that the Keep-Alive Period. Set the Max Keep-Alive Response Time to Integer.MAX_VALUE to specify an infinite response time.
*RetryCount. The number of times the Broker resends a keep-alive message to a non-responsive client before disconnecting that client.
How you configure the keep-alive settings depends upon the reason for which you are using keep-alive.
*For zombie session removal, you set a fairly short keep-alive interval, typically in seconds, so that you can quickly remove any zombie sessions.
*For keeping the connection open through firewalls, you set a keep-alive interval closely matching the firewall time-out period, which is typically in minutes. This prevents the firewall from shutting down the connection because of inactivity.
The following code fragment uses the setKeepAlive method to specify a KeepAlivePeriod of 90 seconds, a MaxResponseTime of 30 seconds, and a RetryCount of 5.
BrokerConnectionDescriptor desc;
/* Create descriptor */
desc = new BrokerConnectionDescriptor();
Be aware that different combinations of the KeepAlivePeriod, MaxResponseTime, and RetryCount produce distinctly different behaviors. For details, see the parameter descriptions for the BrokerConnectionDescriptor.setKeepAlive method.
Client keep-alive uses server resources. If you have a large number of clients, the Broker Server may become bogged down servicing these requests. In situations such as these, increasing the default keep-alive period may be necessary. Make sure to set the keep-alive values appropriately and do not over-use the feature.