Class EventStreamRPCConnection

java.lang.Object
software.amazon.awssdk.eventstreamrpc.EventStreamRPCConnection
All Implemented Interfaces:
AutoCloseable

public class EventStreamRPCConnection extends Object implements AutoCloseable
A connection for an EventStreamRPC client
  • Constructor Details

    • EventStreamRPCConnection

      public EventStreamRPCConnection(EventStreamRPCConnectionConfig config)
      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

      public CompletableFuture<Void> sendPing(Optional<MessageAmendInfo> pingData)
      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

      public CompletableFuture<Void> sendPingResponse(Optional<MessageAmendInfo> pingResponseData)
      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:
      close in interface AutoCloseable