Hi Pranavan, Actually I missed pointing this out in the earlier mail, the thing is, if you are using output rate limiting, your window should act more like a sliding window. You can refer to the implementation within Siddhi at [1]. Looking at the code you have already written, it seems your CurveFinderWindowProcessor is based on the Siddhi TimeBatchWindowProcessor. The issue in that implementation is that it will output the events once they are expired only. i.e. for a 10 min window it will output the events received within that specific 10 mins as a batch at the end of the window time period.
For output rate limiting of 1 min to work, your extension would have to act more similar to a sliding window (similar to the implementation in [1]). For example, if you write your curve fitting window to be similar to a sliding window, then whenever a new event comes, you can recalculate the curve function after ejecting any expired events and taking into consideration the new event. Then you can output the newly calculated values for the curve immediately. But since you have put an output rate limiter of 1 min in front, the events would actually come out of the query every 1 min. Will that approach work for your usecase? However, please note that if there are other specific requirements when implementing this CurveFitting extension, it might be efficient to implement this logic within your window processor extension itself. In that case, what you can do is implement the logic to pass the events to next processor at 1 min intervals, but still keep the events in the window itself for 10 min. e.g. Keep the window size to 10 min, but make the window processing be scheduled for 1 min interval. Then at the the time of calling the nextProcessor.process(event) method, do an additional check to see if the event is older for 1 min and dispatch to the next processor. You might have to maintain additional queues to know which events have been dispatched, but still in the window and which events are in window and not yet dispatched. The sum of the events in both those queues will be the actual window. I am simply suggesting an alternative approach here that might work.If you need to go with "CustomWindow hanldes all" approach. You might have to figure out other implementation details and adjust the design accordingly. Can you consider the above 2 approaches suggested/any other feasible approaches and decide which is more appropriate taking into consideration the usecase for this extension as well? [1] https://github.com/wso2/siddhi/blob/2.2.x/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/query/processor/window/TimeWindowProcessor.java Thanks, Lasantha On 17 July 2015 at 09:51, Pranavan Theivendiram <[email protected]> wrote: > Hi Lasantha, > > I am using it. But I have some problems in getting the snapshot events of > 1 minute. Can you tell me a method how can I get those? > > Thanks > > *T. Pranavan* > *BSc Eng Undergraduate| Department of Computer Science & Engineering > ,University of Moratuwa* > *Mobile| *0775136836 > > On 16 July 2015 at 11:32, Lasantha Fernando <[email protected]> wrote: > >> [Please copy dev list as well so that we can get input/feedback from a >> wider community in any discussions] >> >> Hi Pranavan, >> >> If you want to output every 1 min, you can use output rate limiting of >> Siddhi [1]. i.e. Keep a window of 10 min, and put output rate limiting to >> output all every 1 min. >> >> Will that work for your usecase? Can you write your curve fitting >> extension as a normal sliding time window and then put output rate limiting >> in front of that window and see if that fits your usecase? >> >> [1] https://docs.wso2.com/display/CEP310/Output+Rate+Limiting >> >> Thanks, >> Lasantha >> >> On 15 July 2015 at 20:41, Pranavan Theivendiram < >> [email protected]> wrote: >> >>> >>> Hi Lasantha, >>> The thing is that I have a window of 10 min. I am outputiing the events >>> every one min. >>> So I need to save the events as ten chunks of event lists. ( 10 lists of >>> events) >>> ? >>> >>> Is that possible? >>> >>> Thanks >>> >>> *T. Pranavan* >>> *BSc Eng Undergraduate| Department of Computer Science & Engineering >>> ,University of Moratuwa* >>> *Mobile| *0775136836 >>> >>> On 15 July 2015 at 11:34, Lasantha Fernando <[email protected]> wrote: >>> >>>> Hi Pranavan, >>>> >>>> Can you elaborate more on what you mean by keeping the events in 10 >>>> blocks and removing and adding of 1 min of events? >>>> >>>> If you need to output when 10 events are accumulated, then you have to >>>> write that logic where nextProcessor.process() is called in the run() >>>> method. However, that would be similar to a length batch window, and you >>>> won't be able to introduce any time constraint. >>>> >>>> If you want to process in batches of 10, you can modify the logic in >>>> if(removeEvent == null) condition. >>>> >>>> Can you work a bit further to modify the logic as necessary for your >>>> usecase? Then it will be easier to understand the issue you are facing by >>>> looking at your code. >>>> >>>> Thanks, >>>> Lasantha >>>> >>>> On 14 July 2015 at 21:58, Pranavan Theivendiram < >>>> [email protected]> wrote: >>>> >>>>> Kind remainder >>>>> >>>>> Thanks >>>>> >>>>> *T. Pranavan* >>>>> *BSc Eng Undergraduate| Department of Computer Science & Engineering >>>>> ,University of Moratuwa* >>>>> *Mobile| *0775136836 >>>>> >>>>> On 14 July 2015 at 08:05, Pranavan Theivendiram < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi Lasantha, >>>>>> >>>>>> I am implementing a Sliding Window Processor for cep 3.1.0. The >>>>>> execution plans can be found in the link below. >>>>>> 1- >>>>>> https://github.com/Pranavan135/stratos/blob/CurveFittingGSoC/extensions/cep/artifacts/executionplans/CurveFinderOfHealthRequest.xml >>>>>> >>>>>> The implementation of Window Processor can be found below. >>>>>> >>>>>> 2 - >>>>>> https://github.com/Pranavan135/stratos/blob/CurveFittingGSoC/extensions/cep/stratos-cep-extension/src/main/java/org/apache/stratos/cep/extension/CurveFinderWindowProcessor.java >>>>>> >>>>>> Can you please suggest me a method where I can keep the events 10 >>>>>> blocks. (Removing and Adding of 1 min of events)? >>>>>> >>>>>> Thanks >>>>>> *T. Pranavan* >>>>>> *BSc Eng Undergraduate| Department of Computer Science & Engineering >>>>>> ,University of Moratuwa* >>>>>> *Mobile| *0775136836 >>>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> *Lasantha Fernando* >>>> Senior Software Engineer - Data Technologies Team >>>> WSO2 Inc. http://wso2.com >>>> >>>> email: [email protected] >>>> mobile: (+94) 71 5247551 >>>> >>> >>> >> >> >> -- >> *Lasantha Fernando* >> Senior Software Engineer - Data Technologies Team >> WSO2 Inc. http://wso2.com >> >> email: [email protected] >> mobile: (+94) 71 5247551 >> > > -- *Lasantha Fernando* Senior Software Engineer - Data Technologies Team WSO2 Inc. http://wso2.com email: [email protected] mobile: (+94) 71 5247551
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
