Search code examples
siddhi

Retrieve actual event object that triggered a positive response to a Siddhi query


In Siddhi, is it possible to retrieve the actual event that caused a positive response to a query.

For example if i have an event A that causes a condition to be satisfied, I can, via the query projection make available attributes of event A that i wish to use (as a Siddhi core event) in the ExecutionRuntime callback.

However I'd like to retrieve the actual event object that satisfied the query. Not just some/all of its attributes, as I would like to use that complete event as part of further processing. Is this possible?

If it is possible, would I also be able to get back events in the case where multiple events are required to satisfy a complex query(pattern/sequence).

thanks in advance for assistance.


Solution

  • If the query is similar to below (without select attributes / or with a select *), any event satisfies value>20 condition will be accessible from QueryCallback or StreamCallback. However, the event available within the callback would not be exactly the same input event, rather a cloned event of that input event (reason being the events will get cloned internally for expiring purposes etc..).

    from inputStream[value>20]
    insert into outputStream;
    

    However, AFAIK, when it comes to pattern/sequence, getting all events that satisfied the query is impossible.