Apache Kafka
Overview
Export evaluation data inside a Kafka topic.
NOTE
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:
# ...
exporters:
- kind: kafka
kafka:
topic: "semaphore-events"
addresses:
- "localhost:9092"
# ...| Field name | Mandatory | Type | Default | Description |
|---|---|---|---|---|
kind | Yes | string | none | Value should be kafka.This field is mandatory and describes which retriever you are using. |
kafka.topic | Yes | string | none | Kafka topic to bind to. |
kafka.addresses | Yes | []string | none | List of bootstrap addresses for the Kafka cluster. |
kafka.config | No | object | see description | This 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() |
How kafka.config is merged with the defaults
The configuration starts from the defaults of sarama.NewConfig() and the values you set in kafka.config replace them: a setting you provide always wins over the default (for example Net.DialTimeout, Producer.Retry.Max, ClientID or Version of the Sarama configuration). A setting you leave out keeps the default of Sarama. A zero value (0, "" or false) cannot be told from a setting that is not set, so it keeps the default too. Producer.Return.Successes and Producer.Return.Errors are always true, the exporter needs them.
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:
config := ffclient.Config{
// ...
DataExporter: ffclient.DataExporter{
// ...
Exporter: &kafkaexporter.Exporter{
Settings: kafkaexporter.Settings{
Topic: "semaphore-events",
Addresses: []string{"localhost:9092", "cluster2:9092"},
},
},
},
// ...
}
client, err := ffclient.New(config)
defer client.Close()| Field | Mandatory | Description |
|---|---|---|
Format | No | The format to produce in the topic (only JSON is supported for now). |
Settings | Yes | 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:
| Field | Mandatory | Description |
|---|---|---|
Topic | Yes | Name of the topic to publish messages |
Addresses | Yes | The list of addresses for the Kafka boostrap servers |