Configure Clients
This pages explains how to configure your Apache Kafka client with WarpStream.
var (
// Not explicitly required, but will eliminate inter-zone networking
// in multi-zone deployments.
availabilityZone = lookupAZ()
// Not explicitly required, but may help with debugging to isolate
// individual clients in logs and telemetry.
sessionID = uuid.New().String()
// The string you would normally use as your client ID with regular
// Apache Kafka.
applicationID = "application-foo"
// WarpStream Client ID configurations should be key value pairs and comma seperated.
clientID = fmt.Sprintf("%s,ws_si=%s,ws_az=%s", applicationID, sessionID, availabilityZone)
bootstrapServer = "api-80ba097c-d4ef-4e0b-8e86-d05b80fee6ed.kafka.discoveryv2.prod-z.us-east-1.warpstream.com:9092"
)
producerConfig := map[string]kafka.ConfigValue{
// Not developing locally? In K8s you should use the Agent
// service from Agent chart. If you're not using K8s, then
// you can use our convenience hosted bootstrap URL which
// you can find in the "Connect" tab of the virtual cluster
// view in the WarpStream console.
"bootstrap.servers": "localhost:9092",
"broker.address.family": "v4",
"log.connection.close": "false",
"client.id": clientID,
}
config := kafka.ConfigMap(producerConfig)
producer, err := kafka.NewProducer(&config)
if err != nil {
return fmt.Errorf("error initialiazing kafka producer: %w", err)
}Client IDs
Last updated
Was this helpful?