cratis_chronicle_contracts
Generated Chronicle gRPC contracts for Elixir.
This package is intentionally non-idiomatic. Its job is to expose generated protobuf and gRPC client modules that an idiomatic Elixir client can build on top of later.
Installation
Replace MAJOR.MINOR.PATCH with a published contracts release compatible with your Chronicle kernel:
def deps do
[
{:cratis_chronicle_contracts, "~> MAJOR.MINOR.PATCH"}
]
end
Releases containing the bundled VERSION file report their release version to Mix, so Mix can enforce the requirement.
What Is In The Package
lib/generatedcontains the generated protobuf message modules and*.StubgRPC client modules.
Generating The Elixir Client
From the repository root:
cd Source/Clients/Elixir
bash ./generate-protos.sh
The script:
- Copies
Source/Kernel/Protobufintopriv/protos - Generates Elixir protobuf and gRPC modules into
lib/generated
The generated files are not meant to be edited by hand.
Using Generated Stubs
After generating the Elixir sources, use the generated *.Stub modules under
Cratis.Chronicle.Contracts.* with the channel returned by
your gRPC connection/channel implementation.
For example, after generation you can call the generated services like this:
{:ok, response} =
Cratis.Chronicle.Contracts.EventStores.Stub.all_event_stores(
channel,
Google.Protobuf.Empty.new()
)
Function names follow the rpc names in the .proto files (AllEventStores becomes all_event_stores). Check the module name the generator produced for a service before copying a call.
Publishing
The repository contains a dedicated GitHub Actions workflow for publishing this
package to Hex. The publish flow writes the release version to VERSION, regenerates
Elixir sources from the current proto files, and tests the package before publishing it.