Vectrune Kafka

Publish and consume records from a plaintext Kafka broker in native Rune REST apps.

Install and approve

Use a Vectrune build with native package and catalog support. Run these commands from your project. Replace LIBRARY with the path to the matching shared library from the release archive.

vectrune deps add kafkavectrune native approve kafka LIBRARY

Native approval is available on macOS and Linux. To pin the verified library digest in scripts, pass --sha256 DIGEST.

Rune import

import "pkg:kafka"

This import enables the native declarations. The repository also provides examples/orders.rune and examples/consume_orders.rune as standalone apps.

Sections

@Kafka/<instance>
Creates a producer. Set security to plaintext, bootstrap_servers to your broker, and optionally delivery_timeout_ms.
@KafkaConsumer/<instance>
Reads a topic into a core receiver job. Set security, bootstrap_servers, topic, group_id, offset_reset, and receiver. A successful handler allows the connector to acknowledge the offset.
@Kafka/orderssecurity = plaintextbootstrap_servers = "127.0.0.1:19092"delivery_timeout_ms = 10000

Package commands

receipt = kafka.publish orders event
Publishes an object containing topic, payload, and an optional key. A successful receipt contains the partition and offset.
@Route/POST /eventsrun:    event = parse-json body    receipt = kafka.publish orders event    respond 201 receipt

Topic observer

The observer is available in Kafka v0.2.0 with Vectrune v0.3.14 and its matching native library. Install the exact connector version with --version 0.2.0 once it is in the catalog.

vectrune kafka --observe-topic orders --host 127.0.0.1:19092 --security plaintext

Use --no-browser to print the local URL. The live WebSocket view follows new arrivals, and the offset query shows retained records. The observer never commits consumer offsets.

@KafkaObserver/<instance>
Configures a read-only observer with security, bootstrap_servers, topic, and receiver. The CLI tool supplies the source-bound receiver.
result = kafka.observe browser query
Reads one partition. Use string values for partition, offset and limit. Offset accepts earliest, latest, or a numeric offset; limit is 1 to 100.