Skip to content

feat: add Apache Kafka destination provider#779

Open
alexluong wants to merge 15 commits intomainfrom
feat/kafka-destination
Open

feat: add Apache Kafka destination provider#779
alexluong wants to merge 15 commits intomainfrom
feat/kafka-destination

Conversation

@alexluong
Copy link
Collaborator

@alexluong alexluong commented Mar 22, 2026

Summary

  • Add Apache Kafka as a destination provider with support for PLAIN, SCRAM-SHA-256, and SCRAM-SHA-512 SASL authentication
  • Add Kafka test infrastructure for local development/QA
  • Fix portal destination type list scroll and config form overlap
  • Add select field type to portal destination config, used for Kafka SASL Mechanism dropdown

Closes #141

Test plan

  • Create Kafka destination with brokers, topic, and each SASL mechanism — destination created successfully
  • Publish events to Kafka destination — events delivered to correct topic
  • Portal renders SASL Mechanism as a dropdown with correct options
  • Edit existing Kafka destination — config values reflected correctly
  • TLS toggle works as expected
  • Partition key template extracts key from event payload
  • go build passes

🤖 Generated with Claude Code

alexluong and others added 4 commits March 22, 2026 20:58
Implement Kafka as a new destination type with SASL auth (plain,
scram-sha-256, scram-sha-512), TLS support, and configurable partition
keys via JMESPath templates. Extract shared partition key evaluator
from Kinesis into reusable partitionkey package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Kafka to test compose (confluent-local), testinfra helper, and
rename test services with test- prefix to avoid name collisions when
sharing the outpost Docker network.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make destination type list scrollable and fix Create Destination button
overlapping form fields when there are many config fields (e.g. Kafka).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add generic select field type to the portal destination config system
and use it for Kafka SASL Mechanism, replacing the free-text input with
a dropdown (None, PLAIN, SCRAM-SHA-256, SCRAM-SHA-512).

Closes #141

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
outpost-docs Ready Ready Preview, Comment Mar 23, 2026 8:48am
outpost-website Ready Ready Preview, Comment Mar 23, 2026 8:48am

Request Review

@alexluong alexluong changed the title feat(portal): add select field type for destination config feat: add Apache Kafka destination provider Mar 22, 2026
Add "Timed Out" pattern to also match kafka-go's RequestTimedOut
protocol error, not just Go-level i/o timeouts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alexluong
Copy link
Collaborator Author

Local testing guide

1. Start Kafka UI

docker run -d --name outpost-kafka-ui \
  -p 38080:8080 \
  -e KAFKA_CLUSTERS_0_NAME=outpost-test \
  --network outpost \
  -e KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=test-kafka:29092 \
  provectuslabs/kafka-ui:latest

Open http://localhost:38080

2. Create a topic

In Kafka UI, create a topic (e.g. test-events).

3. Create a Kafka destination via Portal

Open the portal at http://localhost:3334 and create a new destination:

  • Type: Apache Kafka
  • Brokers: test-kafka:29092
  • Topic: test-events
  • SASL Mechanism: None
  • TLS: unchecked

4. Publish an event

curl -X POST http://localhost:3333/api/v1/publish \
  -H "Authorization: Bearer apikey" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "tenant_1",
    "topic": "user.created",
    "data": {"user_id": "u_123", "email": "test@example.com"},
    "metadata": {"event-id": "evt_abc"}
  }'

5. Verify delivery

  • Check the Outpost portal for the delivery status
  • Check Kafka UI (http://localhost:38080) → topic test-events:
    • Payload matches the published event data
    • Partition key is correct (based on partition_key_template if configured)
    • Headers include expected metadata

6. Cleanup

docker rm -f outpost-kafka-ui

Add select to DestinationSchemaField type enum with options property.
Add kafka to destination type path enum and list example.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
alexluong and others added 4 commits March 23, 2026 00:19
- Require username/password credentials when SASL mechanism is configured
- Accept empty string for TLS config in Validate (treat as "not configured")
- Add WriteTimeout (10s) and MaxAttempts (3) to kafka.Writer
- Use "authentication" instead of "auth" in ClassifyKafkaError to avoid
  overly broad string matching

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use fixed host port (19092) for kafka test container so advertised
  listeners match the actual port clients connect to
- Add KafkaURL to non-TESTINFRA config path for consistency
- Use atomic.Bool for KafkaConsumer.shuttingDown to fix data race

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensures the parent component is notified when the select value changes,
consistent with how other field types propagate changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Test CreatePublisher with each SASL mechanism (plain, scram-sha-256,
  scram-sha-512) to exercise the buildSASLMechanism code path
- Add comprehensive ClassifyKafkaError tests covering all error
  categories

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The registry already enforces DeliveryTimeout via context deadline on
every Publish call. A hardcoded WriteTimeout would silently cap delivery
time regardless of the configured timeout. Let the context control it,
consistent with how webhook and other providers work.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
alexluong and others added 2 commits March 23, 2026 15:35
SASL mechanism + credentials are now mandatory. TLS defaults to enabled.
Field order updated: brokers, topic, TLS, partition key, SASL mechanism.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove viewport-height constraints and inner container scrolling so
the page scrolls naturally when form content overflows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Destination - Kafka

2 participants