org.springframework.integration.ip.tcp
Class TcpNetReceivingChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter
org.springframework.integration.ip.tcp.AbstractTcpReceivingChannelAdapter
org.springframework.integration.ip.tcp.TcpNetReceivingChannelAdapter
- All Implemented Interfaces:
- java.lang.Runnable, 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, NamedComponent, MessageProducer, CommonSocketOptions
public class TcpNetReceivingChannelAdapter
- extends AbstractTcpReceivingChannelAdapter
Tcp Receiving Channel adapter that uses a Socket
. Each
connected socket uses a dedicated thread so the pool size must be set
accordingly.
- Author:
- Gary Russell
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setChannelResolver, setConversionService, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
serverSocket
protected java.net.ServerSocket serverSocket
customSocketReaderClass
protected java.lang.Class<NetSocketReader> customSocketReaderClass
TcpNetReceivingChannelAdapter
public TcpNetReceivingChannelAdapter(int port)
- Constructs a TcpNetReceivingChannelAdapter that listens on the port.
- Parameters:
port
- The port.
server
protected void server()
- Creates the server socket, listens for incoming connections and schedules
execution of the
handleSocket(Socket)
method for each new
connection.
- Specified by:
server
in class AbstractTcpReceivingChannelAdapter
- See Also:
AbstractTcpReceivingChannelAdapter.server()
handleSocket
protected void handleSocket(java.net.Socket socket)
- Constructs a
NetSocketReader
and calls its AbstractSocketReader.assembledData
method repeatedly; for each assembled message, calls MessageProducerSupport.sendMessage(Message)
with
the mapped message.
- Parameters:
socket
-
processMessage
protected void processMessage(NetSocketReader reader)
throws java.lang.Exception
- Parameters:
reader
-
- Throws:
java.lang.Exception
doStop
protected void doStop()
- Description copied from class:
AbstractEndpoint
- Subclasses must implement this method with the stop behavior.
This method will be invoked while holding the
AbstractEndpoint.lifecycleLock
.
- Overrides:
doStop
in class AbstractInternetProtocolReceivingChannelAdapter
setCustomSocketReaderClassName
public void setCustomSocketReaderClassName(java.lang.String customSocketReaderClassName)
throws java.lang.ClassNotFoundException
- Parameters:
customSocketReaderClass
- the customSocketReader to set
- Throws:
java.lang.ClassNotFoundException