Thanks Manoj & Tishan for your response. On Fri, Oct 24, 2014 at 5:31 PM, Tishan Dahanayakage <[email protected]> wrote:
> Hi Rajeevan, > > Please see inline comments. > > On Fri, Oct 24, 2014 at 4:27 PM, Manoj Gunawardena <[email protected]> > wrote: > >> Hi Rajeevan, >> >> Are you going to call currentState method from your custom window? The >> current state method call from SnapshotService class inside snapshot >> method. At that point it was call SiddhiContext ThreadBarrier close. I >> think if you call current state method, you need to follow similar >> mechanism to stop incoming events pass to window processor while you are >> getting current state of the queue. >> >> Thanks >> >> >> On Fri, Oct 24, 2014 at 11:34 AM, Rajeevan Vimalanathan < >> [email protected]> wrote: >> >>> Hi Rajeev, >>> >>> In the Top-K implementation, a library instance is being used for >>> keeping a desired event attribute values. So in the case of CEP goes down >>> that library instance should be persisted and when it coms up library >>> instance should be reset by previous value. According to my knowledge, this >>> can be done by returning library instance with currentState() and resetting >>> that from restoreState(). >>> >> >>> I have to confirm following things, >>> >>> 1) Transformer init() is invoked before restoreState() when CEP comes up >>> >> Yes. init() will be invoked first and then restoreState() will be > invoked. > > 2) We can persist an object by returning it as an Object[] element from >>> currentState() >>> >> Yes. you can persist an Object given the fact that Object implements > Serializable. Just create an Object[] with objects you need to persist and > return it. As an example if we take a WindowProcessor, it's currentState() > will return an Object[] containing current window which is an > implementation of ISiddhiQueue so that whole window and its content will be > persisted. Please refer one of WindowProcessor implementations for code > samples. > >> >>> >>> >>> On Fri, Oct 24, 2014 at 10:40 AM, Rajeev Sampath <[email protected]> >>> wrote: >>> >>>> Hi, >>>> >>>> On Fri, Oct 24, 2014 at 10:12 AM, Rajeevan Vimalanathan < >>>> [email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> We are writing a Siddhi Transformer for Top-K implementation by >>>>> extending TransformProcessor class. There was a need to >>>>> overwrite currentState() and restoreState() methods from >>>>> TransformProcessor >>>>> class. So I want to know in which scenarios those methods are called and >>>>> what should be the ideal implementation? >>>>> >>>>> >>>> WSO2 CEP has a feature to persist snapshots to recover from failures. >>>> This is a configurable feature and once enabled, it persists snapshots of >>>> the components such as windows etc periodically. So the currentState() is >>>> where the state should be returned to persist. restoreState() gets called >>>> when CEP goes down and comes up, to restore the last saved state to resume >>>> processing from that point. >>>> >>>> So for your case, if there's anything that need to be available even >>>> after the node goes down and comes up, return it in currentState(). Also >>>> implement the restoreState() properly to restore whatever persisted. >>>> >>>> >>>> Thanks >>>> Rajeev >>>> >>>> >>>>> -- >>>>> Best Regards, >>>>> V.Rajeevan >>>>> Software Engineer, >>>>> WSO2 Inc. :http://wso2.com >>>>> >>>>> Mobile : +94 773090875 >>>>> Email : [email protected] >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> [email protected] >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>>> >>>> -- >>>> Rajeev Sampath >>>> Senior Software Engineer >>>> WSO2, Inc.; http://www.wso2.com. >>>> >>>> Mobile: >>>> * +94716265766 <%2B94716265766>* >>>> >>> >>> >>> >>> -- >>> Best Regards, >>> V.Rajeevan >>> Software Engineer, >>> WSO2 Inc. :http://wso2.com >>> >>> Mobile : +94 773090875 >>> Email : [email protected] >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Manoj Gunawardena >> Tech Lead >> WSO2, Inc.: http://wso2.com >> lean.enterprise.middleware >> Mobile : +94 77 2291643 >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Tishan Dahanayakage > Software Engineer > WSO2, Inc. > Mobile:+94 716481328 > > Disclaimer: This communication may contain privileged or other > confidential information and is intended exclusively for the addressee/s. > If you are not the intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should not > print, copy, re-transmit, disseminate, or otherwise use the information > contained in this communication. Internet communications cannot be > guaranteed to be timely, secure, error or virus-free. The sender does not > accept liability for any errors or omissions. > -- Best Regards, V.Rajeevan Software Engineer, WSO2 Inc. :http://wso2.com Mobile : +94 773090875 Email : [email protected]
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
