Code Monkey home page Code Monkey logo

siddhi-kafka-cep's Introduction

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.
mvn clean install
  • Start the cep engine with the scripts in the scripts directory.

  • Create a siddhi rule using the command

java -cp example-1.0-SNAPSHOT-jar-with-dependencies.jar org.apache.kafka.SiddhiRuleGenerator
  • Start the event receiver using the command
java -cp example-1.0-SNAPSHOT-jar-with-dependencies.jar org.apache.kafka.SiddhiStreamsDataReceiver
  • Publish data to the Engine using the command
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.
mvn jetty:run

Payloads

  • To create a Siddhi Rule:

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

    Body:

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

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

    Body:

      {
      	"topic": "t1",
      	"bootstrapServers": "localhost:9092",
      	"data": [["Rectangle", 19.0, 19], ["Square", 21.0, 21]]
      }
    

siddhi-kafka-cep's People

Contributors

sbcd90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.