WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
Skip to end of metadata
Go to start of metadata

Prerequisites

Follow the steps below before starting this Kafka sample    configurations.

  1. Set up the prerequisites required for all samples

  2. Configure WSO2 CEP by adding relevant jars to support Kafka transport.
  3. Configure sample client by adding relevant jars. See setting up Kafka for Kafka sample clients
  4. Start the Apache ZooKeeper server with the following command: bin/zookeeper-server-start.sh config/zookeeper.properties. You view the below logs. For more information, see Apache Kafka documentation
    Apache ZooKeeper server start up logs
  5. Then start the Kafka server with the following command:  bin/kafka-server-start.sh config/server.properties.  You view the below logs.
    Kafka server startup logs

Building the sample 

Start the WSO2 CEP server with the sample configuration numbered 0018. For instructions, see Starting sample CEP configurations. This sample configuration creates the following.

  • An event stream with the ID org.wso2.event.sensor.stream:1.0.0
  • An event receiver named kafkaReceiver to fetch events from the configured receiver email address  
  • An event publisher named loggerEventPublisher to log the received messages

Executing the sample 

Navigate to the  <CEP_HOME>/samples/cep/producers/kafka/ directory, and execute the following Ant command using another tab in the CLI:  ant -Durl=localhost:9092 -Dtopic=sensordata -Dsn=0018

The other optional parameters that can be used in the above command are defined in the  <CEP_HOME>/samples/cep/producers/kafka/build.xml  file.

This builds the Kafka client and publishes the JSON events in the  <CEP_HOME>/samples/cep/artifacts/0018/sensordata.txt  file to the  kafkaReceiver  endpoint.  You can view the details of the events that are sent as shown below.

events produced by the CEP producer

You view the CEP server receiving the JSON events in the logs of it in the CLI as shown below.

output logs of the events received by WSO2 CEP

  • No labels