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:
- Runnable, BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, MessageProducer, NamedComponent, 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.
- Since:
- 2.0
- Author:
- Gary Russell
Methods inherited from class org.springframework.integration.ip.AbstractInternetProtocolReceivingChannelAdapter |
checkTaskExecutor, doStart, getLocalAddress, getPort, isListening, setLocalAddress, setPoolSize, setReceiveBufferSize, setSoReceiveBufferSize, setSoSendBufferSize, setSoTimeout, setTaskExecutor |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, toString, writeMessageHistory |
serverSocket
protected ServerSocket serverSocket
customSocketReaderClass
protected Class<NetSocketReader> customSocketReaderClass
TcpNetReceivingChannelAdapter
public TcpNetReceivingChannelAdapter(int port)
- Constructs a TcpNetReceivingChannelAdapter that listens on the provided port.
- Parameters:
port
- the port on which to listen
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(Socket socket)
- Constructs a
NetSocketReader
and calls its AbstractSocketReader.assembledData
method repeatedly; for each assembled message, calls MessageProducerSupport.sendMessage(Message)
with
the mapped message.
processMessage
protected void processMessage(NetSocketReader reader)
throws Exception
- Throws:
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(String customSocketReaderClassName)
throws ClassNotFoundException
- Parameters:
customSocketReaderClassName
- the NetSocketReader
class to use
- Throws:
ClassNotFoundException
- if the named class cannot be loaded
Copyright © 2010. All Rights Reserved.