UmadbClient
An Elixir gRPC client for UmaDB's DCB (Dynamic Consistency
Boundary) event store service. It wraps the generated UmaDb.V1.DCB.Stub with a
small, ergonomic API for appending events, reading and subscribing to event
streams, querying by type and tags, tracking consumer positions, and optimistic
concurrency control — plus UmaDbClient.Builder convenience constructors for the
underlying proto message structs.
Installation
If available in Hex, the package can be installed
by adding umadb_client to your list of dependencies in mix.exs:
def deps do
[
{:umadb_client, "~> 0.6.4"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/umadb_client.
Regenerating uma_db.pb.ex from the proto
lib/uma_db/v1/uma_db.pb.ex is generated from the umadb.proto definition
published in the umadb-proto crate.
When that proto changes, regenerate the module as follows.
Prerequisites (one-time)
protoc— the Protocol Buffers compiler.The Elixir protobuf plugin, installed as an escript on your
PATH:mix escript.install hex protobuf# ensure ~/.mix/escripts is on your PATH
Steps
Fetch the target proto version. The source of truth is the
umadb-protocrate; grab the version you want from crates.io and extract it:VERSION=0.6.4curl -sSL "https://crates.io/api/v1/crates/umadb-proto/${VERSION}/download" \-H "User-Agent: umadb-client-dev" -o "/tmp/umadb-proto-${VERSION}.crate"tar xzf "/tmp/umadb-proto-${VERSION}.crate" -C /tmp# proto now at /tmp/umadb-proto-${VERSION}/proto/v1/umadb.proto(If you already have the crate locally, e.g. via a Rust build, it lives under
~/.cargo/registry/src/*/umadb-proto-${VERSION}/proto/v1/umadb.proto.)Run
protocto generate the Elixir module:protoc --elixir_out=plugins=grpc:./lib \--proto_path="/tmp/umadb-proto-${VERSION}/proto" \v1/umadb.protoprotocwrites tolib/v1/umadb.pb.ex(following the proto path). Move it into this project's layout and update the header comment with the proto version:mv lib/v1/umadb.pb.ex lib/uma_db/v1/uma_db.pb.exrmdir lib/v1 2>/dev/null || trueFormat and verify:
mix formatmix compilemix test
If the proto adds or changes fields, also update the hand-written convenience
constructors in lib/uma_db_client/builder.ex and the public API in
lib/uma_db_client.ex to surface them.