org.springframework.integration.ip.tcp
Class TcpReceivingChannelAdapter

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.endpoint.MessageProducerSupport
              extended by org.springframework.integration.ip.tcp.TcpReceivingChannelAdapter
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.context.NamedComponent, org.springframework.integration.context.OrderlyShutdownCapable, org.springframework.integration.core.MessageProducer, org.springframework.integration.history.TrackableComponent, ClientModeCapable, TcpListener

public class TcpReceivingChannelAdapter
extends org.springframework.integration.endpoint.MessageProducerSupport
implements TcpListener, ClientModeCapable, org.springframework.integration.context.OrderlyShutdownCapable

Tcp inbound channel adapter using a TcpConnection to receive data - if the connection factory is a server factory, this Listener owns the connections. If it is a client factory, the sender owns the connection.

Since:
2.0

Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
TcpReceivingChannelAdapter()
           
 
Method Summary
 int afterShutdown()
           
 int beforeShutdown()
           
protected  void doStart()
           
protected  void doStop()
           
protected  ConnectionFactory getClientConnectionFactory()
           
 java.lang.String getComponentType()
           
 long getRetryInterval()
           
protected  ConnectionFactory getServerConnectionFactory()
           
 boolean isClientMode()
           
 boolean isClientModeConnected()
           
 boolean isListening()
           
protected  void onInit()
           
 boolean onMessage(org.springframework.integration.Message<?> message)
          Called by a TCPConnection when a new message arrives.
 void retryConnection()
          Immediately attempt to establish the connection.
 void setClientMode(boolean isClientMode)
           
 void setConnectionFactory(AbstractConnectionFactory connectionFactory)
          Sets the client or server connection factory; for this (an inbound adapter), if the factory is a client connection factory, the sockets are owned by a sending channel adapter and this adapter is used to receive replies.
 void setRetryInterval(long retryInterval)
           
 void setScheduler(org.springframework.scheduling.TaskScheduler scheduler)
          Deprecated. Use AbstractEndpoint.setTaskScheduler(TaskScheduler)
 
Methods inherited from class org.springframework.integration.endpoint.MessageProducerSupport
sendMessage, setErrorChannel, setOutputChannel, setSendTimeout, setShouldTrack
 
Methods inherited from class org.springframework.integration.endpoint.AbstractEndpoint
getPhase, isAutoStartup, isRunning, setAutoStartup, setPhase, setTaskScheduler, start, stop, stop
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName
 

Constructor Detail

TcpReceivingChannelAdapter

public TcpReceivingChannelAdapter()
Method Detail

onMessage

public boolean onMessage(org.springframework.integration.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

onInit

protected void onInit()
Overrides:
onInit in class org.springframework.integration.endpoint.MessageProducerSupport

doStart

protected void doStart()
Overrides:
doStart in class org.springframework.integration.endpoint.MessageProducerSupport

doStop

protected void doStop()
Overrides:
doStop in class org.springframework.integration.endpoint.MessageProducerSupport

setConnectionFactory

public void setConnectionFactory(AbstractConnectionFactory connectionFactory)
Sets the client or server connection factory; for this (an inbound adapter), if the factory is a client connection factory, the sockets are owned by a sending channel adapter and this adapter is used to receive replies.

Parameters:
connectionFactory - the connectionFactory to set

isListening

public boolean isListening()

getComponentType

public java.lang.String getComponentType()
Specified by:
getComponentType in interface org.springframework.integration.context.NamedComponent
Overrides:
getComponentType in class org.springframework.integration.context.IntegrationObjectSupport

getClientConnectionFactory

protected ConnectionFactory getClientConnectionFactory()
Returns:
the clientConnectionFactory

getServerConnectionFactory

protected ConnectionFactory getServerConnectionFactory()
Returns:
the serverConnectionFactory

isClientMode

public boolean isClientMode()
Specified by:
isClientMode in interface ClientModeCapable
Returns:
the isClientMode

setClientMode

public void setClientMode(boolean isClientMode)
Parameters:
isClientMode - the isClientMode to set

setScheduler

@Deprecated
public void setScheduler(org.springframework.scheduling.TaskScheduler scheduler)
Deprecated. Use AbstractEndpoint.setTaskScheduler(TaskScheduler)

Parameters:
scheduler - the scheduler to set

getRetryInterval

public long getRetryInterval()
Returns:
the retryInterval

setRetryInterval

public void setRetryInterval(long retryInterval)
Parameters:
retryInterval - the retryInterval to set

isClientModeConnected

public boolean isClientModeConnected()
Specified by:
isClientModeConnected in interface ClientModeCapable
Returns:
true if the endpoint is running in client mode.

retryConnection

public void retryConnection()
Description copied from interface: ClientModeCapable
Immediately attempt to establish the connection.

Specified by:
retryConnection in interface ClientModeCapable

beforeShutdown

public int beforeShutdown()
Specified by:
beforeShutdown in interface org.springframework.integration.context.OrderlyShutdownCapable

afterShutdown

public int afterShutdown()
Specified by:
afterShutdown in interface org.springframework.integration.context.OrderlyShutdownCapable