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
> 2) We can persist an object by returning it as an Object[] element from
> currentState()
>
>
>
> 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

Reply via email to