No Description

Mahesh 1f7a0a3796 Merge pull request #27 from MaheshMadushan/GetTableName 1 week ago
.github c900383931 Update maven.yml 2 months ago
.idea d6e52af864 Code refactoring v0 2 months ago
src cc13225f7c SiddhiAppGenerator moved to SiddhiAppComopiste 1 week ago
target d6e52af864 Code refactoring v0 2 months ago
.gitattributes 01ca43e8e4 Initial commit 4 months ago
.gitignore bcadda79ba Update .gitignore 2 months ago
LICENSE 2cab1d7994 Create LICENSE 1 month ago
README.MD 1f7a0a3796 Merge pull request #27 from MaheshMadushan/GetTableName 1 week ago
pom.xml 1707f54c74 added method to get table name of the projection SQL. 1 week ago

README.MD

High Level Architecture

plot

Usage

String sqlStatement = "SELECT  ip@string,  timestamp@string, SUM(traffic@int) as sum_traffic " +
                " FROM networkTrafficTable WHERE (traffic@int = 1000 AND traffic@int > 2000)";

        SiddhiAppComposites siddhiApp = SiddhiAppComposites.SiddhiAppGenerator
                .generateSiddhiApp(
                        "SiddhiAppName-dev-custom-app-name",
                        sqlStatement,
                        new LiveSource().addSourceComposite(new KeyValue<>("newFieldToSourceAnnotation", "FieldValue")),
                        new JsonMap().addMapComposite(new KeyValue<>("enclosing.element", "$.properties")),
                        new JsonMapAttributes(),
                        new LogSink(),
                        new QueryInfo().setQueryName("SQL-SiddhiQL-dev")
                );

        System.out.println(siddhiApp.getSiddhiAppStringRepresentation());

Output

@app:name('SiddhiAppName-dev-custom-app-name')
@source(type = 'live',sql.query = 'SELECT  ip,  timestamp, SUM(traffic) as sum_traffic  FROM networkTrafficTable WHERE (traffic = 1000 AND traffic > 2000)',@map(type = 'json',enclosing.element = '$.properties',@attributes(ip = 'ip',timestamp = 'timestamp',traffic = 'traffic')))
define stream networkTrafficTableInputStream(ip string,timestamp string,traffic int);
@sink(type = 'log',@map(type = 'json'))
define stream networkTrafficTableOutputStream(ip string,timestamp string,sum_traffic int);
@info(name = 'SQL-SiddhiQL-dev')
from networkTrafficTableInputStream[( traffic == 1000 AND traffic > 2000 ) ]
select  ip  , timestamp  ,SUM( traffic )  as sum_traffic 
insert into networkTrafficTableOutputStream;