Package org.openwms.common.comm.tcp
Class ConnectionHolder
java.lang.Object
org.openwms.common.comm.tcp.ConnectionHolder
A ConnectionHolder keeps track of established connections per ConnectionFactory. It listens on events whenever a new Connection is opened
and stores the ConnectionId that can be used as header argument in outbound messages.
- Author:
- Heiko Scherrer
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConnectionHolder
(List<org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory> factories) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptiongetConnectionId
(String connectionFactoryName) Return the current active connectionId for the ConnectionFactory given by theconnectionFactoryName
.void
onClosedMessage
(org.springframework.integration.ip.tcp.connection.TcpConnectionCloseEvent event) On anTcpConnectionCloseEvent
we try to remove the existing assignment.void
onFailedConnectionMessage
(org.springframework.integration.ip.tcp.connection.TcpConnectionExceptionEvent event) On anTcpConnectionCloseEvent
we try to remove the existing assignment.void
onFailedMessage
(org.springframework.integration.ip.tcp.connection.TcpConnectionFailedEvent event) On anTcpConnectionCloseEvent
we try to remove the existing assignment.void
onOpenMessage
(org.springframework.integration.ip.tcp.connection.TcpConnectionOpenEvent event) On anTcpConnectionOpenEvent
we store the connectionId along with the name of the ConnectionFactory.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
connectionIds
-
factories
-
-
Constructor Details
-
ConnectionHolder
@Deprecated public ConnectionHolder(@Autowired(required=false) List<org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory> factories) Deprecated.
-
-
Method Details
-
onOpenMessage
@EventListener public void onOpenMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionOpenEvent event) On anTcpConnectionOpenEvent
we store the connectionId along with the name of the ConnectionFactory.- Parameters:
event
- The event
-
onClosedMessage
@EventListener public void onClosedMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionCloseEvent event) On anTcpConnectionCloseEvent
we try to remove the existing assignment.- Parameters:
event
- The event
-
onFailedMessage
@EventListener public void onFailedMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionFailedEvent event) On anTcpConnectionCloseEvent
we try to remove the existing assignment.- Parameters:
event
- The event
-
onFailedConnectionMessage
@EventListener public void onFailedConnectionMessage(org.springframework.integration.ip.tcp.connection.TcpConnectionExceptionEvent event) On anTcpConnectionCloseEvent
we try to remove the existing assignment.- Parameters:
event
- The event
-
getConnectionId
Return the current active connectionId for the ConnectionFactory given by theconnectionFactoryName
.- Parameters:
connectionFactoryName
- Name of the ConnectionFactory- Returns:
- The connectionId of the active Connection
-