Class ServerConnectionHandler
- java.lang.Object
-
- software.amazon.awssdk.crt.eventstream.ServerConnectionHandler
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
OperationRoutingServerConnectionHandler
public abstract class ServerConnectionHandler extends Object implements AutoCloseable
Handler for EventStream ServerConnections. It's marked AutoClosable. By default onConnectionClosed, calls the close() function on this object.
-
-
Field Summary
Fields Modifier and Type Field Description protected ServerConnectionconnection
-
Constructor Summary
Constructors Modifier Constructor Description protectedServerConnectionHandler(ServerConnection connection)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidonConnectionClosed(int shutdownReason)Invoked upon the connection closing.protected abstract ServerConnectionContinuationHandleronIncomingStream(ServerConnectionContinuation continuation, String operationName)Invoked upon an incoming stream from a client.protected abstract voidonProtocolMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)Invoked when a message is received on a connection.
-
-
-
Field Detail
-
connection
protected ServerConnection connection
-
-
Constructor Detail
-
ServerConnectionHandler
protected ServerConnectionHandler(ServerConnection connection)
-
-
Method Detail
-
onProtocolMessage
protected abstract void onProtocolMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Invoked when a message is received on a connection.- Parameters:
headers- List of EventStream headers for the message received.payload- Payload for the message receivedmessageType- message type for the messagemessageFlags- message flags for the message
-
onIncomingStream
protected abstract ServerConnectionContinuationHandler onIncomingStream(ServerConnectionContinuation continuation, String operationName)
Invoked upon an incoming stream from a client.- Parameters:
continuation- continuation object for sending continuation events to the client.operationName- name of the operation the client wishes to invoke.- Returns:
- a new instance of ServerConnectionContinuationHandler for handling continuation events.
-
onConnectionClosed
protected void onConnectionClosed(int shutdownReason)
Invoked upon the connection closing. By default, calls close() on this object.- Parameters:
shutdownReason- reason for the shutdown. 0 means clean shutdown.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-