How do I determine an active server connection in a StreamBase Client?
book
Article ID: KB0076361
calendar_today
Updated On:
Description
How do I determine an active server connection in a StreamBase Client?
When a custom-written StreamBase client is not dequeueing tuples, is there a non-blocking way I can query my StreamBaseClient instance to determine if the node is down?
Resolution
Call StreamBaseClient.status().
- If it returns, the Streaming server is up.
- If you get a StreamBaseException, it is likely that the Streaming server is not up or accessible at the requested URL.
Note that the status() call makes a
synchronous XML-RPC call to the server, so do not use it often, but only when a problem is suspected. Also do not have 1000 clients all calling for status in a short period of time. Calling status() every second from under 20 clients is not expected to be a performance problem for the server.
Additional information: The
ServerClosedException is a subtype of
StreamBaseNetworkException which is a subtype of
StreamBaseException. A catch(StreamBaseException) expression is effective around an enqueue() call.
Issue/Introduction
Use StreamBaseClient.status() to check on connection status.
Feedback
thumb_up
Yes
thumb_down
No