public class TcpSendingMessageHandler extends AbstractMessageHandler implements TcpSender, ManageableLifecycle, ClientModeCapable
IntegrationManagement.ManagementOverrides| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_RETRY_INTERVAL
A default retry interval for the
ClientModeConnectionManager rescheduling. |
protected Object |
lifecycleMonitor |
EXPRESSION_PARSER, loggerHIGHEST_PRECEDENCE, LOWEST_PRECEDENCEMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME| Constructor and Description |
|---|
TcpSendingMessageHandler() |
| 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. |
protected TcpConnection |
doWrite(Message<?> message)
Method that actually does the write.
|
protected ConnectionFactory |
getClientConnectionFactory() |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected Map<String,TcpConnection> |
getConnections() |
long |
getRetryInterval() |
protected ConnectionFactory |
getServerConnectionFactory() |
void |
handleMessageInternal(Message<?> message)
Writes the message payload to the underlying socket, using the specified
message format.
|
boolean |
isClientMode() |
boolean |
isClientModeConnected() |
boolean |
isRunning() |
protected TcpConnection |
obtainConnection(Message<?> message) |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
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)
Sets the client or server connection factory; for this (an outbound adapter), if
the factory is a server connection factory, the sockets are owned by a receiving
channel adapter and this adapter is used to send replies.
|
void |
setRetryInterval(long retryInterval) |
void |
start() |
void |
stop() |
handleMessage, onComplete, onError, onNext, onSubscribebuildSendTimer, destroy, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackafterPropertiesSet, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetThisAsgetBeanName, getComponentNamepublic static final long DEFAULT_RETRY_INTERVAL
ClientModeConnectionManager rescheduling.protected final Object lifecycleMonitor
protected TcpConnection obtainConnection(Message<?> message)
public void handleMessageInternal(Message<?> message)
handleMessageInternal in class AbstractMessageHandlerMessageHandler.handleMessage(org.springframework.messaging.Message)protected TcpConnection doWrite(Message<?> message)
message - The message to write.public void setConnectionFactory(AbstractConnectionFactory connectionFactory)
connectionFactory - the connectionFactory to setpublic 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 MessageHandlerSupportprotected void onInit()
IntegrationObjectSupportonInit in class IntegrationObjectSupportpublic void start()
start in interface Lifecyclestart in interface ManageableLifecyclepublic void stop()
stop in interface Lifecyclestop in interface ManageableLifecyclepublic boolean isRunning()
isRunning in interface LifecycleisRunning in interface ManageableLifecycleprotected ConnectionFactory getClientConnectionFactory()
protected ConnectionFactory getServerConnectionFactory()
protected Map<String,TcpConnection> getConnections()
public 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 ClientModeCapable