Class ClientConnectionContinuation
- java.lang.Object
-
- software.amazon.awssdk.crt.CrtResource
-
- software.amazon.awssdk.crt.eventstream.ClientConnectionContinuation
-
- All Implemented Interfaces:
AutoCloseable
public class ClientConnectionContinuation extends CrtResource
Java wrapper for event-stream-rpc client continuation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class software.amazon.awssdk.crt.CrtResource
CrtResource.ResourceInstance
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>
activate(String operationName, List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Sends the initial message on a continuation, and begins the message flow for a stream.void
activate(String operationName, List<Header> headers, byte[] payload, MessageType messageType, int messageFlags, MessageFlushCallback callback)
Initiates a new client stream.protected boolean
canReleaseReferencesImmediately()
Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits.protected void
releaseNativeHandle()
Required override method that must begin the release process of the acquired native handleCompletableFuture<Void>
sendMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Sends message on the continuationvoid
sendMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags, MessageFlushCallback callback)
Sends message on the continuation-
Methods inherited from class software.amazon.awssdk.crt.CrtResource
acquireNativeHandle, addRef, addReferenceTo, close, collectNativeResource, collectNativeResources, decRef, getNativeHandle, getResourceLogDescription, isNull, logNativeResources, releaseReferences, removeReferenceTo, setDescription, swapReferenceTo, waitForNoResources
-
-
-
-
Method Detail
-
activate
public void activate(String operationName, List<Header> headers, byte[] payload, MessageType messageType, int messageFlags, MessageFlushCallback callback)
Initiates a new client stream. Sends new message for the new stream.- Parameters:
operationName
- name for the operation to be invoked by the peer endpoint.headers
- headers for the event-stream message, may be null or empty.payload
- payload for the event-stream message, may be null or empty.messageType
- messageType for the message. Must be ApplicationMessage or ApplicationErrormessageFlags
- union of flags for MessageFlags.getByteValue()callback
- callback to be invoked upon the message being flushed to the underlying transport.
-
activate
public CompletableFuture<Void> activate(String operationName, List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Sends the initial message on a continuation, and begins the message flow for a stream.- Parameters:
operationName
- name of the operation to invoke on the server.headers
- list of additional event stream headers to include on the message.payload
- payload for the messagemessageType
- message type. Must be either ApplicationMessage or ApplicationErrormessageFlags
- message flags for the message.- Returns:
- Completeable future for syncing with the connection completing or failing.
-
sendMessage
public void sendMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags, MessageFlushCallback callback)
Sends message on the continuation- Parameters:
headers
- list of additional event stream headers to include on the message.payload
- payload for the messagemessageType
- message type. Must be either ApplicationMessage or ApplicationErrormessageFlags
- message flags for the message, use TerminateStream to cause this message to close the continuation after sending.callback
- completion callback to be invoked when the message is synced to the underlying transport.
-
sendMessage
public CompletableFuture<Void> sendMessage(List<Header> headers, byte[] payload, MessageType messageType, int messageFlags)
Sends message on the continuation- Parameters:
headers
- list of additional event stream headers to include on the message.payload
- payload for the messagemessageType
- message type. Must be either ApplicationMessage or ApplicationErrormessageFlags
- message flags for the message, use TerminateStream to cause this message to close the continuation after sending.- Returns:
- Future for syncing when the message is flushed to the transport or fails.
-
releaseNativeHandle
protected void releaseNativeHandle()
Description copied from class:CrtResource
Required override method that must begin the release process of the acquired native handle- Specified by:
releaseNativeHandle
in classCrtResource
-
canReleaseReferencesImmediately
protected boolean canReleaseReferencesImmediately()
Description copied from class:CrtResource
Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources with asynchronous shutdown processes should override this with false, and establish a callback from native code that invokes releaseReferences() when the asynchronous shutdown process has completed. See HttpClientConnectionManager for an example.- Specified by:
canReleaseReferencesImmediately
in classCrtResource
- Returns:
- true if this resource releases synchronously, false if this resource performs async shutdown
-
-