org.springframework.integration.ip.tcp
Class SimpleTcpNetOutboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.ip.tcp.SimpleTcpNetOutboundGateway
- All Implemented Interfaces:
- org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, NamedComponent, MessageProducer, MessageHandler
public class SimpleTcpNetOutboundGateway
- extends AbstractReplyProducingMessageHandler
Simple TCP outbound gateway; delegates write to a TcpNetSendingMessageHandler
then blocks on read of same socket. Uses Socket
and the client
thread is dedicated to a request/response pair. No multiplexing of requests
over the outbound socket are supported. This class is thread safe in that
if multiple clients attempt to send a message, they will be blocked until
any existing request/response is processed.
- Since:
- 2.0
- Author:
- Gary Russell
Fields inherited from interface org.springframework.core.Ordered |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary |
SimpleTcpNetOutboundGateway(java.lang.String host,
int port)
Constructs a SimpleTcpNetOutboundGateway that sends data to the
specified host and port, and waits for a response. |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getComponentType, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
handler
protected TcpNetSendingMessageHandler handler
customSocketReaderClass
protected java.lang.Class<NetSocketReader> customSocketReaderClass
messageFormat
protected int messageFormat
maxMessageSize
protected int maxMessageSize
soReceiveBufferSize
protected int soReceiveBufferSize
reader
protected NetSocketReader reader
SimpleTcpNetOutboundGateway
public SimpleTcpNetOutboundGateway(java.lang.String host,
int port)
- Constructs a SimpleTcpNetOutboundGateway that sends data to the
specified host and port, and waits for a response.
- Parameters:
host
- The host.port
- The port.
handleRequestMessage
protected java.lang.Object handleRequestMessage(Message<?> requestMessage)
- Synchronized to prevent multiplexing requests over the same socket.
- Specified by:
handleRequestMessage
in class AbstractReplyProducingMessageHandler
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
- Parameters:
obj
-
- Returns:
- See Also:
Object.equals(java.lang.Object)
getPort
public int getPort()
- Returns:
- See Also:
AbstractInternetProtocolSendingMessageHandler.getPort()
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
- Returns:
- See Also:
Object.hashCode()
setCustomSocketWriterClassName
public void setCustomSocketWriterClassName(java.lang.String customSocketWriterClassName)
throws java.lang.ClassNotFoundException
- Parameters:
customSocketWriterClassName
-
- Throws:
java.lang.ClassNotFoundException
- See Also:
TcpNetSendingMessageHandler.setCustomSocketWriterClassName(java.lang.String)
setMessageFormat
public void setMessageFormat(int messageFormat)
- Parameters:
messageFormat
- - See Also:
AbstractTcpSendingMessageHandler.setMessageFormat(int)
setSoKeepAlive
public void setSoKeepAlive(boolean soKeepAlive)
- Parameters:
soKeepAlive
- - See Also:
AbstractTcpSendingMessageHandler.setSoKeepAlive(boolean)
setSoLinger
public void setSoLinger(int soLinger)
- Parameters:
soLinger
- - See Also:
AbstractTcpSendingMessageHandler.setSoLinger(int)
setSoReceiveBufferSize
public void setSoReceiveBufferSize(int size)
- Parameters:
size
- - See Also:
AbstractInternetProtocolSendingMessageHandler.setSoReceiveBufferSize(int)
setSoSendBufferSize
public void setSoSendBufferSize(int size)
- Parameters:
size
- - See Also:
AbstractInternetProtocolSendingMessageHandler.setSoSendBufferSize(int)
setSoTcpNoDelay
public void setSoTcpNoDelay(boolean soTcpNoDelay)
- Parameters:
soTcpNoDelay
- - See Also:
AbstractTcpSendingMessageHandler.setSoTcpNoDelay(boolean)
setSoTimeout
public void setSoTimeout(int timeout)
- Parameters:
timeout
- - See Also:
AbstractInternetProtocolSendingMessageHandler.setSoTimeout(int)
setSoTrafficClass
public void setSoTrafficClass(int soTrafficClass)
- Parameters:
soTrafficClass
- - See Also:
AbstractTcpSendingMessageHandler.setSoTrafficClass(int)
setCustomSocketReaderClassName
public void setCustomSocketReaderClassName(java.lang.String customSocketReaderClassName)
throws java.lang.ClassNotFoundException
- Parameters:
customSocketReaderClass
- the customSocketReader to set
- Throws:
java.lang.ClassNotFoundException
setReplyChannel
public void setReplyChannel(MessageChannel replyChannel)
- Specify the Spring Integration reply channel. If this property is not
set the gateway will check for a 'replyChannel' header on the request.