Skip to content

kafka_sink on kafka-out, certified; the kcat sink joins the Kerberos route (ADR-0044 step 5) - #120

Merged
cpoder merged 4 commits into
masterfrom
feat/kafka-sink-recipe
Dec 5, 2026
Merged

cpoder merged 4 commits into
masterfrom
feat/kafka-sink-recipe

Conversation

@cpoder

@cpoder cpoder commented Dec 5, 2026

Copy link
Copy Markdown
Owner

ADR-0044 step 5: the kafka_sink recipe on kafka-out, certified through admission, and the kcat sink moved to the Kerberos route.

The recipe

  • kafka_sink.vjs.example is a manifest on kafka-out: SCRAM-SHA-256 over TLS, the same settings as kafka_source. overrides.json points it at the admission's 4.4.0 helper broker (SASL_PLAINTEXT, the vejas test user).
  • broker.sh starts the helper and makes orders.enriched with 3 partitions. kafka-out makes no topic.
  • dataflow.sh publishes one bus message with Vejas-Key and Nats-Msg-Id. It reads the record back from the topic and checks the key, the value and Vejas-Emit-Id.
  • The helper e2e/admission/brokers/kafka.sh gets a consume <port> <topic> <n> command, the console consumer with headers and key. Only the last n lines are kept, because the tool printed a notice on stdout before the record. That notice made the first local run fail.
  • EXCEPTION.md goes.

The kcat sink of the Kerberos route

docs/examples/kafka-kerberos/kafka_orders_out.vjs.example uses the GSSAPI flags of the source example. It adds two things.

-X partitioner=murmur2_random. I checked by hand with Ubuntu's kcat 1.7.1 and librdkafka 2.3.0 against 4.4.0: 13 keys on a topic of 7 partitions. With the flag, 0 keys were off the Java client's partition. With librdkafka's default partitioner, 12 were off.

A small guard, kcat-sink.sh, because two cases lost data in silence when I tested them by hand:

Body kcat -P Exit
empty writes no record 0
a\nb writes two records 0
2 MB refuses it 1

exec-sink acks on exit 0, so the first two would be acked wrong. The guard refuses both, puts the reason on stderr, which the runtime logs with the nak, and exits 2. The message is delivered again, then becomes a dead letter. Any other body goes to kcat unchanged: I checked NUL and CR bytes. Like kcat-source.sh, the script execs kcat, so no shell waits on it.

The SCRAM finding, only as far as I verified it.

  • Ubuntu's kcat 1.7.1 with librdkafka 2.3.0 failed a SCRAM-SHA-256 login over SASL_PLAINTEXT to the 4.4.0 helper broker.
  • The broker log says "Failed authentication ... invalid credentials with SASL mechanism SCRAM-SHA-256", and kcat exited 1.
  • With the same user and password, kafka_source (kafka-in) and kafka_sink (kafka-out) were admitted.
  • I did not look for the cause.

The example and the exec bridges page say to use kafka-out for SCRAM.

e2e/kafka.sh phase 11. It takes the example's CMD line from the file and swaps the Kerberos flags for the plaintext listener. The rewrite fails if the example no longer has the expected form. Then:

  • 40 keys with a header go to the topic of phase 10's 40 keys. Each lands on the partition that the Java producer and kafka-out gave it, and keeps its header.
  • An empty body and a body of two lines are refused and said in the log, and no record is written.

Docs

  • Catalog: one Kafka row, source and sink on the runtime's own client, and no kcat recipe. The recipe index no longer lists the Kafka sink as a stated exception.
  • ADR-0022 is marked superseded by 0044, except for Kerberos. ADR-0044's status line says steps 1 to 5 are built and step 6, detect time order, is open. Both rows of the ADR index are updated.
  • CHANGELOG: one entry under Changed. I also removed "kafka_sink stays on kcat until kafka-out" from the unreleased kafka_source entry.
  • Book:
    • brokers.md: the Kafka row, and the key and headers bullet, now on kafka-out.
    • exec.md: the Kerberos section gains the sink.
    • concepts/connectors.md: "read and written".
  • In core, the GSSAPI refusal is shared by kafka-out, and it said "read through kcat, one partition per manifest". It now says "read and written ... as docs/examples/kafka-kerberos shows". The unit test still holds, since it only checks for "kcat".

Verified locally

  • Admission, with a scratch copy of run.sh on the debug binary: kafka_sink and kafka_source were both admitted.
  • e2e/kafka.sh with the debug build:
    • Phases 1 to 8 pass. That first run had no kcat on PATH.
    • Phases 9 to 11 pass with Ubuntu's kcat, in a trimmed copy of the script.
  • vjs-check of the Kerberos sink example: ok.

Left out

  • The Kerberos login itself: there is no KDC in CI, the same as for the source.
  • The kcat sink's throughput: kcat runs once per message, with one connection each.
  • The cause of the kcat SCRAM failure.
  • Step 6, detect time order.

🤖 Generated with Claude Code

https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT

cpoder and others added 4 commits December 5, 2026 12:35
…route

The kafka_sink recipe becomes a manifest on kafka-out (ADR-0044, step 5),
certified through admission against the 4.4.0 helper broker with SCRAM, as
kafka_source is: its broker.sh makes the topic, and its dataflow.sh sends
one bus message with a key and an id, then reads the record back from the
topic and checks the key, the value and Vejas-Emit-Id. The helper gains a
consume command. The recipe's EXCEPTION.md goes.

The kcat sink moves to docs/examples/kafka-kerberos, with Kerberos flags,
partitioner=murmur2_random so that a key lands where the Java client and
kafka-out put it, and kcat-sink.sh in front of kcat. kcat -P writes one
record for each line of its input, and nothing for an empty input, and
exits 0 either way: the driver would ack a body of two lines as two
records, and an empty body with no record. The guard refuses both, says
why, and exits 2. e2e/kafka.sh phase 11 runs the example's command as
written, on the plaintext listener, and checks both refusals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
…built

The catalog keeps one Kafka row, source and sink on the runtime's own
client, and no kcat recipe. The exec bridges page gains the kcat sink of
the Kerberos route: what its guard refuses and why, the partitioner, and
the SCRAM login that Ubuntu's kcat 1.7.1 with librdkafka 2.3.0 failed
against Apache Kafka 4.4.0 where kafka-in and kafka-out passed. ADR-0044's
status says steps 1 to 5 are built and step 6 is open. One CHANGELOG entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
kafka-out shares kafka-in's connection settings, so its refusal of
SASL_MECHANISM = GSSAPI said a Kerberos cluster is read through kcat, one
partition per manifest. It now says read and written, and names the
examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wXgxSSYsPm88PCqu98HPT
@cpoder
cpoder marked this pull request as ready for review December 5, 2026 12:09
@cpoder
cpoder merged commit 591487d into master Dec 5, 2026
7 checks passed
@cpoder
cpoder deleted the feat/kafka-sink-recipe branch December 5, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant