|
Spring Integration | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory
org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory
org.springframework.integration.ip.tcp.connection.FailoverClientConnectionFactory
public class FailoverClientConnectionFactory
Given a list of connection factories, serves up TcpConnections
that can iterate over a connection from each factory until the write
succeeds or the list is exhausted.
| Field Summary |
|---|
| Fields inherited from class org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory |
|---|
DEFAULT_REPLY_TIMEOUT, lifecycleMonitor |
| Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
FailoverClientConnectionFactory(java.util.List<AbstractClientConnectionFactory> factories)
|
|
| Method Summary | |
|---|---|
void |
close()
Closes the server. |
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. |
| Methods inherited from class org.springframework.integration.ip.tcp.connection.AbstractClientConnectionFactory |
|---|
forceClose, getConnection, getTheConnection, initializeConnection, setTheConnection |
| Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
|---|
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FailoverClientConnectionFactory(java.util.List<AbstractClientConnectionFactory> factories)
| Method Detail |
|---|
protected void onInit()
throws java.lang.Exception
IntegrationObjectSupport
onInit in class IntegrationObjectSupportjava.lang.Exceptionpublic 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)
AbstractConnectionFactory
registerSender in class AbstractConnectionFactorysender - The sender
protected TcpConnectionSupport obtainConnection()
throws java.lang.Exception
obtainConnection in class AbstractClientConnectionFactoryjava.lang.Exceptionpublic void close()
AbstractConnectionFactory
close in class AbstractConnectionFactorypublic void start()
start in interface org.springframework.context.Lifecyclestart in class AbstractConnectionFactorypublic void stop()
AbstractConnectionFactory
stop in interface org.springframework.context.Lifecyclestop in class AbstractConnectionFactorypublic boolean isRunning()
isRunning in interface org.springframework.context.LifecycleisRunning in class AbstractConnectionFactory
|
Spring Integration | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||