Spring Integration

org.springframework.integration.ip.tcp.connection
Interface TcpConnection

All Superinterfaces:
java.lang.Runnable
All Known Subinterfaces:
TcpConnectionInterceptor
All Known Implementing Classes:
TcpConnectionInterceptorSupport, TcpConnectionSupport, TcpNetConnection, TcpNioConnection, TcpNioSSLConnection

public interface TcpConnection
extends java.lang.Runnable

An abstraction over Socket and SocketChannel that sends Message objects by serializing the payload and streaming it to the destination. Requires a TcpListener to receive incoming messages.

Since:
2.0
Author:
Gary Russell

Method Summary
 void close()
          Closes the connection.
 java.lang.String getConnectionId()
           
 org.springframework.core.serializer.Deserializer<?> getDeserializer()
           
 java.lang.Object getDeserializerStateKey()
           
 java.lang.String getHostAddress()
           
 java.lang.String getHostName()
           
 TcpListener getListener()
           
 java.lang.Object getPayload()
          Uses the deserializer to obtain the message payload from the connection's input stream.
 int getPort()
           
 org.springframework.core.serializer.Serializer<?> getSerializer()
           
 long incrementAndGetConnectionSequence()
           
 boolean isOpen()
           
 boolean isServer()
           
 boolean isSingleUse()
           
 void send(Message<?> message)
          Converts and sends the message.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

close

void close()
Closes the connection.


isOpen

boolean isOpen()
Returns:
true if the connection is open.

send

void send(Message<?> message)
          throws java.lang.Exception
Converts and sends the message.

Parameters:
message - The message
Throws:
java.lang.Exception

getPayload

java.lang.Object getPayload()
                            throws java.lang.Exception
Uses the deserializer to obtain the message payload from the connection's input stream.

Returns:
The payload
Throws:
java.lang.Exception

getHostName

java.lang.String getHostName()
Returns:
the host name

getHostAddress

java.lang.String getHostAddress()
Returns:
the host address

getPort

int getPort()
Returns:
the port

getConnectionId

java.lang.String getConnectionId()
Returns:
a string uniquely representing a connection.

isSingleUse

boolean isSingleUse()
Returns:
True if connection is used once.

isServer

boolean isServer()
Returns:
True if connection is used once.

getDeserializer

org.springframework.core.serializer.Deserializer<?> getDeserializer()
Returns:
the deserializer

getSerializer

org.springframework.core.serializer.Serializer<?> getSerializer()
Returns:
the serializer

getListener

TcpListener getListener()
Returns:
this connection's listener

incrementAndGetConnectionSequence

long incrementAndGetConnectionSequence()
Returns:
the next sequence number for a message received on this socket

getDeserializerStateKey

java.lang.Object getDeserializerStateKey()
Returns:
a key that can be used to reference state in a Deserializer that maintains state for this connection. Currently, this would be the InputStream associated with the connection, but the object should be treated as opaque and ONLY used as a key.

Spring Integration