Skip to main content
Version: Next

Kafka

The Kafka output produces messages to an Apache Kafka topic using librdkafka. It supports key-based partitioning, compression, configurable acknowledgments, and optional exactly-once transactional production.

Configuration

FieldTypeRequiredDefaultDescription
typestringyesFixed value "kafka"
brokersarray<string>yesList of Kafka broker addresses.
topicobjectyesDestination topic (expression; see below).
keyobjectnoMessage key for partitioning (expression; see below).
client_idstringnoClient identifier.
compressionstringnoOne of none, gzip, snappy, lz4.
acksstringnoAcknowledgment level: 0, 1, or all.
value_fieldstringnoRecord field used as the message payload.
exactly_oncebooleannofalseEnable exactly-once transactional production (L2).
transactional_idstringnoStable transactional id; required when exactly_once is true.

Expression objects

topic and key are Expr<String> objects with one of these shapes:

FieldTypeRequiredDescription
typestringyesvalue (static) or expr (SQL expression).
valuestringyes (value)Static string value.
exprstringyes (expr)SQL expression evaluated per message.

Examples

Static topic and key

output:
type: "kafka"
brokers:
- "localhost:9092"
topic:
type: "value"
value: "my-topic"
key:
type: "value"
value: "my-key"
client_id: "my-client"
compression: "snappy"
acks: "1"

Dynamic topic via SQL expression

output:
type: "kafka"
brokers:
- "localhost:9092"
topic:
type: "expr"
expr: "concat('1','x')"
acks: "all"
value_field: "message"

Exactly-once production

output:
type: "kafka"
brokers:
- "localhost:9092"
topic:
type: "value"
value: "events"
exactly_once: true
transactional_id: "arkflow-events-tx"
acks: "all"

Notes

  • When exactly_once: true, transactional_id must be a non-empty value that is stable across restarts so the broker can fence stale producer epochs (zombie fencing). The builder rejects the configuration otherwise.
  • With exactly-once enabled, each acknowledged message batch is produced inside one Kafka transaction (begin → send → commit). On failure the transaction is aborted and the batch is replayed.
  • See Exactly-once processing for the end-to-end delivery-semantics contract.