Package com.streambase.sb.client
Class TupleConnections
java.lang.Object
com.streambase.sb.client.TupleConnections
Tuple connections
-
Nested Class Summary
Modifier and TypeClassDescription(package private) class
attempt to reconnect the TupleConnections(package private) class
Stream tuple connection -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) void
addConnection
(StreamBaseURI uri, StreamProperties props) Add a connectionvoid
Add connection status callback(package private) void
close()
Close all connectionsvoid
Enable hearbeat(package private) void
enqueueTupleBuffer
(StreamBaseClient.SerializedTupleBuffer buffer, boolean hasMore) Private version of enqueue that does all of the work.(package private) int
Get number of connections(package private) List<TupleConnections.StreamTupleConnection>
getConnections
(StreamProperties props) Return an unmodifiable list of List<StreamConnection>boolean
Returns true if this TupleConnections has any live connections to a server.void
Remove connection callback statusvoid
setQuiescentLimit
(long timeoutMS) Set connection timeout(package private) void
tupleConnectionConnected
(com.streambase.sb.client.TupleConnection conn) Fire connected notifier(package private) void
tupleConnectionDisconnected
(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
-