public class FailoverClientConnectionFactory extends AbstractClientConnectionFactory
TcpConnections
that can iterate over a connection from each factory until the write
succeeds or the list is exhausted.DEFAULT_REPLY_TIMEOUT, lifecycleMonitorEXPRESSION_PARSER, logger| Constructor and Description |
|---|
FailoverClientConnectionFactory(List<AbstractClientConnectionFactory> factories) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isRunning()
Returns true if all factories are running
|
protected TcpConnectionSupport |
obtainConnection() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
registerListener(TcpListener listener)
Delegate TCP Client Connection factories that are used to receive
data need a Listener to send the messages to.
|
void |
registerSender(TcpSender sender)
Registers a TcpSender; for server sockets, used to
provide connection information so a sender can be used
to reply to incoming messages.
|
void |
start() |
void |
stop()
Stops the server.
|
buildNewConnection, enableManualListenerRegistration, forceClose, getConnection, getTheConnection, initializeConnection, obtainNewConnection, obtainSharedConnection, setTheConnectionaddConnection, checkActive, closeConnection, delayRead, doAccept, getApplicationEventPublisher, getDelayedReads, getDeserializer, getHost, getListener, getMapper, getOpenConnectionIds, getPort, getReadDelay, getSender, getSerializer, getSoLinger, getSoReceiveBufferSize, getSoSendBufferSize, getSoTimeout, getSoTrafficClass, getSslHandshakeTimeout, getTaskExecutor, getTcpSocketSupport, harvestClosedConnections, isActive, isLookupHost, isSingleUse, isSoKeepAlive, isSoTcpNoDelay, processNioSelections, setActive, setApplicationEventPublisher, setDeserializer, setHost, setInterceptorFactoryChain, setLeaveOpen, setLookupHost, setMapper, setNioHarvestInterval, setPort, setReadDelay, setSerializer, setSingleUse, setSocketAttributes, setSoKeepAlive, setSoLinger, setSoReceiveBufferSize, setSoSendBufferSize, setSoTcpNoDelay, setSoTimeout, setSoTrafficClass, setSslHandshakeTimeout, setTaskExecutor, setTcpSocketSupport, toString, wrapConnectionafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getComponentType, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskSchedulerpublic FailoverClientConnectionFactory(List<AbstractClientConnectionFactory> factories)
protected void onInit()
IntegrationObjectSupportonInit in class AbstractConnectionFactorypublic void registerListener(TcpListener listener)
During initialization, if a factory detects it has no listener it's listening logic (active thread) is terminated.
The listener registered with a factory is provided to each connection it creates so it can call the onMessage() method.
This code satisfies the first requirement in that this listener signals to the factory that it needs to run its listening logic.
When we wrap actual connections with FailoverTcpConnections, the connection is given the wrapper as a listener, so it can enhance the headers in onMessage(); the wrapper then invokes the real listener supplied here, with the modified message.
registerListener in class AbstractConnectionFactorylistener - the TcpListener.public void registerSender(TcpSender sender)
AbstractConnectionFactoryregisterSender in class AbstractConnectionFactorysender - The senderprotected TcpConnectionSupport obtainConnection() throws Exception
obtainConnection in class AbstractClientConnectionFactoryExceptionpublic void start()
start in interface Lifecyclestart in class AbstractConnectionFactorypublic void stop()
AbstractConnectionFactorystop in interface Lifecyclestop in class AbstractConnectionFactorypublic boolean isRunning()
isRunning in interface LifecycleisRunning in class AbstractConnectionFactory