Three kinds of people touch klok-common. Most never open this repository: they meet its names in a route, a log line or an error message, and this page tells them where those come from and what to do.
Three kinds of people touch klok-common. Most never open this repository: they meet its names in a route, a log line or an error message, and this page tells them where those come from and what to do.
You build routes on the Klok Quarkus extension. You never add klok-common yourself: the extension declares it as an
api dependency, so your service runs the version the extension was built against, and refreshing the catalog copy with
./gradlew updateKlokLibsToml brings a newer extension and with it a newer klok-common. What you meet:
<RouteId>.topic.purpose or the route's topicPurpose()), through KlokNamingConventions: CustomerV1
with purpose created in domain finance of tenant acme is persistent://acme/finance/CustomerV1_created in
production and persistent://acme_test/finance/CustomerV1_created in test. ./gradlew klokTopics lists every topic
your project uses. The rules, including why the purpose is the publisher's and the reader is its subscription, are on
Naming conventions.klok-* properties travel with every message and HTTP call your routes handle. In
your service's log lines they appear as MDC keys with a dot (klok.corr-global, klok.route-id) and in OpenSearch as
fields with underscores (klok_corr_global, klok_route_id); following one global id shows a whole business call
across services. See Log fields and correlation and Message properties and
CloudEvents.klokTopicCheck and the service's start fail with TOPIC_MISSING or TOPIC_ACCESS_DENIED and a message
that names the topic, your broker role, the klok.dev request link and the exact line to add by hand. Do what it says;
request only the topic itself, never its _DLQ or _Response, which come with it. See When a topic or a grant is
missing.@KlokDocs so that it gets its own
generated page and the routes that use it get its source (The @KlokDocs annotation).KlokKnowledge.get("platform-rules") instead of restating it (Klok knowledge).If you need a topic name in your own code, for example in a custom route, call KlokNamingConventions; never build the
string by hand.
You write something that talks to the Klok broker or reasons about its topics outside the Quarkus extension: a broker client in another language, a worker in Python or TypeScript, klok.dev, an Ansible role or a build task.
dev.klok.framework:klok-common from the dependency catalog (klokLibs.klokCommon), or on the
Java broker client, which brings it. Use KlokNamingConventions for topic names and companions, KlokMessageProperties
and KlokCloudEventAttributes for what goes on a message, and KlokTopicProvisioning to report a missing topic or
grant in the platform's words.wire-contract zip classifier of the Maven artifact
(dev.klok.framework:klok-common:<version>:wire-contract@zip) or the same files inside the jar, vendor it, and run
every case of its fixture files in your own tests. The contract states the property names and who sets them, the topic
grammar and companions, request/reply, the metadata a consumer and a producer announce, the connection rules and the
service logging. The TypeScript and Python broker clients and klok.dev are the existing copies; their paths are in the
wire contract page.parseTopicName (or topics in the contract) gives the
tenant, environment, domain, datamodel and purpose of any topic name.contractVersion.src/main/resources/dev/klok/wire-contract/ (the contract JSON and a fixture case) before the Java constant;
KlokWireContractParityTest fails until both agree. A helper belongs here only when at least two modules use it
(Design decisions)../gradlew build on Java 21. The build resolves from Maven Central only and needs no token.gradle.properties (majorVersion, minorVersion, patchVersion); the pipeline appends the
build timestamp.main: feat, fix and
the others release a new version; docs, for a change to klok-docs/ or the README only, builds and publishes the
documentation and releases nothing.main pipeline releases the jar and the wire contract zip to the GitLab package registry and
to Maven Central (release_and_publish_job, which may wait up to an hour for Maven Central), then update_klok_catalog
writes klokCommon into the dependency catalog and runs klok catalog release-dependents, which starts the pipeline of
each framework library that follows the catalog and was built against an older klok-common (Releasing the
dependents). Wait for the catalog commit,
not for the merge:glab api --hostname git.klok.dev "projects/klok%2Fframework%2Fklok-gradle-dependency-catalog/repository/commits?ref_name=main&per_page=10" | jq -r '.[].title'
klok vendor sync --latest, and a copy's tests then run the
new cases (Wire contract).