public class TcpInboundGateway extends MessagingGatewaySupport implements TcpListener, TcpSender, ClientModeCapable, OrderlyShutdownCapable
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.messagingTemplatelifecycleCondition, lifecycleLockEXPRESSION_PARSER, logger| Constructor and Description |
|---|
TcpInboundGateway() |
| Modifier and Type | Method and Description |
|---|---|
void |
addNewConnection(TcpConnection connection)
When we are using sockets owned by a
TcpListener, this
method is called each time a new connection is made. |
int |
afterShutdown()
Called after normal shutdown of schedulers, executors etc,
and after the shutdown delay has elapsed, but before any
forced shutdown of any remaining active scheduler/executor
threads.Can optionally return the number of active messages
still in process.
|
int |
beforeShutdown()
Called before shutdown begins.
|
protected void |
doStart()
Subclasses must implement this method with the start behavior.
|
protected void |
doStop()
Subclasses must implement this method with the stop behavior.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
long |
getRetryInterval() |
boolean |
isClientMode() |
boolean |
isClientModeConnected() |
boolean |
isListening() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
boolean |
onMessage(Message<?> message)
Called by a TCPConnection when a new message arrives.
|
void |
removeDeadConnection(TcpConnection connection)
When we are using sockets owned by a
TcpListener, this
method is called each time a connection is closed. |
void |
retryConnection()
Immediately attempt to establish the connection.
|
void |
setClientMode(boolean isClientMode) |
void |
setConnectionFactory(AbstractConnectionFactory connectionFactory)
|
void |
setRetryInterval(long retryInterval) |
buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getManagedName, getManagedType, getMessageCount, getMessageCountLong, getReplyChannel, getRequestChannel, isCountsEnabled, isLoggingEnabled, receive, receiveMessage, reset, send, sendAndReceive, sendAndReceiveMessage, setCountsEnabled, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdoStop, getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stopafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNamepublic boolean onMessage(Message<?> message)
TcpListeneronMessage in interface TcpListenermessage - The message.public boolean isListening()
public void setConnectionFactory(AbstractConnectionFactory connectionFactory)
connectionFactory - the Connection Factorypublic void addNewConnection(TcpConnection connection)
TcpSenderTcpListener, this
method is called each time a new connection is made.addNewConnection in interface TcpSenderconnection - The connection.public void removeDeadConnection(TcpConnection connection)
TcpSenderTcpListener, this
method is called each time a connection is closed.removeDeadConnection in interface TcpSenderconnection - The connection.public String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class MessagingGatewaySupportprotected void onInit()
throws Exception
IntegrationObjectSupportonInit in class MessagingGatewaySupportException - Any exception.protected void doStart()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStart in class MessagingGatewaySupportprotected void doStop()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStop in class MessagingGatewaySupportpublic boolean isClientMode()
isClientMode in interface ClientModeCapablepublic void setClientMode(boolean isClientMode)
isClientMode - the isClientMode to setpublic long getRetryInterval()
public void setRetryInterval(long retryInterval)
retryInterval - the retryInterval to setpublic boolean isClientModeConnected()
isClientModeConnected in interface ClientModeCapablepublic void retryConnection()
ClientModeCapableretryConnection in interface ClientModeCapablepublic int beforeShutdown()
OrderlyShutdownCapablebeforeShutdown in interface OrderlyShutdownCapablepublic int afterShutdown()
OrderlyShutdownCapableafterShutdown in interface OrderlyShutdownCapable