tree: 0dcb3687bca8e5746903fc7564035122dfde3205
  1. docs/
  2. scripts/
  3. src/
  4. tests/
  5. tools/
  6. Cargo.toml
  7. README.md
gateways/kafka/README.md

Kafka gateway (iggy-gateway-kafka)

Foundation layer for apache/iggy#3421: a TCP listener on the Kafka wire port that decodes requests, validates scoped API keys and versions, and returns stub responses.

Stub warning: no API persists or reads real data yet. Produce, Fetch, and ListOffsets return retriable NOT_LEADER_OR_FOLLOWER (6) so clients keep data locally / retry elsewhere instead of trusting a fake success. CreateTopics does not create topics; valid requests return NOT_CONTROLLER (41). Metadata still reports requested topics as unknown. Persistence lands with the Iggy bridge (see docs/SCOPE.md).

Run

cargo run -p iggy-gateway-kafka

Default bind: 127.0.0.1:9093. Environment variables:

VariableDefaultDescription
IGGY_KAFKA_BIND_ADDR127.0.0.1:9093TCP address to listen on
IGGY_KAFKA_ADVERTISED_HOSTbind IPHostname/IP clients use to reach this broker (required when binding to 0.0.0.0/::)
IGGY_KAFKA_ADVERTISED_PORTbind portPort advertised in Metadata responses
IGGY_KAFKA_MAX_CONNECTIONS1024Maximum concurrent connections before new ones are rejected
IGGY_KAFKA_MAX_FRAME_SIZE8388608Maximum accepted request frame size in bytes
IGGY_KAFKA_IDLE_TIMEOUT_SECS600Seconds a connection may sit idle before the next frame's length prefix arrives
IGGY_KAFKA_READ_TIMEOUT_SECS15Seconds allowed to read a frame body once its length prefix arrives
IGGY_KAFKA_WRITE_TIMEOUT_SECS10Seconds allowed to write a response frame
IGGY_KAFKA_SHUTDOWN_DRAIN_TIMEOUT_SECS25Seconds graceful shutdown waits for in-flight connections before abandoning them

Test

cargo test -p iggy-gateway-kafka

See docs/TEST_SUITE.md for the full suite catalog (cargo test -p iggy-gateway-kafka -- --list for the exact current test names - the count has drifted out of sync with the actual suites before, so it isn't pinned here).

Some api_handler_tests, server_e2e_tests, and version_firewall_tests cases require wire fixtures under tools/kafka-tool/kafka_messages/ (gitignored locally; CI generates them via scripts/ci-wire-fixtures.sh):

./gateways/kafka/scripts/ci-wire-fixtures.sh generate
cargo test -p iggy-gateway-kafka
./gateways/kafka/scripts/ci-wire-fixtures.sh cleanup   # optional

Or generate only the keys the tests need:

for key in 0 1 2 19; do
  cargo run -p kafka-message-gen -- generate \
    --output gateways/kafka/tools/kafka-tool/kafka_messages \
    --api-key "$key"
done

Manual testing

Before check-in, run the procedure in docs/MANUAL_TESTING.md (smoke, version firewall, kcat, adversarial cases).

Scoped APIs

See docs/SCOPE.md for #3421 deliverables, supported API key/version table, and post-foundation TODO backlog.

Wire fixture tool

See tools/kafka-tool/README.md.