Class ServerConnectionContinuationHandler
- java.lang.Object
-
- software.amazon.awssdk.crt.eventstream.ServerConnectionContinuationHandler
-
- All Implemented Interfaces:
AutoCloseable
public abstract class ServerConnectionContinuationHandler extends Object implements AutoCloseable
Handler interface for responding to continuation events. It's auto closable. By default, onContinuationClosed() releases the underlying resource.
-
-
Field Summary
Fields Modifier and Type Field Description protected ServerConnectionContinuation
continuation
-
Constructor Summary
Constructors Modifier Constructor Description protected
ServerConnectionContinuationHandler(ServerConnectionContinuation continuation)
Constructor invoked by your subclass.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
CompletableFuture<Void>
getContinuationClosedFuture()
protected void
onContinuationClosed()
Implement to handle the onContinuationClosed event.protected abstract void
onContinuationMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Invoked when a message is received on a continuation.
-
-
-
Field Detail
-
continuation
protected ServerConnectionContinuation continuation
-
-
Constructor Detail
-
ServerConnectionContinuationHandler
protected ServerConnectionContinuationHandler(ServerConnectionContinuation continuation)
Constructor invoked by your subclass.- Parameters:
continuation
- continuation to back the handler.
-
-
Method Detail
-
onContinuationClosed
protected void onContinuationClosed()
Implement to handle the onContinuationClosed event. By default, releases the underlying resource by calling close(). If you override this function, be sure to either call close() yourself or invoke super.onContinuationClosed().
-
onContinuationMessage
protected abstract void onContinuationMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Invoked when a message is received on a continuation.- 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
-
getContinuationClosedFuture
public CompletableFuture<Void> getContinuationClosedFuture()
- Returns:
- a future that will be completed upon the continuation being closed.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-