All docs This doc
Skip to end of metadata
Go to start of metadata


This sample demonstrates how one way message bridging from Kafka to HTTP can be done using the kafka inbound endpoint.


  • Download and install Apache Kafka. For more information, see Apache Kafka documentation
  • Copy the following client libraries from the <KAFKA_HOME>/libs directory to the <ESB_HOME>/repository/components/lib directory.

    • kafka_2.9.2-
    • scala-library-2.9.2.jar
    • zkclient-0.3.jar
    • zookeeper-3.3.4.jar
    • metrics-core-2.2.0.jar
  • Run the following command to start the ZooKeeper server:

    bin/ config/

    You will see the following log:

  • Run the following command to start the Kafka server

    bin/ config/

    You will see the following log:

Building the sample

The XML configuration for this sample is as follows:

<definitions xmlns="">
<inboundEndpoint xmlns=""
     <parameter name="interval">10</parameter>
     <parameter name="consumer.type">highlevel</parameter>
     <parameter name="content.type">application/xml</parameter>
     <parameter name="coordination">false</parameter>
     <parameter name="sequential">false</parameter>
     <parameter name="topics">test</parameter>
     <parameter name="zookeeper.connect">localhost:2181</parameter>
     <parameter name="">test-1</parameter>
<sequence xmlns="" name="TestIn">
 <log level="full"/>

This configuration file synapse_sample_904.xml is available in the <ESB_HOME>/repository/samples directory.

To build the sample

  • Start the ESB with the sample 904 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
    The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."

Executing the sample

  • Run the following on the Kafka command line to create a topic named test with a single partition and only one replica:

    bin/ --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
  • Run the following on the Kafka command line to send a message to the Kafka brokers. You can also use the WSO2 ESB Kafka producer connector to send the message to the Kafka brokers.

    bin/ --broker-list localhost:9092 --topic test

Analyzing the output

You will see the following Message content:

<soapenv:Envelope xmlns:soapenv="" xmlns:wsa=""><soapenv:Body><m0:getQuote xmlns:m0="http://services.samples">

The Kafka inbound gets the messages from the Kafka brokers and logs the messages in the ESB

  • No labels