> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Native Kafka

> Capture committed Kafka records and publish to a fixed Kafka partition.

Mount `@bijectionhq/app-streams` once for each reviewed partition. A Kafka receiver fixes one TLS address and seals the topic, partition and optional consumer group with its credential. The same TLS listener must serve the partition leader and, in group mode, the group coordinator at the declared address. Bijection refuses a different advertised address.

## Mount and start

Pass the same label to the receiver binder and as the app's `data`. This example mounts a protected archive. The installation charges its tasks and Files against that label's reservation. [Installer-bound labels](https://docs.bijection.com/integrations/native-connectors.md#installer-bound-labels).

```ts bijection/app.ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { app, label, secret } from "@bijectionhq/bijection";
import streams, { kafkaReceiver } from "@bijectionhq/app-streams";

const archive = label();
const credential = secret();
const broker = kafkaReceiver("kafka.example.com:9093", credential, archive);

export default app({ archive, credential, broker, orders: streams({ data: archive, broker }) });
```

The broker's functions take their paths under `orders.socket`. Grant
`orders.operator` and call `orders.socket.source.initialize` with
`{ mode: "kafka" }`.

Set the credential with `bijection secret set credential` to JSON with `username`, `password`, `topic` and a zero-based integer `partition`. Use a hostname-verified TLS listener with SASL PLAIN and direct socket egress. The connection must admit Metadata v10, ListOffsets v3 and Fetch v13. Publish uses Produce v13 with all in-sync replicas and requires a topic configured for broker append timestamps. This profile reads uncompressed batches.

`orders.socket.source.progress` returns the current cursor. `source.poll`, `pause` and `resume` take the current revision from `source.health`. Repair a continuity gap with the reviewed `revision` and `gapAt` through `source.reset`. `events.list({ cursor })` returns `{ facts, next }`, at most 100 rows a page; pass `next` as the following call's `cursor`, and start with `null`. The events sit at the mount's `data` label, which keeps only a token of each row key at the store, so the listing is in row order, not by row key. Each row carries its exact original position.

## Offset modes

* **`kafka`** begins at the earliest retained offset. The installation owns the next offset, scoped to cluster, topic ID and partition. Fetch uses read-committed isolation. Retention behind the cursor, topic replacement or loss of the selected position requires a reviewed reset.
* **`kafkaGroup`** also requires a `group` string in the sealed binding. Use a new, dedicated group and one mount as its offset writer for each partition. Enable the broker's topic-ID OffsetFetch and OffsetCommit v10 APIs. The app manually assigns its partition. The next poll confirms or mirrors the previously landed installation offset, after that landing commit. A broker offset ahead of the installation is a gap. Before resetting a grouped source, use a fresh empty group or have its operator clear the old offset. Pausing the feed can delay the next broker commit.

Each page carries an inclusive fetch start and an exclusive end offset. An event carries its partition and exact decimal offset as its identity within the physical topic. The cursor and sealed File land together. The record body is at most 24 KiB and the Kafka key is at most 1 KiB. A null value remains a tombstone event. Prior Bijection rows remain readable. Compaction can remove messages before capture, and control records or aborted transactions can leave gaps between visible offsets.

## Publish and inspect the receipt

Call `orders.socket.outgoing.publish` with `id`, canonical base64 `data` and a canonical base64 `key` or `null`. An identical request with the same ID returns its original local publication. A different body or key conflicts. `outgoing.get` shows the disposition and broker offset. The driver attempts one publish. A lost acknowledgement leaves the result `Unknown`.

The same mount layout supports [Debezium](https://docs.bijection.com/integrations/native-debezium.md), [RabbitMQ](https://docs.bijection.com/integrations/native-rabbitmq.md), [MQTT](https://docs.bijection.com/integrations/native-mqtt.md), [JetStream](https://docs.bijection.com/integrations/native-jetstream.md) and [Pulsar](https://docs.bijection.com/integrations/native-pulsar.md). Each uses its own receiver constructor, mode and sealed binding. A configured HTTP installation proxy cannot carry these profiles.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.