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:
- BeanFactoryAware, BeanNameAware, InitializingBean, Ordered, MessageHandler, MessageProducer, NamedComponent
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
Constructor Summary |
SimpleTcpNetOutboundGateway(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, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString, writeMessageHistory |
handler
protected TcpNetSendingMessageHandler handler
customSocketReaderClass
protected Class<NetSocketReader> customSocketReaderClass
messageFormat
protected int messageFormat
maxMessageSize
protected int maxMessageSize
soReceiveBufferSize
protected int soReceiveBufferSize
reader
protected NetSocketReader reader
close
protected boolean close
SimpleTcpNetOutboundGateway
public SimpleTcpNetOutboundGateway(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 Object handleRequestMessage(Message<?> requestMessage)
- Synchronized to prevent multiplexing requests over the same socket.
- Specified by:
handleRequestMessage
in class AbstractReplyProducingMessageHandler
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
- Returns:
- whether the MessageHandler delegate for this Gateway is equal to the provided object
- See Also:
Object.equals(Object)
getPort
public int getPort()
- Returns:
- the port number of the MessageHandler delegate for this Gateway
- See Also:
AbstractInternetProtocolSendingMessageHandler.getPort()
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
- Returns:
- hashcode value of the MessageHandler delegate for this Gateway
- See Also:
Object.hashCode()
setCustomSocketWriterClassName
public void setCustomSocketWriterClassName(String customSocketWriterClassName)
throws ClassNotFoundException
- Parameters:
customSocketWriterClassName
-
- Throws:
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(String customSocketReaderClassName)
throws ClassNotFoundException
- Parameters:
customSocketReaderClassName
- the NetSocketReader
class to use
- Throws:
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.
setClose
public void setClose(boolean close)
- Parameters:
close
- the close to set
Copyright © 2010. All Rights Reserved.