public class OperationRoutingServerConnectionHandler extends ServerConnectionHandler
connection
Constructor and Description |
---|
OperationRoutingServerConnectionHandler(ServerConnection serverConnection,
Map<String,java.util.function.Function<ServerConnectionContinuation,ServerConnectionContinuationHandler>> operationMapping)
binds an operation handler mapping to a server connection
|
Modifier and Type | Method and Description |
---|---|
protected void |
onConnectRequest(List<Header> headers,
byte[] payload)
To customize how the connect request is handled, override this function.
|
protected ServerConnectionContinuationHandler |
onIncomingStream(ServerConnectionContinuation continuation,
String operationName)
When a new stream continuation is received, it routes to the configured operation name to
handler mapping.
|
protected void |
onProtocolMessage(List<Header> headers,
byte[] payload,
MessageType messageType,
int messageFlags)
By default, automatically responds to pings when received, and routes connect requests.
|
close, onConnectionClosed
public OperationRoutingServerConnectionHandler(ServerConnection serverConnection, Map<String,java.util.function.Function<ServerConnectionContinuation,ServerConnectionContinuationHandler>> operationMapping)
serverConnection
- connection to route messages foroperationMapping
- mapping of operation names to message handlers.protected void onProtocolMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
onProtocolMessage
in class ServerConnectionHandler
headers
- List of EventStream headers for the message received.payload
- Payload for the message receivedmessageType
- message type for the messagemessageFlags
- message flags for the messageprotected void onConnectRequest(List<Header> headers, byte[] payload)
headers
- list of headers received in the messagepayload
- payload received in the messageprotected final ServerConnectionContinuationHandler onIncomingStream(ServerConnectionContinuation continuation, String operationName)
onIncomingStream
in class ServerConnectionHandler
continuation
- continuation representing the new incoming streamoperationName
- operation name for the new incoming streamCopyright © 2021. All rights reserved.