public class TcpSendingMessageHandler extends AbstractMessageHandler implements TcpSender, org.springframework.context.Lifecycle, ClientModeCapable
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
lifecycleMonitor |
logger
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 void |
doWrite(Message<?> message)
Method that actually does the write.
|
protected ConnectionFactory |
getClientConnectionFactory() |
java.lang.String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected java.util.Map<java.lang.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 |
setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler) |
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
getOrder, handleMessage, setOrder, setShouldTrack
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
protected TcpConnection obtainConnection(Message<?> message)
public void handleMessageInternal(Message<?> message) throws MessageHandlingException
handleMessageInternal
in class AbstractMessageHandler
MessageHandlingException
MessageHandler.handleMessage(org.springframework.integration.Message)
protected void 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 java.lang.String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageHandler
protected void onInit() throws java.lang.Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
java.lang.Exception
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public void stop(java.lang.Runnable callback)
protected ConnectionFactory getClientConnectionFactory()
protected ConnectionFactory getServerConnectionFactory()
protected java.util.Map<java.lang.String,TcpConnection> getConnections()
public boolean isClientMode()
isClientMode
in interface ClientModeCapable
public void setClientMode(boolean isClientMode)
isClientMode
- the isClientMode to setpublic void setTaskScheduler(org.springframework.scheduling.TaskScheduler taskScheduler)
setTaskScheduler
in class IntegrationObjectSupport
public 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