|
Spring Integration | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.context.IntegrationObjectSupport org.springframework.integration.handler.AbstractMessageHandler org.springframework.integration.ip.tcp.TcpSendingMessageHandler
public class TcpSendingMessageHandler
Tcp outbound channel adapter using a TcpConnection to send data - if the connection factory is a server factory, the TcpListener owns the connections. If it is a client factory, this object owns the connection.
Field Summary | |
---|---|
protected java.lang.Object |
lifecycleMonitor
|
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
logger |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
TcpSendingMessageHandler()
|
Method Summary | |
---|---|
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 TcpConnection |
getConnection()
|
protected java.util.Map<java.lang.String,TcpConnection> |
getConnections()
|
int |
getPhase()
|
long |
getRetryInterval()
|
protected org.springframework.scheduling.TaskScheduler |
getScheduler()
|
protected ConnectionFactory |
getServerConnectionFactory()
|
void |
handleMessageInternal(Message<?> message)
Writes the message payload to the underlying socket, using the specified message format. |
boolean |
isAutoStartup()
|
boolean |
isClientMode()
|
boolean |
isClientModeConnected()
|
boolean |
isRunning()
|
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 |
setAutoStartup(boolean autoStartup)
|
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 |
setPhase(int phase)
|
void |
setRetryInterval(long retryInterval)
|
void |
setScheduler(org.springframework.scheduling.TaskScheduler scheduler)
|
void |
start()
|
void |
stop()
|
void |
stop(java.lang.Runnable callback)
|
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler |
---|
getOrder, handleMessage, setOrder, setShouldTrack |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
---|
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.springframework.integration.context.NamedComponent |
---|
getComponentName |
Field Detail |
---|
protected final java.lang.Object lifecycleMonitor
Constructor Detail |
---|
public TcpSendingMessageHandler()
Method Detail |
---|
protected TcpConnection getConnection()
public void handleMessageInternal(Message<?> message) throws MessageRejectedException, MessageHandlingException, MessageDeliveryException
handleMessageInternal
in class AbstractMessageHandler
MessageRejectedException
MessageHandlingException
MessageDeliveryException
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 int getPhase()
getPhase
in interface org.springframework.context.Phased
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(java.lang.Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public void setAutoStartup(boolean autoStartup)
public void setPhase(int phase)
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 setprotected org.springframework.scheduling.TaskScheduler getScheduler()
public void setScheduler(org.springframework.scheduling.TaskScheduler scheduler)
scheduler
- the scheduler 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
|
Spring Integration | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |