Spring Integration

org.springframework.integration.ip.tcp
Class SimpleTcpNetInboundGateway

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.endpoint.AbstractEndpoint
          extended by org.springframework.integration.gateway.AbstractMessagingGateway
              extended by org.springframework.integration.ip.tcp.SimpleTcpNetInboundGateway
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, Lifecycle, Phased, SmartLifecycle, NamedComponent

public class SimpleTcpNetInboundGateway
extends AbstractMessagingGateway

Simple implementation of a TCP/IP inbound gateway; uses Socket and socket reader thread hangs on receive for response; therefore no multiplexing of incoming messages is supported. Delegates most of its work to a private subclass of TcpNetReceivingChannelAdapter, overriding the processMessage() method. Consequently, the pool size needs to be large enough to support the maximum number of concurrent connections expected.

Since:
2.0
Author:
Gary Russell

Field Summary
protected  boolean close
           
protected  String customSocketReaderClassName
           
protected  Class<NetSocketWriter> customSocketWriterClass
           
protected  org.springframework.integration.ip.tcp.SimpleTcpNetInboundGateway.WriteCapableTcpNetReceivingChannelAdapter delegate
           
protected  String localAddress
           
protected  SocketMessageMapper mapper
           
protected  int messageFormat
           
protected  int poolSize
           
protected  int port
           
protected  int receiveBufferSize
           
protected  boolean soKeepAlive
           
protected  int soReceiveBufferSize
           
protected  int soSendBufferSize
           
protected  int soTimeout
           
protected  Executor taskExecutor
           
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Constructor Summary
SimpleTcpNetInboundGateway()
           
 
Method Summary
protected  void doStart()
          Subclasses must implement this method with the start behavior.
protected  void doStop()
          Subclasses must implement this method with the stop behavior.
protected  Object fromMessage(Message<?> message)
           
 int getPort()
           
 boolean isListening()
           
protected  void onInit()
          Subclasses may implement this for initialization logic.
 void setClose(boolean close)
           
 void setCustomSocketReaderClassName(String customSocketReaderClassName)
           
 void setCustomSocketWriterClassName(String customSocketWriterClassName)
           
 void setLocalAddress(String localAddress)
           
 void setMessageFormat(int messageFormat)
           
 void setPoolSize(int poolSize)
           
 void setPort(int port)
           
 void setReceiveBufferSize(int receiveBufferSize)
           
 void setSoKeepAlive(boolean soKeepAlive)
           
 void setSoReceiveBufferSize(int soReceiveBufferSize)
           
 void setSoSendBufferSize(int soSendBufferSize)
           
 void setSoTimeout(int soTimeout)
           
 void setTaskExecutor(Executor taskExecutor)
           
protected  Message<?> toMessage(Object object)
           
 
Methods inherited from class org.springframework.integration.gateway.AbstractMessagingGateway
getComponentType, receive, send, sendAndReceive, sendAndReceiveMessage, setExceptionMapper, setReplyChannel, setReplyTimeout, setRequestChannel, setRequestTimeout, setShouldThrowErrors
 
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, getChannelResolver, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, toString, writeMessageHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mapper

protected SocketMessageMapper mapper

delegate

protected org.springframework.integration.ip.tcp.SimpleTcpNetInboundGateway.WriteCapableTcpNetReceivingChannelAdapter delegate

port

protected int port

messageFormat

protected int messageFormat

poolSize

protected int poolSize

receiveBufferSize

protected int receiveBufferSize

soKeepAlive

protected boolean soKeepAlive

soReceiveBufferSize

protected int soReceiveBufferSize

soSendBufferSize

protected int soSendBufferSize

soTimeout

protected int soTimeout

customSocketReaderClassName

protected String customSocketReaderClassName

customSocketWriterClass

protected Class<NetSocketWriter> customSocketWriterClass

close

protected boolean close

localAddress

protected String localAddress

taskExecutor

protected Executor taskExecutor
Constructor Detail

SimpleTcpNetInboundGateway

public SimpleTcpNetInboundGateway()
Method Detail

doStart

protected void doStart()
Description copied from class: AbstractEndpoint
Subclasses must implement this method with the start behavior. This method will be invoked while holding the AbstractEndpoint.lifecycleLock.

Overrides:
doStart in class AbstractMessagingGateway

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 AbstractMessagingGateway

onInit

protected void onInit()
               throws Exception
Description copied from class: IntegrationObjectSupport
Subclasses may implement this for initialization logic.

Overrides:
onInit in class AbstractMessagingGateway
Throws:
Exception

fromMessage

protected Object fromMessage(Message<?> message)
Overrides:
fromMessage in class AbstractMessagingGateway

toMessage

protected Message<?> toMessage(Object object)
Overrides:
toMessage in class AbstractMessagingGateway

setPort

public void setPort(int port)
Parameters:
port - the port to set

setMessageFormat

public void setMessageFormat(int messageFormat)
Parameters:
messageFormat - the messageFormat to set

setPoolSize

public void setPoolSize(int poolSize)
Parameters:
poolSize - the poolSize to set

setReceiveBufferSize

public void setReceiveBufferSize(int receiveBufferSize)
Parameters:
receiveBufferSize - the receiveBufferSize to set

setSoKeepAlive

public void setSoKeepAlive(boolean soKeepAlive)
Parameters:
soKeepAlive - the soKeepAlive to set

getPort

public int getPort()
Returns:
the port

setSoReceiveBufferSize

public void setSoReceiveBufferSize(int soReceiveBufferSize)
Parameters:
soReceiveBufferSize - the soReceiveBufferSize to set

setSoSendBufferSize

public void setSoSendBufferSize(int soSendBufferSize)
Parameters:
soSendBufferSize - the soSendBufferSize to set

setSoTimeout

public void setSoTimeout(int soTimeout)
Parameters:
soTimeout - the soTimeout to set

setCustomSocketReaderClassName

public void setCustomSocketReaderClassName(String customSocketReaderClassName)
Parameters:
customSocketReaderClassName - the customSocketReaderClassName to set

setCustomSocketWriterClassName

public void setCustomSocketWriterClassName(String customSocketWriterClassName)
                                    throws ClassNotFoundException
Parameters:
customSocketWriterClassName - the customSocketWriterClassName to set
Throws:
ClassNotFoundException

setClose

public void setClose(boolean close)
Parameters:
close - the close to set

setTaskExecutor

public void setTaskExecutor(Executor taskExecutor)

isListening

public boolean isListening()

setLocalAddress

public void setLocalAddress(String localAddress)

Spring Integration

Copyright © 2010. All Rights Reserved.