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, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_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, onSubscribe
buildSendTimer, destroy, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
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
ClientModeConnectionManager
rescheduling.protected final Object lifecycleMonitor
protected TcpConnection obtainConnection(Message<?> message)
public void handleMessageInternal(Message<?> message)
handleMessageInternal
in class AbstractMessageHandler
MessageHandler.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)
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 MessageHandlerSupport
protected void onInit()
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
public void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
protected ConnectionFactory getClientConnectionFactory()
protected ConnectionFactory getServerConnectionFactory()
protected Map<String,TcpConnection> getConnections()
public boolean isClientMode()
isClientMode
in interface ClientModeCapable
public 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 ClientModeCapable
public void retryConnection()
ClientModeCapable
retryConnection
in interface ClientModeCapable