Skip to content

Kafka Sink ​

Status: Supported as Built-in Connector in rekuiper

rekuiper includes a built-in Kafka sink connector implemented directly in Rust with rskafka. You do not need to compile or deploy Go dynamic plugins (.so files) or build custom plugin container images.

The Kafka sink publishes output messages to an Apache Kafka topic.

Configuration Properties ​

Property NameOptionalDefault ValueDescription
brokersTrue"127.0.0.1:9092"Comma-separated list of Kafka broker addresses (host:port).
topicFalseNoneTarget Kafka topic name.
partitionTrue0Target topic partition index.
keyTrueNoneField name from the result record used as the Kafka message key.

rekuiper serializes each outgoing record into JSON bytes and delivers it to the designated Kafka topic partition using bounded asynchronous retries.

Sample Usage ​

Basic Kafka Publication ​

The following rule processes high-temperature readings and publishes the results to a Kafka topic:

json
{
  "id": "rule_kafka_alert",
  "sql": "SELECT deviceId, temperature, timestamp FROM sensorStream WHERE temperature > 50.0",
  "actions": [
    {
      "log": {}
    },
    {
      "kafka": {
        "brokers": "10.0.0.10:9092,10.0.0.11:9092",
        "topic": "alerts_telemetry",
        "partition": 0
      }
    }
  ]
}

Partitioning by Message Key ​

To ensure that events from the same device route consistently to Kafka partitions, configure the key property:

json
{
  "id": "rule_kafka_keyed",
  "sql": "SELECT deviceId, reading, ts FROM rawStream",
  "actions": [
    {
      "kafka": {
        "brokers": "127.0.0.1:9092",
        "topic": "device_events",
        "key": "deviceId"
      }
    }
  ]
}

Network Configuration Notes ​

When running rekuiper in containerized environments (such as Docker or Kubernetes), verify network reachability to the Kafka brokers:

  1. Use container service names or bridge network hostnames instead of localhost or 127.0.0.1.
  2. Ensure KAFKA_CFG_ADVERTISED_LISTENERS on the Kafka broker is resolvable and reachable from the rekuiper network namespace.

rekuiper is open source (Apache-2.0 / MIT) · For an all-in-one MQTT broker with embedded rekuiper rules, see IndraMQTT.