Package com.streambase.sb.client
Class TupleConnections
java.lang.Object
com.streambase.sb.client.TupleConnections
Tuple connections
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classattempt to reconnect the TupleConnections(package private) classStream tuple connection -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddConnection(StreamBaseURI uri, StreamProperties props) Add a connectionvoidAdd connection status callback(package private) voidclose()Close all connectionsvoidEnable hearbeat(package private) voidenqueueTupleBuffer(StreamBaseClient.SerializedTupleBuffer buffer, boolean hasMore) Private version of enqueue that does all of the work.(package private) intGet number of connections(package private) List<TupleConnections.StreamTupleConnection>getConnections(StreamProperties props) Return an unmodifiable list of List<StreamConnection>booleanReturns true if this TupleConnections has any live connections to a server.voidRemove connection callback statusvoidsetQuiescentLimit(long timeoutMS) Set connection timeout(package private) voidtupleConnectionConnected(com.streambase.sb.client.TupleConnection conn) Fire connected notifier(package private) voidtupleConnectionDisconnected(com.streambase.sb.client.TupleConnection conn, String reason) Fire disconnected notifier
-
Constructor Details
-
TupleConnections
TupleConnections(StreamBaseClient client, boolean haModeOn) Constructor- Parameters:
client- ClienthaModeOn- true if HA enabled, false otherwise
-
-
Method Details
-
addConnection
Add a connection- Parameters:
uri- URIprops- Stream properties- Throws:
StreamBaseException- Error adding connection
-
close
void close()Close all connections -
isConnected
public boolean isConnected()Returns true if this TupleConnections has any live connections to a server. Note that a return of "false" doesn't necessarily indicate an error since the TupleConnection's state (e.g., lack of subscriptions) might mean no connections are needed.- Returns:
- true if connected, false otherwise
-
getConnections
List<TupleConnections.StreamTupleConnection> getConnections(StreamProperties props) throws StreamBaseException Return an unmodifiable list of List<StreamConnection>- Parameters:
props- Stream properties- Returns:
- return an unmodifiable list of List<StreamConnection>
- Throws:
StreamBaseException- error getting connections
-
tupleConnectionConnected
void tupleConnectionConnected(com.streambase.sb.client.TupleConnection conn) Fire connected notifier- Parameters:
conn- Connection
-
tupleConnectionDisconnected
Fire disconnected notifier- Parameters:
conn- Connectionreason- Disconnect reason
-
getConnectionCount
int getConnectionCount()Get number of connections- Returns:
- Connection count
-
enableHeartbeating
public void enableHeartbeating()Enable hearbeat -
setQuiescentLimit
Set connection timeout- Parameters:
timeoutMS- Timeout in milliseconds- Throws:
StreamBaseException- Error setting timeout
-
addConnectionStatusCallback
Add connection status callback- Parameters:
callback- Callback
-
removeConnectionStatusCallback
Remove connection callback status- Parameters:
callback- Callback
-
enqueueTupleBuffer
void enqueueTupleBuffer(StreamBaseClient.SerializedTupleBuffer buffer, boolean hasMore) throws StreamBaseException Private version of enqueue that does all of the work. Enqueue a collection of Tuples onto a stream. All tuples must be for the same stream- Parameters:
buffer- Tuple bufferhasMore- true if more tuples, false otherwise- Throws:
StreamBaseException- thrown on network or other errors
-