org.springframework.integration.ip.tcp
Class TcpInboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.ip.tcp.TcpInboundGateway
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, NamedComponent, TrackableComponent, TcpListener, TcpSender
public class TcpInboundGateway
- extends MessagingGatewaySupport
- implements TcpListener, TcpSender
Inbound Gateway using a server connection factory - threading is controlled by the
factory. For java.net connections, each socket can process only one message at a time.
For java.nio connections, messages may be multiplexed but the client will need to
provide correlation logic. If the client is a TcpOutboundGateway
multiplexing
is not used, but multiple concurrent connections can be used if the connection factory uses
single-use connections. For true asynchronous bi-directional communication, a pair of
inbound / outbound channel adapters should be used.
- Since:
- 2.0
Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupport |
doStart, doStop, onInit, receive, send, sendAndReceive, sendAndReceiveMessage, setErrorChannel, setReplyChannel, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestMapper, setRequestTimeout, setShouldTrack |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
connectionFactory
protected AbstractServerConnectionFactory connectionFactory
TcpInboundGateway
public TcpInboundGateway()
onMessage
public boolean onMessage(Message<?> message)
- Description copied from interface:
TcpListener
- Called by a TCPConnection when a new message arrives.
- Specified by:
onMessage
in interface TcpListener
- Parameters:
message
- The message.
- Returns:
- true if the message was intercepted
isListening
public boolean isListening()
- Returns:
- true if the associated connection factory is listening.
setConnectionFactory
public void setConnectionFactory(AbstractServerConnectionFactory connectionFactory)
- Parameters:
connectionFactory
- the Connection Factory
addNewConnection
public void addNewConnection(TcpConnection connection)
- Description copied from interface:
TcpSender
- When we are using sockets owned by a
TcpListener
, this
method is called each time a new connection is made.
- Specified by:
addNewConnection
in interface TcpSender
- Parameters:
connection
- The connection.
removeDeadConnection
public void removeDeadConnection(TcpConnection connection)
- Description copied from interface:
TcpSender
- When we are using sockets owned by a
TcpListener
, this
method is called each time a connection is closed.
- Specified by:
removeDeadConnection
in interface TcpSender
- Parameters:
connection
- The connection.
getComponentType
public java.lang.String getComponentType()
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this method to provide component type information.
- Specified by:
getComponentType
in interface NamedComponent
- Overrides:
getComponentType
in class MessagingGatewaySupport