Skip to main content

Kafka

Listen to messages from Apache Kafka topics with consumer group management, offset control, and schema-aware deserialization.

Creating a Kafka listener

  1. Click the + Add Artifact button in the canvas or click + next to Entry Points in the sidebar.

  2. In the Artifacts panel, select Kafka under Event Integration.

    Artifacts panel showing Kafka under Event IntegrationArtifacts panel showing Kafka under Event Integration
  3. In the creation form, fill in the following fields:

    Kafka listener creation formKafka listener creation form
    FieldDescription
    Bootstrap ServersComma-separated list of Kafka broker addresses (e.g., localhost:9092). Required.
    Topic(s)One or more Kafka topic names to subscribe to. Required.

    Expand Advanced Configurations to set the listenerName, which is the name assigned to the listener.

  4. Click Create.

  5. WSO2 Integrator opens the Kafka Listener Designer. The header shows the listener configuration pill and the + Add Handler button.

    Kafka Listener Designer showing the listener configurationKafka Listener Designer showing the listener configuration
  6. Click + Add Handler button, which will open the Select Handler to Add drawer on the right.

  7. Pick onConsumerRecord, then click Save. This opens the Flow Designer for onConsumerRecord.

    Flow canvas for Kafka listener onConsumerRecord handlerFlow canvas for Kafka listener onConsumerRecord handler
  8. Use the flow canvas to add integration steps such as database writes, HTTP calls, and transformations.

Service configuration

Service configuration controls the service name and the Kafka listener it is attached to.

In the Kafka Listener Designer, click Configure to open the Kafka Event Integration Configuration panel.

The left panel shows the service name and its Attached Listeners. Pick the Kafka Listener under Attached Listeners to configure the listener connection settings in the main configuration panel.

Kafka Listener Configuration panelKafka Listener Configuration panel

Main configurations

FieldDescription
NameIdentifier for the listener, used in the service declaration. Required.
Bootstrap ServersComma-separated list of Kafka broker host:port addresses. Required.
TopicsTopics for the consumer to subscribe to.
Group IdConsumer group identifier for coordinated offset tracking.
Offset ResetStrategy when no committed offset exists: earliest, latest, or none.
Partition Assignment StrategyClass that implements the partition assignment strategy among consumer group members.

What's next