Class UmaDbClientImpl

java.lang.Object
io.umadb.client.grpc.UmaDbClientImpl
All Implemented Interfaces:
UmaDbClient

public final class UmaDbClientImpl extends Object implements UmaDbClient
Internal gRPC-based implementation of UmaDbClient.

This class is responsible for:

  • Establishing and managing the gRPC channel
  • Configuring TLS and API key authentication
  • Mapping gRPC responses and errors to client-facing domain objects
  • Translating server error responses into UmaDbExceptions

This class is not intended to be used directly by client code. Clients should construct instances via UmaDbClientBuilder.

  • Constructor Details

    • UmaDbClientImpl

      public UmaDbClientImpl(String host, int port, String caFilePath, String apiKey)
      Creates a new client implementation.
      Parameters:
      host - UmaDB server host
      port - UmaDB server port
      caFilePath - optional path to a CA certificate for TLS
      apiKey - optional API key (requires TLS)
      Throws:
      IllegalArgumentException - if arguments are invalid or insecure
  • Method Details

    • connect

      public void connect()
      Description copied from interface: UmaDbClient
      Establishes a connection to the UmaDb server.

      This method must be called before performing any operations such as appending or reading events.

      Specified by:
      connect in interface UmaDbClient
    • handle

      public AppendResponse handle(AppendRequest appendRequest)
      Description copied from interface: UmaDbClient
      Handles an append request, writing events to the event store.

      The AppendRequest may include optional AppendConditions that enforce conditional appends. Returns an AppendResponse containing the position of the last appended event.

      Specified by:
      handle in interface UmaDbClient
      Parameters:
      appendRequest - the request describing the events to append
      Returns:
      the response containing the position of the last appended event
    • handle

      public Iterator<ReadResponse> handle(ReadRequest readRequest)
      Description copied from interface: UmaDbClient
      Handles a read request, returning an iterator over ReadResponse objects.

      Each ReadResponse contains a batch of sequenced events and optionally the head position of the event stream at the time of the response. If ReadRequest.subscribe() is true, the iterator will continue to provide new events as they are appended.

      Specified by:
      handle in interface UmaDbClient
      Parameters:
      readRequest - the request describing which events to read
      Returns:
      an iterator over ReadResponse batches
    • getHeadPosition

      public long getHeadPosition()
      Description copied from interface: UmaDbClient
      Returns the position of the most recent event in the event store.

      This value can be used for optimistic concurrency control, checkpointing, or as a reference point for subsequent reads.

      Specified by:
      getHeadPosition in interface UmaDbClient
      Returns:
      the sequence number of the latest event
    • shutdown

      public void shutdown()
      Description copied from interface: UmaDbClient
      Shuts down the client, closing any active connections and releasing resources.

      After calling this method, the client should not be used for any further operations.

      Specified by:
      shutdown in interface UmaDbClient