0

I am writing a small CEP program using Siddhi. I can add a callback whenever a given filter outputs a data like this

executionPlanRuntime.addCallback("query1", new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(inEvents);
            System.out.println("data received after processing");
        }
    });

but is there is a way to know that the filter has finished processing and it won't give any more of the above callback. Something like didFinish. I think that would be the ideal place for shutting down SiddhiManager and ExecutionPlanRuntime instances.

shshnk
  • 1,621
  • 14
  • 26

1 Answers1

1

No. There in no such functionality and can't be supported in the future also. Rationale behind that is, in real time stream processing queries will process the incoming stream and emit an output stream. There is no concept as 'finished processing'. Query will rather process event as long as there is input.

Since your requirement is to shutdown SiddhiManager and ExecutionPlanRuntime, recommended way is to do this inside some cleaning method of your program. Or else you can write some java code inside callback to count responses or time wait and call shutdown. Hope this helps!!

Tishan
  • 890
  • 6
  • 11
  • Thanks for your explanation. I have implemented something similar. When I am done giving input to the query I wait for 5 seconds before calling a shutdown. Very crude approach I know but this is what I am doing now. – shshnk Dec 04 '15 at 13:10