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.IntegrationManagement.ManagementOverrides
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_RETRY_INTERVAL
A default retry interval in milliseconds - 60000L.
|
messagingTemplate
lifecycleCondition, lifecycleLock
EXPRESSION_PARSER, logger
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
DEFAULT_PHASE
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)
Configure a retry interval.
|
buildErrorMessage, buildSendTimer, destroy, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrack
doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public static final long DEFAULT_RETRY_INTERVAL
public boolean onMessage(Message<?> message)
TcpListener
onMessage
in interface TcpListener
message
- The message.public boolean isListening()
public void setConnectionFactory(AbstractConnectionFactory connectionFactory)
connectionFactory
- the Connection Factorypublic void addNewConnection(TcpConnection connection)
TcpSender
TcpListener
, this
method is called each time a new connection is made.addNewConnection
in interface TcpSender
connection
- The connection.public void removeDeadConnection(TcpConnection connection)
TcpSender
TcpListener
, this
method is called each time a connection is closed.removeDeadConnection
in interface TcpSender
connection
- The connection.public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessagingGatewaySupport
protected void onInit()
IntegrationObjectSupport
onInit
in class MessagingGatewaySupport
protected void doStart()
AbstractEndpoint
AbstractEndpoint.lifecycleLock
.doStart
in class MessagingGatewaySupport
protected void doStop()
AbstractEndpoint
AbstractEndpoint.lifecycleLock
.doStop
in class MessagingGatewaySupport
public boolean isClientMode()
isClientMode
in interface ClientModeCapable
public void setClientMode(boolean isClientMode)
isClientMode
- the isClientMode to setpublic long getRetryInterval()
public void setRetryInterval(long retryInterval)
DEFAULT_RETRY_INTERVAL
.retryInterval
- the retryInterval to setpublic boolean isClientModeConnected()
isClientModeConnected
in interface ClientModeCapable
public void retryConnection()
ClientModeCapable
retryConnection
in interface ClientModeCapable
public int beforeShutdown()
OrderlyShutdownCapable
beforeShutdown
in interface OrderlyShutdownCapable
public int afterShutdown()
OrderlyShutdownCapable
afterShutdown
in interface OrderlyShutdownCapable