KafkaConsumerActor

The KafkaConsumerActor (Kafka consumer actor) is a Coral Actor that listens to a Kafka topic and emits incoming Kafka messages as JSON messages.

Creating a KafkaConsumerActor

The KafkaConsumerActor has "type": "kafka-consumer". The params value is a JSON with the following fields:

field type required description
topic string yes the Kafka topic to read
kafkagroup.id string yes the unique identifier to read a stream.
kafkazookeeper.connect string yes the ip address(es) of the ZooKeeper node(s) to connect to.


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

Example

{
  "type": "kafka-consumer",
  "params": {
    "topic": "clickstream",
    "kafka": {
      "zookeeper.connect": "localhost:2181",
      "group.id": "mygroup"
    }
  }
}


The group.id is a unique identifier that Kafka uses to memorize the offset in the topic the actor listens to. For instance, if a Kafka consumer actor has listened to 100 messages from the start using group.id “mygroup”, any other Kafka consumer actor with the same group.id will start from message 101. If another group.id is chosen, the offset is set to 0.

Trigger

The KafkaConsumerActor has no trigger, but is triggered by incoming Kafka events on the topic the actor listens to.

Emit

The KafkaConsumerActor emits Kafka messages as JSON objects. Message bodies of Kafka events are assumed to be in proper JSON format.

State

The KafkaConsumerActor keeps no state.

Collect

The KafkaConsumerActor does not collect state from other actors.

Timer

The KafkaConsumerActor does not provide timer actions.