项目作者: sbcd90

项目描述 :
This is a simple CEP Engine leveraging the Kafka Streams platform
高级语言: Java
项目地址: git://github.com/sbcd90/siddhi-kafka-cep.git
创建时间: 2017-04-25T23:45:50Z
项目社区:https://github.com/sbcd90/siddhi-kafka-cep

开源协议:

下载


siddhi-kafka-cep

  • This is a simple CEP Engine leveraging the Kafka Streams platform.

Key Features

  • This project integrates Kafka Streams with WSO2 Siddhi CEP Engine and allows the
    users to leverage the best features of both platforms.

  • The complex CEP patterns supported by Siddhi (link) can be used for
    processing events.

Getting started

  • Compile the cep engine with maven.
  1. mvn clean install
  • Start the cep engine with the scripts in the scripts directory.

  • Create a siddhi rule using the command

  1. java -cp example-1.0-SNAPSHOT-jar-with-dependencies.jar org.apache.kafka.SiddhiRuleGenerator
  • Start the event receiver using the command
  1. java -cp example-1.0-SNAPSHOT-jar-with-dependencies.jar org.apache.kafka.SiddhiStreamsDataReceiver
  • Publish data to the Engine using the command
  1. java -cp example-1.0-SNAPSHOT-jar-with-dependencies.jar org.apache.kafka.SiddhiStreamDataGenerator

Architecture

Alt text

Api

  • The Java api documentation to create a new Siddhi Rule can be found here.

  • The Java api documentation to publish & receive data from the CEP Engine can be found here
    & here.

Examples

  • Examples for using the Java api s can be found the example directory.

Using Kafka Producers & Consumers

  • The standard Kafka Producers & Consumers can also be used to publish & retrieve
    data out of this engine.

Rest Api

  • A simple REST server is included with this project.

Getting started with the Rest server

  • Run the maven jetty plugin to start the server.
  1. mvn jetty:run

Payloads

  • To create a Siddhi Rule:

    POST http://localhost:8080/cep/{streamId}/rule

    Body:

    1. {
    2. "topic": "t1",
    3. "bootstrapServers": "localhost:9092",
    4. "definitions": ["define stream siddhiStream1 (symbol string, price double, volume long);"],
    5. "rule": "@info(name = 'query1') from siddhiStream1[price < 20.0] select symbol, price, volume insert into outputStream"
    6. }
  • To post streams of data:

    POST http://localhost:8085/cep/{streamId}/stream/data

    Body:

    1. {
    2. "topic": "t1",
    3. "bootstrapServers": "localhost:9092",
    4. "data": [["Rectangle", 19.0, 19], ["Square", 21.0, 21]]
    5. }