Siddhi CQEngine used within filter section

My incoming event contains userId property. I'd like to be able to read the parameter value according to userId from the CQEngine. Should I implement this as extension of FunctionExecutor and use it like:

define stream cseEventStream (userId string, symbol string, price long, volume long);
@info(name = 'query1')
from cseEventStream [price < custom:cache(userId)]
select *
insert into Output

or is there some better way how to do it. The problem is that before first use of CQEngine I need to initialize it with data. Probably "start" method of the FunctionExecutor could be used for this purpose?

Answers


You can go ahead with a FunctionExecutor and implement initialization logic within either init() or start(). Both will be called once per function usage. Calling order is init() followed by start(). However, as per API doc, it's advised to use start() to acquire required resources for the processing element. and stop() to release acquired resources.


Need Your Help

Automate Visual Studio Setup Project

visual-studio visual-studio-2008

I'm using Visual Studio 2008 and I want to automate the process of building the installer by running a batch file.

Merge same items and add their quantity

php menuitem inventory

I need help. How to code this in PHP? If I am using a form method to input item# and quantity