-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
siddhi-kafka-cep | ||
================ | ||
|
||
- This is a simple CEP Engine leveraging the [Kafka Streams](http://docs.confluent.io/3.2.0/streams/) platform. | ||
|
||
Key Features | ||
============ | ||
|
||
- This project integrates Kafka Streams with [WSO2 Siddhi CEP Engine](https://github.com/wso2/siddhi) and allows the | ||
users to leverage the best features of both platforms. | ||
|
||
- The complex CEP patterns supported by Siddhi ([link](https://docs.wso2.com/display/CEP310/Queries)) can be used for | ||
processing events. | ||
|
||
Getting started | ||
=============== | ||
|
||
- Compile the cep engine with maven. | ||
|
||
```$xslt | ||
mvn clean install | ||
``` | ||
|
||
- Start the cep engine with the scripts in the `scripts` directory. | ||
|
||
Architecture | ||
============ | ||
|
||
[Design](CEP_design.PNG) | ||
|
||
Api | ||
=== | ||
|
||
- The Java api documentation to create a new Siddhi Rule can be found [here](siddhi-kafka-rule-manager/apidocs/index.html). | ||
|
||
- The Java api documentation to publish & receive data from the CEP Engine can be found [here](siddhi-kafka-streams-executor/apidocs/index.html). | ||
|
||
Examples | ||
======== | ||
|
||
- Examples for using the Java api s can be found the [example](example) directory. | ||
|
||
```$xslt | ||
``` | ||
|
||
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. | ||
|
||
```$xslt | ||
mvn jetty:run | ||
``` | ||
|
||
## Payloads | ||
|
||
- To create a Siddhi Rule: | ||
|
||
POST http://localhost:8080/cep/{streamId}/rule | ||
|
||
Body: | ||
|
||
```$xslt | ||
{ | ||
"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: | ||
|
||
```$xslt | ||
{ | ||
"topic": "t1", | ||
"bootstrapServers": "localhost:9092", | ||
"data": [["Rectangle", 19.0, 19], ["Square", 21.0, 21]] | ||
} | ||
``` | ||
|