KafkaProducerActor

The KafkaProducerActor is a Coral Actor that can write JSON objects to Kafka.

Creating a KafkaProducerActor

The KafkaProducerActor has "type": "kafka-producer". The params value is a JSON object with the following fields:

field type required description
topic String yes the name of the Kafka topic
kafka JSON yes the configuration parameters for the Kafka producer


The properties of the kafka attribute should include at least the following:

field type required description
metadata.broker.list string yes the brokers to use initially.


Other supplied properties will be interpreted as Kafka producer properties, if the field matches a Kafka consumer property.

Example

{
  "type": "kafka-producer",
  "params": {
    "topic": "test",
      "kafka": {
        "metadata.broker.list": "broker1:9092,broker2:9092"
      }
    }
  }
}

Trigger

The KafkaProducerActor is triggered by incoming JSON messages. The entire JSON object is sent to the Kafka topic specified in the constructor.

Emit

The KafkaProducerActor emits nothing to other actors. Its only output is the message that it puts on Kafa.

State

The KafkaProducerActor does not keep state.

Collect

The KafkaProducerActor does not collect state from other actors.

Timer

The KafkaProducerActor does not provide timer actions.