Class UmaDbClientImpl
- All Implemented Interfaces:
UmaDbClient
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 Summary
ConstructorsConstructorDescriptionUmaDbClientImpl(String host, int port, String caFilePath, String apiKey) Creates a new client implementation. -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()Establishes a connection to the UmaDb server.longReturns the position of the most recent event in the event store.handle(AppendRequest appendRequest) Handles an append request, writing events to the event store.handle(ReadRequest readRequest) Handles a read request, returning an iterator overReadResponseobjects.voidshutdown()Shuts down the client, closing any active connections and releasing resources.
-
Constructor Details
-
UmaDbClientImpl
Creates a new client implementation.- Parameters:
host- UmaDB server hostport- UmaDB server portcaFilePath- optional path to a CA certificate for TLSapiKey- optional API key (requires TLS)- Throws:
IllegalArgumentException- if arguments are invalid or insecure
-
-
Method Details
-
connect
public void connect()Description copied from interface:UmaDbClientEstablishes a connection to the UmaDb server.This method must be called before performing any operations such as appending or reading events.
- Specified by:
connectin interfaceUmaDbClient
-
handle
Description copied from interface:UmaDbClientHandles an append request, writing events to the event store.The
AppendRequestmay include optionalAppendConditions that enforce conditional appends. Returns anAppendResponsecontaining the position of the last appended event.- Specified by:
handlein interfaceUmaDbClient- Parameters:
appendRequest- the request describing the events to append- Returns:
- the response containing the position of the last appended event
-
handle
Description copied from interface:UmaDbClientHandles a read request, returning an iterator overReadResponseobjects.Each
ReadResponsecontains a batch of sequenced events and optionally the head position of the event stream at the time of the response. IfReadRequest.subscribe()istrue, the iterator will continue to provide new events as they are appended.- Specified by:
handlein interfaceUmaDbClient- Parameters:
readRequest- the request describing which events to read- Returns:
- an iterator over
ReadResponsebatches
-
getHeadPosition
public long getHeadPosition()Description copied from interface:UmaDbClientReturns 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:
getHeadPositionin interfaceUmaDbClient- Returns:
- the sequence number of the latest event
-
shutdown
public void shutdown()Description copied from interface:UmaDbClientShuts 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:
shutdownin interfaceUmaDbClient
-