public interface TcpConnection extends Runnable
Socket
and SocketChannel
that
sends Message
objects by serializing the payload
and streaming it to the destination. Requires a TcpListener
to receive incoming messages.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
String |
getConnectionId() |
Deserializer<?> |
getDeserializer() |
Object |
getDeserializerStateKey() |
String |
getHostAddress() |
String |
getHostName() |
TcpListener |
getListener() |
Object |
getPayload()
Uses the deserializer to obtain the message payload
from the connection's input stream.
|
int |
getPort() |
Serializer<?> |
getSerializer() |
long |
incrementAndGetConnectionSequence() |
boolean |
isOpen() |
boolean |
isServer() |
boolean |
isSingleUse() |
void |
send(Message<?> message)
Converts and sends the message.
|
void close()
boolean isOpen()
void send(Message<?> message) throws Exception
message
- The message,Exception
- Any Exception.Object getPayload() throws Exception
Exception
- Any Exception.String getHostName()
String getHostAddress()
int getPort()
String getConnectionId()
boolean isSingleUse()
boolean isServer()
Deserializer<?> getDeserializer()
Serializer<?> getSerializer()
TcpListener getListener()
long incrementAndGetConnectionSequence()
Object getDeserializerStateKey()
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.