Package com.seeq.link.agent
Class DefaultSeeqWsConnectionPool
java.lang.Object
com.seeq.link.sdk.BaseConnection
com.seeq.link.agent.DefaultSeeqWsConnectionPool
- All Implemented Interfaces:
SeeqWsConnection
,SeeqWsConnectionPool
,com.seeq.link.sdk.interfaces.Connection
public class DefaultSeeqWsConnectionPool
extends com.seeq.link.sdk.BaseConnection
implements SeeqWsConnectionPool
Handles a pool of WebSocket-based connections to the Seeq Application Server.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.seeq.link.sdk.interfaces.Connection
com.seeq.link.sdk.interfaces.Connection.ConnectionState, com.seeq.link.sdk.interfaces.Connection.StateChangedEventArgs
Nested classes/interfaces inherited from interface com.seeq.link.agent.interfaces.SeeqWsConnection
SeeqWsConnection.MessageReceivedEventArgs
-
Field Summary
FieldsFields inherited from class com.seeq.link.sdk.BaseConnection
lastException
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSeeqWsConnectionPool
(String linkURL, LoginAuthManager loginAuthManager, CertificateHandler certHandler, boolean isRemoteAgent, String agentIdentification, com.seeq.link.sdk.interfaces.SeeqApiProvider apiProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
connect()
void
destroy()
protected void
protected String
com.seeq.link.sdk.utilities.Event<SeeqWsConnection.MessageReceivedEventArgs>
Event to handle the reception of messages from the Seeq Application Server.void
protected void
monitor()
void
onWebSocketChangeState
(com.seeq.link.sdk.interfaces.Connection.ConnectionState newState) Handler called when a connection in the pool changed its state.void
onWebsocketMessageReceived
(Object sender, SeeqWsConnection.MessageReceivedEventArgs messageReceivedEventArgs) Handler called when a connection received a messageboolean
sendMessage
(byte[] message) Sends a set of bytes to the Seeq server.Methods inherited from class com.seeq.link.sdk.BaseConnection
disable, enable, getBackgroundThreads, getConnectionMessage, getLastException, getMaxReconnectDelay, getMinReconnectDelay, getMonitorPeriod, getState, getStateChangedEvent, handleConnectionMonitorException, setMaxReconnectDelay, setMinReconnectDelay, setMonitorPeriod, setState
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.seeq.link.sdk.interfaces.Connection
disable, enable, getConnectionMessage, getMaxReconnectDelay, getMinReconnectDelay, getMonitorPeriod, getState, getStateChangedEvent, setMaxReconnectDelay, setMinReconnectDelay, setMonitorPeriod
-
Field Details
-
INCOMING_MESSAGE_THREAD_POOL_SIZE
public static final int INCOMING_MESSAGE_THREAD_POOL_SIZE- See Also:
-
-
Constructor Details
-
DefaultSeeqWsConnectionPool
public DefaultSeeqWsConnectionPool(String linkURL, LoginAuthManager loginAuthManager, CertificateHandler certHandler, boolean isRemoteAgent, String agentIdentification, com.seeq.link.sdk.interfaces.SeeqApiProvider apiProvider)
-
-
Method Details
-
getConnectionId
- Specified by:
getConnectionId
in classcom.seeq.link.sdk.BaseConnection
-
initialize
public void initialize()- Specified by:
initialize
in interfacecom.seeq.link.sdk.interfaces.Connection
- Specified by:
initialize
in classcom.seeq.link.sdk.BaseConnection
-
connect
protected void connect()- Specified by:
connect
in classcom.seeq.link.sdk.BaseConnection
-
onWebsocketMessageReceived
public void onWebsocketMessageReceived(Object sender, SeeqWsConnection.MessageReceivedEventArgs messageReceivedEventArgs) Description copied from interface:SeeqWsConnectionPool
Handler called when a connection received a message- Specified by:
onWebsocketMessageReceived
in interfaceSeeqWsConnectionPool
- Parameters:
sender
- The sender of the eventmessageReceivedEventArgs
- The message received
-
monitor
protected void monitor()- Specified by:
monitor
in classcom.seeq.link.sdk.BaseConnection
-
disconnect
protected void disconnect()- Specified by:
disconnect
in classcom.seeq.link.sdk.BaseConnection
-
destroy
public void destroy()- Specified by:
destroy
in interfacecom.seeq.link.sdk.interfaces.Connection
- Specified by:
destroy
in classcom.seeq.link.sdk.BaseConnection
-
sendMessage
public boolean sendMessage(byte[] message) Description copied from interface:SeeqWsConnection
Sends a set of bytes to the Seeq server.- Specified by:
sendMessage
in interfaceSeeqWsConnection
- Parameters:
message
- The set of bytes to be sent- Returns:
- True if message was sent successfully
-
getMessageReceivedEvent
public com.seeq.link.sdk.utilities.Event<SeeqWsConnection.MessageReceivedEventArgs> getMessageReceivedEvent()Description copied from interface:SeeqWsConnection
Event to handle the reception of messages from the Seeq Application Server.- Specified by:
getMessageReceivedEvent
in interfaceSeeqWsConnection
- Returns:
- the agent message received event
-
onWebSocketChangeState
public void onWebSocketChangeState(com.seeq.link.sdk.interfaces.Connection.ConnectionState newState) Description copied from interface:SeeqWsConnectionPool
Handler called when a connection in the pool changed its state.- Specified by:
onWebSocketChangeState
in interfaceSeeqWsConnectionPool
- Parameters:
newState
- - new state of the connection
-