Skip to content
Bisos Pip Kafka

Bisos Pip Kafka

github.com • November 26, 2026

bisos.kafka is a BISOS package for running Apache Kafka on a BISOS host — a single-node broker in KRaft mode (no ZooKeeper), together with Kafbat UI as its web UI — as a BISOS Capability Bundle (CBS/CBM) of systemd -planted Command Services.

A planted pointer leaf ( cbmProc.spcs , at sys/cbm/collective/hereWeb/kafka/ ) subprocess-invokes a Capability Bundle Specification ( kafka-cbs.pcs ). The CBS declares package installation (sbom), the two systemd units ( kafka and kafbat-ui ), and the assembly step that makes Kafbat UI browsable as .

Debian packages neither Kafka nor Kafbat UI. The sbom therefore takes only the JRE from apt, and fetches the Apache Kafka binary tarball and the Kafbat UI jar from upstream at pinned versions, refusing either one if its checksum does not match.

The BISOS Kafka Model

Summary of Kafka and Terminology The Mental Model: a Durable Log, Not a Queue The Terms, Precisely Source and Sink: Where the Words Come From Security: Authentication, Authorization, Encryption Delivery Guarantees and Transactions Common Terminology Mistakes What You See on This Host

The Mental Model: a Durable Log, Not a Queue

Source and Sink: Where the Words Come From

Security: Authentication, Authorization, Encryption

Delivery Guarantees and Transactions

Common Terminology Mistakes

What You See on This Host

What Gets Installed, and Where

Installation Installation With pip Installation With pipx

Installation With pip

Installation With pipx

Usage Materialization Day-to-Day Admin: =kafkaAdmin.cs= Direct Kafka CLI Cheat Sheet: =quickKafka.cs=

Day-to-Day Admin: =kafkaAdmin.cs=

Direct Kafka CLI Cheat Sheet: =quickKafka.cs=

Part of BISOS — ByStar Internet Services Operating System

Documentation and Blee-Panels

Planned Improvements Authentication for Kafbat UI, so it can listen beyond loopback Remote clients: a non-loopback broker listener, with SASL/TLS Live status Cmnds in kafkaAdmin.cs (broker reachable, quorum leader) rather than printed examples A Capability Materialization figure (kafka-graphviz.pcs), as bisos.airflow has

Authentication for Kafbat UI, so it can listen beyond loopback

Remote clients: a non-loopback broker listener, with SASL/TLS

Live status Cmnds in kafkaAdmin.cs (broker reachable, quorum leader) rather than printed examples

A Capability Materialization figure (kafka-graphviz.pcs), as bisos.airflow has

bisos.kafka ( /bisos/git/bxRepos/bisos-pip/kafka ) packages Apache Kafka 4.3.1 (single node, KRaft combined broker and controller) plus the Kafbat UI as a hereWeb CBS/CBM, deployed the BISOS way rather than via a Docker Compose quick-start. As of 2026-10-14 it is materialized on one host (bisos3 dev host, by hand) : broker on 24007, Kafbat UI at ; see AI-WorkPlan.org 2.3. Transactions on a single broker need transaction.state.log.replication.factor=1 and transaction.state.log.min.isr=1 .

Which Python client library to use is in KafkaUsePython.org .

bisos.kafka is also to carry the generic kafkaFileSend.cs / kafkaFileReceive.cs (module bisos/kafka/kafkaFileTransfer.py , Cmnds in kafkaFileTransfer_csu.py ), installed with pipx; a consumer’s code runs them as subprocesses and never imports bisos.* ( AI-WorkPlan.org Stage 2).

This section is for someone new to Kafka. It gives the mental model first, then the exact vocabulary, then the mistakes people most often make with it. Wording follows the Apache Kafka documentation ( ).

The Mental Model: a Durable Log, Not a Queue

Kafka is a distributed, durable, append-only log service . Programs append records to named logs, and other programs read those logs, each at its own pace and from a position it keeps for itself.

Three properties make Kafka different from a message queue:

Reading does not remove anything. A record stays until its topic’s retention expires (here: 7 days, log.retention.hours=168 ) or the topic is compacted. Any number of independent readers can read the same record, and a reader can go back and read it again.

The reader keeps the bookmark, not the broker’s queue. Each reader’s position (its offset ) is recorded per consumer group. Moving the bookmark back replays history; moving it forward skips records.

Order is per partition, not per topic. A topic is split into partitions for parallelism; only within one partition are records in a guaranteed order.

Source and Sink: Where the Words Come From

Source and sink are not part of Kafka’s core vocabulary. The core words are producer and consumer. Source and sink come from Kafka Connect , a separate framework shipped with Kafka for moving data between Kafka and other systems without writing code:

In general data-flow language a “source” is where data enters a pipeline and a “sink” is where it leaves, so people also call any program that feeds Kafka a source. That is a loose usage. Precisely: *a source is something that produces into Kafka, a producer is the client role that does it; a sink takes data out of Kafka, a consumer is the client role that does it.*

In this repo : the planned kafkaFileSend.cs (a producer: posts a file) and kafkaFileReceive.cs (a consumer: rebuilds it) ( AI-WorkPlan.org Stage 2) are named Send and Receive, not Source and Sink, because those two words mean Kafka Connect connectors and, in many data pipelines, the origin of the data. They are ordinary Kafka clients, not Kafka Connect connectors.

Security: Authentication, Authorization, Encryption

These are three separate questions, and Kafka answers each with different settings:

The authentication and encryption choices combine in the listener’s security protocol:

Here : every listener is PLAINTEXT and bound to 127.0.0.1 . There is no authentication, no authorization and no encryption. That is safe only because nothing outside this host can connect. Kafbat UI likewise has no login and is loopback-only behind nginx. See “Planned Improvements” for authentication and remote-client TODOs.

Delivery Guarantees and Transactions

A transaction lets a producer write to several partitions or topics atomically: a consumer with isolation.level=read_committed sees all of it or none of it. A consumer in the default read_uncommitted sees records that a transaction has not yet committed, or later aborted. Transactions rely on an internal topic __transaction_state ; on this one-broker install its replication factor is 1 (see py3/bisos/kafka/kafkaInfo.py ), otherwise the first transactional send would fail.

Common Terminology Mistakes

“Kafka is a message queue.” In a queue, reading removes the message. In Kafka reading removes nothing; records expire by retention. Two consumer groups each get every record. Use log for the model.

Treating kafka.internal as Kafka. is Kafbat UI, a separate open-source web application that is itself a Kafka client . Kafka proper is the broker on 127.0.0.1:24007 , and it does not speak HTTP. Pointing a browser or curl at the broker port gets garbage.

Expecting order across a topic. Order holds only within a partition. If order matters for a set of records, give them the same key.

Thinking a consumer “acknowledges and deletes”. A consumer commits an offset , which is only a bookmark. Records are removed by retention.

Calling the cluster the broker, or the other way round. A broker is one server process. A cluster is a set of them. Here they happen to be one.

Confusing source/sink with producer/consumer. See the section: source and sink are Kafka Connect and data-flow terms; producer and consumer are the Kafka client roles.

Calling any Kafka process “the server” or “a node” without saying which. Say broker, controller or node (with its role).

“Exactly once” as a blanket promise. It covers work inside Kafka. A sink that writes to an external system (a database, a file) is still at least once unless that write is itself idempotent. Make the write repeatable (rewrite the same file, upsert by key).

Mixing up encryption and authentication. TLS ( SSL in the config) hides traffic; it does not say who the client is. SASL says who, and over SASL_PLAINTEXT it does not hide it. Authorization (ACLs) is a third step.

Saying “SSL”. The protocol is TLS. Kafka’s setting names kept the old word.

Changing the partition count casually. A topic’s partitions can be increased, never decreased, and increasing remaps keys to different partitions, breaking “same key, same partition” for existing data.

Taking replication factor 1 for safety. One copy on one broker means a lost disk loses the data. Replication factor and min.insync.replicas are the safety; this single node deliberately has neither.

A wrong advertised listener. A client connects to the bootstrap address, receives the advertised addresses, then fails on those. The usual cause of “it connects, then times out”. The bootstrap server is not a special server; it is just the first address tried.

Believing ZooKeeper is needed. Not since Kafka 4.0. Metadata is in KRaft.

Assuming large payloads are fine. The default maximum record size is 1 MB. Large files are sent as many line-sized records (the Stage 2 design), or as a reference to the file.

Calling an offset a time. An offset is a per-partition sequence number. Timestamps are separate, and Kafka can look up an offset by timestamp.

What You See on This Host

In Kafbat UI: Topics lists topics and shows each one’s partitions, offsets and messages; Consumers lists consumer groups and how far behind each one is; Brokers shows the broker. Everything there is read from, or sent to, the broker as an ordinary client would.

A first exercise from a shell (see quickKafka.cs for the cheat sheet):

Then read the topic again with --group g2 and see the same three records again; that is the difference between a log and a queue.

Every fact below lives in one place, py3/bisos/kafka/kafkaInfo.py , which the sbom, the units, the dns and vhost files and the admin CS all read.

librdkafka is the C client library under the confluent-kafka Python package. It is built from a pinned, checksummed source tarball with Kerberos (GSSAPI), which the PyPI wheels lack; a client that must reach a Kerberos cluster builds its binding against it. See KafkaUsePython.org .

The account’s numbers come from banna’s registry, not from useradd ’s per-host choice, so kafka is 503 on every platform; the sbom refuses if 503 is already taken.

The three config files are written only when absent, so hand overrides survive re-runs of the sbom. kafkaAdmin.cs -i driftCheck reports how a live file differs from what its generator would write.

Storage is formatted ( kafka-storage.sh format --standalone ) only when /var/lib/kafka/data/meta.properties is absent. Formatting a used data directory again would mint a new cluster id and orphan every topic.

Both run as User=kafka . Kafbat UI uses Wants rather than Requires , so it stays up, showing the cluster as offline, while kafka.service restarts.

Ports are assigned in bisos.banna ( tcpPorts.py ), never hardcoded. Every listener binds loopback only: the broker serves this host’s tenants, and Kafbat UI has no authentication.

Clients use bootstrap.servers=127.0.0.1:24007 .

The sources for the bisos.kafka pip package are maintained at:

The bisos.kafka pip package is available at PYPI as

You can install bisos.kafka with pip or pipx.

Installation With pip

If you need access to bisos.kafka as a python module, install it with pip:

Installation With pipx

If you only need access to bisos.kafka on the command line, install it with pipx:

The following commands are made available:

kafkaAdmin.cs — day-to-day admin CS for this host’s kafka.internal installation.

quickKafka.cs — direct-command cheat sheet for the Kafka CLI tools and the two systemd units.

kafka-assemble.cs — assembly step: kafka.internal dns entry and nginx vhost.

cbmProc-kafka.spcs — planted CBM pointer that materializes the CBS at this host.

The planted .pcs files ( kafka-cbs.pcs , kafka-sbom.pcs , kafkaUsage-sbom.pcs , kafkaCbs-sbom.pcs , kafka-sysd.pcs , kafbat-ui-sysd.pcs , kafka-here-dns.pcs , kafka-wvd.pcs ) are invoked directly from py3/bin/ .

Day-to-Day Admin: kafkaAdmin.cs

Run with no arguments (or -i examples ) to see the full . Key sub-commands:

Direct Kafka CLI Cheat Sheet: quickKafka.cs

For direct kafka-*.sh / systemctl / journalctl invocations, and hints for reading Kafbat UI, run:

Files Over Kafka: kafkaFileSend.cs and kafkaFileReceive.cs

Two commands, generic and optional, that carry files through Kafka and, if wished, rebuild them. They are ordinary Kafka clients (a producer and a consumer), not Kafka Connect connectors, and they know nothing any particular consumer: topic, key, headers, identity headers and output paths are all parameters. Needs the Python package confluent-kafka (for Kerberos, built against the library kafkaUsage-sbom.pcs provides; see KafkaUsePython.org ).

Try it. Against this host’s broker, with a file every host has; runs as shown, in either order (the receiver starts at the earliest offset, and the broker creates the topic on first send). Both commands show these lines first in their menus.

A second receive with the same group reads nothing new; a resend of an unchanged file is received as a duplicate and skipped.

Send. Each file becomes one Kafka transaction; each line one record. The value is the line without its terminator, and every record carries the headers you give. A consumer that knows nothing files reads plain, headed rows.

In the default --model files the first record also carries a kfx-bof header and the last a kfx-eof header (JSON): the path (relative to --root , so a hierarchy can be reproduced), size, line count, SHA-256, the line terminator, and which headers identify the file. The BOF is what the sender declared ; the EOF is what it observed while streaming, and if they differ the file changed during the send and the sender aborts its own transaction. With --model records there are no markers.

Receive. Reads as a read_committed consumer, buffers each file until its last record, checks lines, bytes and SHA-256 against both markers, and writes it atomically under --outBase , reproducing the sent path (or placing it with --pathTemplate ). The same path with the same content is skipped.

A rejected file (a failed check, a path that is not relative, a malformed marker) is reported and skipped; it does not stop the stream. Both commands exit non-zero if anything failed. Security settings ( sasl.* , ssl.* ) come from --clientConf , a file of librdkafka name=value lines.

Known limits, by decision: lines only (no chunking of binary files); one uniform line terminator per file; non-empty files; a file is held in memory by sender and receiver; senders are assumed benevolent (paths are checked against mistakes, not attacks); a sender killed mid-transaction holds back read_committed readers of that partition until transaction.timeout.ms (60 s by default). Design and reasons: AI-WorkPlan.org , Stage 2. Tests: tests/test_kafkaFileTransfer.py (no broker) and tests/integration_kafkaFileTransfer.py (this host’s broker).

py3/bisos/kafka/kafkaFileTransfer.py — the pure module: records from a file, the receiver’s assembler, path checks, atomic placement, and the thin confluent-kafka layer.

py3/bisos/kafka/kafkaFileTransfer_csu.py — the two Cmnds, fileSend and fileReceive , and their examples.

py3/bin/kafkaFileSend.cs , py3/bin/kafkaFileReceive.cs — the two thin commands over that unit.

tests/ — unit and integration tests of the file transfer, and tests/clientCompare/ (client comparison and the Kerberos handshake test).

py3/bisos/kafka/kafkaInfo.py — the single source of facts: pinned versions and checksums, paths, ports, and the generators of the three config files and the units’ identity lines.

py3/bin/kafka-cbs.pcs — CBS declaring the bundle (sbom + 2 sysd units + assemble).

py3/bin/cbmProc-kafka.spcs — planted CBM pointer leaf that materializes the CBS.

py3/bin/kafka-sbom.pcs — the server’s package installation via bisos.sbom : the JRE from apt, then Kafka and Kafbat UI from upstream.

py3/bin/kafkaUsage-sbom.pcs — the usage side, for a host that uses a broker (its own or another’s): the pinned librdkafka built with Kerberos, and its build packages. The server sbom does not pull it in.

py3/bin/kafkaCbs-sbom.pcs — the sbom of kafka-cbs.pcs : runs the two above. It exists because a CBS names one sbom.

py3/bin/kafka-sysd.pcs , py3/bin/kafbat-ui-sysd.pcs — the two units.

py3/bin/kafka-assemble.cs — assembly step (dns + vhost).

py3/bin/kafka-here-dns.pcs — .internal fake-domain DNS registration for kafka.internal .

py3/bin/kafka-wvd.pcs — nginx vhost for kafka.internal , proxying (unbuffered, for Kafbat UI’s message streaming) to Kafbat UI on loopback.

py3/bin/kafkaAdmin.cs , py3/bin/quickKafka.cs — admin CS and cheat sheet.

py3/tests/verify.sh — smoke test for kafkaAdmin.cs and quickKafka.cs .

py3/setup.py , py3/pypiProc.sh — PyPI packaging (setup.py is dblock-driven; do not hand-edit).

Layered on top of Debian, BISOS (By* Internet Services Operating System) is a unified and universal framework for developing both internet services and software-service continuums that use internet services. See Bootstrapping ByStar, BISOS and Blee for information getting started with BISOS.

BISOS is a foundation for The Libre-Halaal ByStar Digital Ecosystem which is described as a cure for losses of autonomy and privacy in a book titled: Nature of Polyexistentials

bisos.kafka is part of BISOS. It is a standalone package that can be used independently of the full BISOS environment.

bisos.kafka is part of the ByStar Digital Ecosystem .

This module’s primary documentation is in the form of Blee-Panels. Blee-Panels are in the ./py3/panels directory. From within Blee and BISOS these panels are accessible under the Blee “Panels” .

See ./py3/panels/bisos.kafka/_nodeBase_/fullUsagePanel-en.org for a starting point.

bisos.kafka is best developed with Blee , the By* BISOS Libre-Halaal Emacs Environment — a layer on top of Emacs and BISOS which creates a comprehensive integrated usage and development environment.

For support, criticism, and questions; please the author/maintainer Mohsen Banan at:

Authentication for Kafbat UI, so it can listen beyond loopback

Remote clients: a non-loopback broker listener, with SASL/TLS

Live status Cmnds in kafkaAdmin.cs (broker reachable, quorum leader) rather than printed examples

A Capability Materialization figure (kafka-graphviz.pcs), as bisos.airflow has

List confluent-kafka in the package requirements ( setup.py requires is generated; the lazy import in kafkaFileTransfer.py is missed by detection, so a pipx install does not bring the client)