Giter VIP home page Giter VIP logo

flink-siddhi's Introduction

flink-siddhi

Travis CI Clojars Project

A light-weight library to run Siddhi CEP within Apache Flink streaming application.

Siddhi CEP is a lightweight and easy-to-use Open Source Complex Event Processing Engine (CEP) released as a Java Library under Apache Software License v2.0. Siddhi CEP processes events which are generated by various event sources, analyses them and notifies appropriate complex events according to the user specified queries.

This project is mainly to provide a light-weight library to easily run Siddhi CEP within flink streaming application.

Features

  • Integrate Siddhi CEP as an stream operator (i.e. TupleStreamSiddhiOperator), supporting rich CEP features like
    • Filter
    • Join
    • Aggregation
    • Group by
    • Having
    • Window
    • Conditions and Expressions
    • Pattern processing
    • Sequence processing
    • Event Tables
    • ...
  • Provide easy-to-use Siddhi CEP API to integrate Flink DataStream API (See SiddhiCEP and SiddhiStream)
    • Register Flink DataStream associating native type information with Siddhi Stream Schema, supporting POJO,Tuple, Primitive Type, etc.
    • Connect with single or multiple Flink DataStreams with Siddhi CEP Execution Plan
    • Return output stream as DataStream with type intelligently inferred from Siddhi Stream Schema
  • Integrate siddhi runtime state management with Flink state (See AbstractSiddhiOperator)
  • Support siddhi plugin management to extend CEP functions. (See SiddhiCEP#registerExtension)

Development

Prerequisites

  • Java (Version: 1.8)
  • Apache Maven
  • Apache Flink (Version: 1.7.0)

Clone

git clone [email protected]:haoch/flink-siddhi.git

Building

mvn clean install -DskipTests

Testing

mvn clean test

Usage and API

  • Add com.github.haoch:flink-siddhi in project dependencies:

      <dependencies>
              <dependency>
                      <groupId>com.github.haoch</groupId>
                      <artifactId>flink-siddhi_2.11</artifactId>
                      <version>LATEST</version>
              </dependency>
      </dependencies>
      
      <repositories>
              <repository>
                      <id>clojars</id>
                      <url>http://clojars.org/repo/</url>
              </repository>
      </repositories>
    
  • Execute SiddhiQL with SiddhiCEP API, for example:

      StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
      SiddhiCEP cep = SiddhiCEP.getSiddhiEnvironment(env);
      
      cep.registerExtension("custom:plus",CustomPlusFunctionExtension.class);
      
      cep.registerStream("inputStream1", input1, "id", "name", "price","timestamp");
      cep.registerStream("inputStream2", input2, "id", "name", "price","timestamp");
      
      DataStream<Tuple5<Integer,String,Integer,String,Double>> output = cep
           .from("inputStream1").union("inputStream2")
           .cql( 
           "from every s1 = inputStream1[id == 2] "
           + " -> s2 = inputStream2[id == 3] "
           + "select s1.id as id_1, s1.name as name_1, s2.id as id_2, s2.name as name_2 , custom:plus(s1.price,s2.price) as price"
           + "insert into outputStream")
          .returns("outputStream");
      
      env.execute();
    

    For more examples, please see org.apache.flink.contrib.siddhi.SiddhiCEPITCase

Documentations

Support and Contact

Contributors

Contribution

Welcome to make contribution to code or document by sending a pull request, or reporting issues or bugs.

License

Licensed under the Apache License, Version 2.0. More details, please refer to LICENSE file.

flink-siddhi's People

Contributors

aagupta1 avatar aparup avatar dr0na avatar haoch avatar lizhizhou avatar pranjal0811 avatar tammypi avatar wittyameta avatar wujinhu avatar

Watchers

 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.