Class EventStreamRPCConnection
java.lang.Object
software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection
- All Implemented Interfaces:
AutoCloseable
A connection for an EventStreamRPC client
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceLifecycle handler is how a client can react and respond to connectivity interruptions. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new EventStreamRPCConnection from the given configuration -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()connect(EventStreamRPCConnection.LifecycleHandler lifecycleHandler) Connects to the event stream RPC server asynchronouslyvoidDisconnects the EventStreamRPCConnectionsoftware.amazon.awssdk.crt.eventstream.ClientConnectionContinuationnewStream(software.amazon.awssdk.crt.eventstream.ClientConnectionContinuationHandler continuationHandler) Creates a new stream with the given continuation handler.sendPing(Optional<MessageAmendInfo> pingData) Interface to send ping.sendPingResponse(Optional<MessageAmendInfo> pingResponseData) Interface to send pingResponse.
-
Constructor Details
-
EventStreamRPCConnection
Constructs a new EventStreamRPCConnection from the given configuration- Parameters:
config- The configuration used to construct the EventStreamRPCConnection
-
-
Method Details
-
connect
Connects to the event stream RPC server asynchronously- Returns:
- A future that completes when connected
-
newStream
public software.amazon.awssdk.crt.eventstream.ClientConnectionContinuation newStream(software.amazon.awssdk.crt.eventstream.ClientConnectionContinuationHandler continuationHandler) Creates a new stream with the given continuation handler. Trhows an exception if not connected- Parameters:
continuationHandler- The continuation handler to use- Returns:
- A new ClientConnectionContinuation containing the new stream.
-
disconnect
public void disconnect()Disconnects the EventStreamRPCConnection -
sendPing
Interface to send ping. Optional MessageAmendInfo will use the headers and payload for the ping message verbatim. Should trigger a pong response and server copies back- Parameters:
pingData- The ping data to send- Returns:
- A future that completes when the pong response is receieved
-
sendPingResponse
Interface to send pingResponse. Optional MessageAmendInfo will use the headers and payload for the ping message verbatim. Should trigger a pong response and server copies back- Parameters:
pingResponseData- The ping response data to send- Returns:
- A future that completes when the pong response is receieved
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-