com.streambase.sb.client

## Class TupleConnections

- java.lang.Object
- - com.streambase.sb.client.TupleConnections

-     class TupleConnections
      extends Object

  Tuple connections

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) class` | `TupleConnections.Reconnector` attempt to reconnect the TupleConnections
    `(package private) class` | `TupleConnections.StreamTupleConnection` Stream tuple connection

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TupleConnections(StreamBaseClient client, boolean haModeOn)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `addConnection(StreamBaseURI uri, StreamProperties props)` Add a connection
    `void` | `addConnectionStatusCallback(ConnectionStatusCallback callback)` Add connection status callback
    `(package private) void` | `close()` Close all connections
    `void` | `enableHeartbeating()` Enable hearbeat
    `(package private) void` | `enqueueTupleBuffer(StreamBaseClient.SerializedTupleBuffer buffer, boolean hasMore)` Private version of enqueue that does all of the work.
    `(package private) int` | `getConnectionCount()` Get number of connections
    `(package private) List<TupleConnections.StreamTupleConnection>` | `getConnections(StreamProperties props)` Return an unmodifiable list of List<StreamConnection>
    `boolean` | `isConnected()` Returns true if this TupleConnections has any live connections to a server.
    `(package private) void` | `processLeadershipStatusChange(TupleConnection connection, Constants.LeadershipStatus newStatus)` Process leadership status change
    `void` | `removeConnectionStatusCallback(ConnectionStatusCallback callback)` Remove connection callback status
    `void` | `setQuiescentLimit(long timeoutMS)` Set connection timeout
    `(package private) void` | `tupleConnectionConnected(TupleConnection conn)` Fire connected notifier
    `(package private) void` | `tupleConnectionDisconnected(TupleConnection conn, String reason)` Fire disconnected notifier

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TupleConnections

          TupleConnections(StreamBaseClient client,
                           boolean haModeOn)

      Constructor
      Parameters:
        `client` - Client
        `haModeOn` - true if HA enabled, false otherwise

  - ### Method Detail

    - #### addConnection

          void addConnection(StreamBaseURI uri,
                             StreamProperties props)
                      throws StreamBaseException

      Add a connection
      Parameters:
        `uri` - URI
        `props` - 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`

    - #### tupleConnectionConnected

          void tupleConnectionConnected(TupleConnection conn)

      Fire connected notifier
      Parameters:
        `conn` - Connection

    - #### tupleConnectionDisconnected

          void tupleConnectionDisconnected(TupleConnection conn,
                                           String reason)

      Fire disconnected notifier
      Parameters:
        `conn` - Connection
        `reason` - Disconnect reason

    - #### getConnectionCount

          int getConnectionCount()

      Get number of connections
      Returns:
        Connection count

    - #### enableHeartbeating

          public void enableHeartbeating()

      Enable hearbeat

    - #### setQuiescentLimit

          public void setQuiescentLimit(long timeoutMS)
                                 throws StreamBaseException

      Set connection timeout
      Parameters:
        `timeoutMS` - Timeout in milliseconds
      Throws:
        `StreamBaseException` - Error setting timeout

    - #### processLeadershipStatusChange

          void processLeadershipStatusChange(TupleConnection connection,
                                             Constants.LeadershipStatus newStatus)

      Process leadership status change
      Parameters:
        `connection` - Connection
        `newStatus` - New status

    - #### addConnectionStatusCallback

          public void addConnectionStatusCallback(ConnectionStatusCallback callback)

      Add connection status callback
      Parameters:
        `callback` - Callback

    - #### removeConnectionStatusCallback

          public void removeConnectionStatusCallback(ConnectionStatusCallback callback)

      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 buffer
        `hasMore` - true if more tuples, false otherwise
      Throws:
        `StreamBaseException` - thrown on network or other errors

Copyright © 2015–2018 Cloud Software Group, Inc.. All rights reserved.