Skip to main content
Version: v2.0.0

Kafka connector

Audience: operators bridging EventMesh with Kafka. Move events between EventMesh topics and an Apache Kafka cluster. The source consumes a Kafka topic with a consumer group and commits offsets only after EventMesh accepted the publish; the sink writes CloudEvent payloads to a target topic.


Classes

DirectionClassBehavior
Sourceorg.apache.eventmesh.connector.kafka.source.KafkaSourceConnectorPolls a source topic via KafkaConsumer (manual offset commit); each record becomes a CloudEvent (id = topic-partition-offset). commit() runs commitSync after the runtime accepted the batch.
Sinkorg.apache.eventmesh.connector.kafka.sink.KafkaSinkConnectorProduces each CloudEvent's data bytes to the target topic via KafkaProducer.

Source configuration

KeyDefaultDescription
bootstrapServerslocalhost:9092Kafka bootstrap servers
topicsource-topicTopic to consume
groupIdeventmesh-connector-sourceConsumer group id
pollTimeoutMs1000Kafka poll timeout in ms

Sink configuration

KeyDefaultDescription
bootstrapServerslocalhost:9092Kafka bootstrap servers
topicsink-topicTarget topic to produce into

Running

bin/start-connector.sh with CONNECTOR_OPTS="-Dconnector.class=org.apache.eventmesh.connector.kafka.source.KafkaSourceConnector -Dconnector.mode=source -Dconnector.topic=my-topic -DbootstrapServers=broker:9092"