The KafkaProducerActor
is a Coral Actor that can write to Kafka.
The creation JSON of the KafkaProducerActor (see Coral Actor) has "type": "kafka-producer"
.
The params
value is a JSON 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. |
The producer type is configured as async. You can change this, but the KafkaProducerActor is designed for non-blocking communication with Kafka.
Other properties may be supplied cf. the Kafka producer properties.
{
"data": {
"type": "actors",
"attributes": {
"type": "kafka-producer",
"params": {
"topic": "test"
"kafka" : {
"metadata.broker.list": "broker1:9092,broker2:9092,broker3:9092"
}
}
}
}
}
The KafkaProducerActor
only does useful work if the trigger is connected. The trigger JSON needs to contain a field message
.
The value of this field is send to Kafka. The optional field key
contains the key to use.
{
"key": "somekey",
"message": {
"key1": "value1",
"key2": "value2"
}
}
The KafkaProducerActor
emits nothing.
Conceptually, the Kafka stream can be thought of as emit.
The KafkaProducerActor
keeps no state.
The KafkaProducerActor
does not collect state from other actors.
The KafkaProducerActor
does not provide timer actions.