org.springframework.integration.ip.tcp
Class TcpOutboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.ip.tcp.TcpOutboundGateway
- All Implemented Interfaces:
- BeanFactoryAware, BeanNameAware, InitializingBean, Ordered, NamedComponent, MessageHandler, MessageProducer, TrackableComponent, TcpListener, TcpSender
public class TcpOutboundGateway
- extends AbstractReplyProducingMessageHandler
- implements TcpSender, TcpListener
TCP outbound gateway that uses a client connection factory. If the factory is configured
for single-use connections, each request is sent on a new connection; if the factory does not use
single use connections, each request is blocked until the previous response is received
(or times out). Asynchronous requests/responses over the same connection are not
supported - use a pair of outbound/inbound adapters for that use case.
- Since:
- 2.0
- Author:
- Gary Russell
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getRequiredMetadataPersister, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
connectionFactory
protected AbstractConnectionFactory connectionFactory
TcpOutboundGateway
public TcpOutboundGateway()
handleRequestMessage
protected Object handleRequestMessage(Message<?> requestMessage)
- Description copied from class:
AbstractReplyProducingMessageHandler
- Subclasses must implement this method to handle the request Message. The return
value may be a Message, a MessageBuilder, or any plain Object. The base class
will handle the final creation of a reply Message from any of those starting
points. If the return value is null, the Message flow will end here.
- Specified by:
handleRequestMessage
in class AbstractReplyProducingMessageHandler
onMessage
public boolean onMessage(Message<?> message)
- Description copied from interface:
TcpListener
- Called by a TCPConnection when a new message arrives.
- Specified by:
onMessage
in interface TcpListener
- Parameters:
message
- The message.
- Returns:
- true if the message was intercepted
isListening
public boolean isListening()
setConnectionFactory
public void setConnectionFactory(AbstractConnectionFactory connectionFactory)
addNewConnection
public void addNewConnection(TcpConnection connection)
- Description copied from interface:
TcpSender
- When we are using sockets owned by a
TcpListener
, this
method is called each time a new connection is made.
- Specified by:
addNewConnection
in interface TcpSender
- Parameters:
connection
- The connection.
removeDeadConnection
public void removeDeadConnection(TcpConnection connection)
- Description copied from interface:
TcpSender
- When we are using sockets owned by a
TcpListener
, this
method is called each time a connection is closed.
- Specified by:
removeDeadConnection
in interface TcpSender
- Parameters:
connection
- The connection.
setReplyTimeout
public void setReplyTimeout(long timeout)
- Parameters:
replyTimeout
- the replyTimeout to set
setRequestTimeout
public void setRequestTimeout(long requestTimeout)
- Parameters:
requestTimeout
- the requestTimeout to set
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.
Copyright © 2010. All Rights Reserved.