Search code examples
siddhiwso2-cep

WSO2 CEP: Can I query from rdms table inside siddhi query


I am trying to learn WSO2 CEP 4.2.0, and I stumble upon some problem with Siddhi query.

Can I getting data from other system rdbms table to use it in event processing ? From WSO2 CEP documentation I found about event table, but that's not what I need.

The scenario is like this: I use WSO2 CEP to receive tracking data from vehicle. I use that data stream to perform geo-analytical process (geo-fencing, speed limit) and service analytic. For service analytical process I need to lookup to transactional data-table from other system.

Thanks.


Solution

  • From the given information, it seems like your requirement is achievable by using Event Tables. You can lookup the table by doing a 'join between an event and the table. Please refer Join section in Siddhi Query Language guide.

    For an example on how to use a JOIN operation with an Event Table, please refer to Sample 0106 - Using in-memory event tables.

    ** Although the sample defines an in-memory event table as below...

    define table CardUserTable (name string, cardNum string, blacklisted bool) ;

    ...you can change this definition to make it an RDBMS Event Table by putting the @From annotation. E.g.

    @From(eventtable='rdbms', datasource.name='CardTableDatasource', table.name='CardData') define table CardUserTable (name string, cardNum string, blacklisted bool) ;

    @From annotation elements are being described in RDBMS event table section in the Siddhi documentation.