public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler implements TcpSender, TcpListener, ManageableLifecycle
Lifecycle
methods delegate to the underlying AbstractConnectionFactory
.
AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
messagingTemplate
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
TcpOutboundGateway() |
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 |
doInit() |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected AbstractConnectionFactory |
getConnectionFactory() |
protected Object |
handleRequestMessage(Message<?> requestMessage)
Subclasses must implement this method to handle the request Message.
|
boolean |
isRunning() |
boolean |
onMessage(Message<?> message)
Called by a TCPConnection when a new message arrives.
|
void |
removeDeadConnection(TcpConnection connection)
When we are using sockets owned by a
TcpListener , this
method is called each time a connection is closed. |
void |
setCloseStreamAfterSend(boolean closeStreamAfterSend)
Set to true to close the connection ouput stream after sending without
closing the connection.
|
void |
setConnectionFactory(AbstractClientConnectionFactory connectionFactory) |
void |
setIntegrationEvaluationContext(EvaluationContext evaluationContext) |
void |
setRemoteTimeout(long remoteTimeout) |
void |
setRemoteTimeoutExpression(Expression remoteTimeoutExpression) |
void |
setReplyChannel(MessageChannel replyChannel)
Specify the Spring Integration reply channel.
|
void |
setReplyChannelName(String replyChannel)
Specify the Spring Integration reply channel name.
|
void |
setRequestTimeout(long requestTimeout) |
void |
setSecondChanceDelay(int secondChanceDelay)
When using NIO and the server closes the socket after sending the reply,
an error message representing the close may appear before the reply.
|
void |
setUnsolicitedMessageChannel(MessageChannel unsolicitedMessageChannel)
Set the channel for unsolicited incoming messages, or late replies.
|
void |
setUnsolicitedMessageChannelName(String unsolicitedMessageChannelName)
Set the channel name for unsolicited incoming messages, or late replies.
|
void |
start() |
void |
stop() |
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public void setConnectionFactory(AbstractClientConnectionFactory connectionFactory)
public void setRequestTimeout(long requestTimeout)
requestTimeout
- the requestTimeout to setpublic void setRemoteTimeout(long remoteTimeout)
remoteTimeout
- the remoteTimeout to setpublic void setRemoteTimeoutExpression(Expression remoteTimeoutExpression)
remoteTimeoutExpression
- the remoteTimeoutExpression to setpublic void setIntegrationEvaluationContext(EvaluationContext evaluationContext)
public void setReplyChannel(MessageChannel replyChannel)
replyChannel
- The reply channel.public void setReplyChannelName(String replyChannel)
replyChannel
- The reply channel.public void setUnsolicitedMessageChannelName(String unsolicitedMessageChannelName)
unsolicitedMessageChannelName
- the channel name.public void setUnsolicitedMessageChannel(MessageChannel unsolicitedMessageChannel)
unsolicitedMessageChannel
- the channel.public void setCloseStreamAfterSend(boolean closeStreamAfterSend)
ByteArrayRawSerializer
.
Requires a single-use connection factory.closeStreamAfterSend
- true to close.public void setSecondChanceDelay(int secondChanceDelay)
ErrorMessage
is
received. Default 2 seconds.secondChanceDelay
- the delay.public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
protected void doInit()
doInit
in class AbstractReplyProducingMessageHandler
protected Object handleRequestMessage(Message<?> requestMessage)
AbstractReplyProducingMessageHandler
handleRequestMessage
in class AbstractReplyProducingMessageHandler
requestMessage
- The request message.null
.public boolean onMessage(Message<?> message)
TcpListener
onMessage
in interface TcpListener
message
- The message.public 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 void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
protected AbstractConnectionFactory getConnectionFactory()