javawso2complex-event-processingsiddhiwso2-cep

Which kind of objects are supported by Siddhi for the "object" attribute type?


I am performing some experimentations for a prototype using Siddhi as a CEP engine, and would like to know if the input streams only support flat event data or can also support a JSON-like data hierarchy for queries.

Siddhi's documentation refers to an object type for attributes, but I could not find anyhere what this type refers to.

In the code samples provided in the source repository, this attribute type is also never used.

Extending one of the queries written in these examples, I would like to be able to do something like:

String executionPlan = ""
    + "define stream cseEventStream (symbol string, price float, volume long, data object); "
    + " "
    + "@info(name = 'query1') "
    + "from cseEventStream[volume < 150 and data.myKey == 'myValue'] "
    + "select symbol,price "
    + "insert into outputStream ;";

Is any kind of JSON-like data supported by Siddhi ? If yes, what Java object types should be passed to the InputHandler ?


Solution

  • It accepts java.lang.Object instances. So you can pass any java object there. But those objects are pass-through only (Siddhi engine just passes them along with the event) and you won't be able to do any modifications/processing to those objects unless you write some custom extension.

    If you want to process json inputs, use WSO2 CEP product. You will be able to define mappings and disassemble the json input to some primitive types like string, int, float etc that the Siddhi engine can process.