Skip to main content
Version: v1.40.0

Apache Kafka

Overview​

Export evaluation data inside a Kafka topic.
info

Apache Kafka is an exporter of type queue, it means that it send events as soon as he receives them it does not work in bulk but in near real time.

Configure the relay proxy​

To configure your relay proxy to use the Apache Kafka exporter, you need to add the following configuration to your relay proxy configuration file:

goff-proxy.yaml
# ...
exporter:
kind: kafka
kafka:
topic: "go-feature-flag-events"
addresses:
- "localhost:9092"
# ...
Field nameMandatoryTypeDefaultDescription
kindstringnoneValue should be kafka.
This field is mandatory and describes which retriever you are using.
kafka.topicstringnoneKafka topic to bind to.
kafka.addresses[]stringnoneList of bootstrap addresses for the Kafka cluster.
kafka.configobjectsee descriptionThis field allows fine tuning of the Kafka reader. This object should contain the Sarama configuration that the reader will use. On empty, a sensible default is created using sarama.NewConfig()

Configure the GO Module​

To configure your GO module to use the Apache Kafka exporter, you need to add the following configuration to your ffclient.Config{} object:

example.go
config := ffclient.Config{
// ...
DataExporter: ffclient.DataExporter{
// ...
Exporter: &kafkaexporter.Exporter{
Settings: kafkaexporter.Settings{
Topic: "go-feature-flag-events",
Addresses: []string{"localhost:9092", "cluster2:9092"},
},
},
},
// ...
}
err := ffclient.Init(config)
defer ffclient.Close()
FieldMandatoryDescription
Format The format to produce in the topic (only JSON is supported for now).
Settings A extension of the *sarama.Config struct that holds additional settings for the producer, such as timeouts, TLS settings, etc. If not populated, a default will be used by calling sarama.NewConfig()

In the settings we have the following fields:

FieldMandatoryDescription
Topic Name of the topic to publish messages
Addresses The list of addresses for the Kafka boostrap servers