klok-brokerclient-java

Overview

This is the broker client library for Klok. It is the Java, Python and TypeScript wrapper around Apache Pulsar that every integration and platform service uses to talk to the broker.

The Java client (klok-brokerclient-java) is the one the Quarkus extension builds on. A KlokBrokerClient<T> publishes and consumes one datamodel class with the Avro schema generated from the datamodel project. A KlokBytesBrokerClient does the same with byte[] payloads that go on the wire untouched, for services that bring their own encoding and cannot spend the Avro serialization on every message. Both share the same configuration, properties, subscription options and request/reply topics underneath.

The Python client (klok-brokerclient) and the TypeScript client (@klok-integration/brokerclient) put the same bytes and the same properties on the broker. They derive their own chain context, retry what a handler throws, dead letter what does not work, and log every message as an invocation, so a Python worker or a Node backend takes part in the same business chains as a Java route.

On top of Pulsar the clients add the platform's rules: full topic names from KlokNamingConventions, the klok-* context properties and the CloudEvents ce-* attributes, OAuth2 client credentials against Keycloak, request/reply over a ReqRes_<Req>_<Res>_Request / _Response topic pair, a claim check store for payloads too large for a message, typed errors that say what to do when a topic or a grant is missing, and a watchdog that says loudly when a connection to the broker is lost.

Where this documentation comes from

This site is written by KlokDocumentationEgress from the project's code, its hand written klok-docs/ folder and the tenant's documentation generation settings, on every main pipeline of klok/framework/klok-brokerclient-java. Nobody edits it by hand.

To change Edit
Hand written pages, their order, and where a generated section appears in them klok-docs/ in klok/framework/klok-brokerclient-java
What is generated and how: chapters, sections, prompts, languages, model klok.dev, Tenant Administration, Documentation generation