Skip to main content

Kafka

Distributed event streaming with KRaft consensus (no ZooKeeper), SASL/SCRAM authentication, and TLS.

Versions

VersionStatusNotes
4.0AvailableRecommended
3.9Available
3.6Available

Connecting

ParameterValue
Bootstrap{name}.db.foundrydb.com:9093
Security protocolSASL_SSL
SASL mechanismSCRAM-SHA-256

Full connection examples for all languages: Connection Strings →

Topics

Create a topic

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/kafka/topics \
-H "Content-Type: application/json" \
-d '{
"name": "user-events",
"partitions": 6,
"replication_factor": 3,
"config": {
"retention.ms": "604800000",
"cleanup.policy": "delete"
}
}'

List topics

curl -u admin:password \
https://api.foundrydb.com/managed-services/{id}/kafka/topics

Update topic config

curl -u admin:password -X PATCH \
https://api.foundrydb.com/managed-services/{id}/kafka/topics/user-events \
-H "Content-Type: application/json" \
-d '{"config": {"retention.ms": "2592000000"}}'

Delete a topic

curl -u admin:password -X DELETE \
https://api.foundrydb.com/managed-services/{id}/kafka/topics/user-events

Topic Configuration Reference

Config keyDefaultDescription
retention.ms604800000 (7d)How long to keep messages
retention.bytes-1 (unlimited)Max bytes per partition
cleanup.policydeletedelete (by time/size) or compact (keep latest key)
compression.typeproducergzip, snappy, lz4, zstd, uncompressed
min.insync.replicas2Minimum in-sync replicas for acks=all
max.message.bytes1048576 (1MB)Maximum message size

Users and ACLs

Each database user gets SASL credentials. Scope permissions per topic:

# Create a producer user
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/database-users \
-H "Content-Type: application/json" \
-d '{
"username": "my-producer",
"acls": [
{"topic": "user-events", "operation": "write"},
{"topic": "user-events", "operation": "describe"}
]
}'

# Create a consumer user
curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/database-users \
-H "Content-Type: application/json" \
-d '{
"username": "my-consumer",
"acls": [
{"topic": "user-events", "operation": "read"},
{"group": "my-consumer-group", "operation": "read"}
]
}'

Consumer Groups

# List consumer groups
curl -u admin:password \
https://api.foundrydb.com/managed-services/{id}/kafka/consumer-groups

# Get group lag
curl -u admin:password \
https://api.foundrydb.com/managed-services/{id}/kafka/consumer-groups/my-group/lag

Monitor consumer lag to detect processing bottlenecks. High lag means consumers are falling behind producers.

Scaling

Add brokers to increase throughput and fault tolerance:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/nodes \
-H "Content-Type: application/json" \
-d '{"role": "broker"}'

After adding brokers, rebalance existing topic partitions to spread load:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/kafka/rebalance

Configuration

curl -u admin:password -X PATCH \
https://api.foundrydb.com/managed-services/{id}/configuration \
-H "Content-Type: application/json" \
-d '{
"parameters": {
"auto.create.topics.enable": "false",
"default.replication.factor": "3",
"min.insync.replicas": "2",
"log.retention.hours": "168"
}
}'
ParameterDefaultDescription
auto.create.topics.enabletrueDisable to enforce explicit topic creation
default.replication.factor3Default replication factor for new topics
min.insync.replicas2Min ISR — producers with acks=all require this
log.retention.hours168 (7d)Default message retention
message.max.bytes1048576Max broker message size

Metrics

curl -u admin:password \
"https://api.foundrydb.com/managed-services/{id}/metrics?metric=messages_in&period=1h"

Key metrics: messages_in_per_sec, bytes_in_per_sec, bytes_out_per_sec, under_replicated_partitions, consumer_lag.

Backups

Kafka topic data snapshots are taken daily.

# List backups
curl -u admin:password https://api.foundrydb.com/managed-services/{id}/backups