Hi

When I looked at the sample code you have sent, I believe you have
misunderstood the way Siddhi Snapshot works.

Siddhi does not restore the queries or definitions when restoring, but it
will only restore the states on each query (e.g the partially matched
states in sequence/pattern query, events in windows, running average
values, etc..).
Here on your setup method, you have to create the Siddhi Manager and add
the Stream Definitions, Queries and then restore the state.

You can find a sample test case here
https://github.com/wso2-dev/siddhi/blob/master/modules/siddhi-core/src
/test/java/org/wso2/siddhi/test/management/PersistenceTestCase.java

Regards
Suho



On Mon, Sep 1, 2014 at 7:20 PM, Antonio Jesus Navarro <ajnava...@stratio.com
> wrote:

> Hi all,
>
> I could not fix the problem.
>
> Someone can explain me what i'm doing wrong?
>
> Thanks in advance.
>
>
> 2014-08-13 9:53 GMT+02:00 Antonio Jesus Navarro <ajnava...@stratio.com>:
>
> Hi Rajeev and Tishan,
>>
>> I add a couple of tests to show the two possible use cases described, one
>> using PersistenceStore implementation, and other using snapshot() and
>> restore(...) SiddhiManager methods.
>>
>> Thanks.
>>
>>
>> 2014-08-12 15:35 GMT+02:00 Tishan Dahanayakage <tis...@wso2.com>:
>>
>> Hi Antonio,
>>> To clarify further can you please share your query with us?
>>>
>>> Thanks,
>>> Tishan
>>>
>>>
>>> On Tue, Aug 12, 2014 at 6:47 PM, Rajeev Sampath <raje...@wso2.com>
>>> wrote:
>>>
>>>> Hi Antonio,
>>>>
>>>>
>>>> On Tue, Aug 12, 2014 at 2:55 PM, Antonio Jesus Navarro <
>>>> ajnava...@stratio.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> Siddhi version 2.1.0-wso2v1 have new service called SnapshotService. I
>>>>> think this service is used to recover the siddhi context from an 
>>>>> unexpected
>>>>> shutdown. The service have a method to generate a byte array with snapshot
>>>>> data, and a method to restore this snapshot.
>>>>>
>>>>> Byte array generation works perfect. The byte array is generated with
>>>>> all Snapshotable elements. But I think there are a bug into the restore
>>>>> method. It iterates a snapshotable list of elements that in the first
>>>>> instance are empty, and the byte array is never setted to siddhiContext.
>>>>>
>>>>> In restore() method, it lets all the snapshotables (windows, patterns
>>>> etc) to restore themselves instead of setting it in SiddhiContext by
>>>> calling restore() on all of them. All the required components such as
>>>> windows, patterns that has a state implements this functionality.
>>>>
>>>> When you are using Siddhi as a library, when restoring you'll have to
>>>> call siddhiManager.setPersistStore() with whatever store implementation you
>>>> have and then call restoreLastRevision() to restore it to the previous
>>>> state.
>>>>
>>>>
>>>> Thanks
>>>> Rajeev
>>>>
>>>>
>>>>
>>>>>  I am misunderstanding something? Or it is a bug?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Architecture mailing list
>>>>> Architecture@wso2.org
>>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Rajeev Sampath
>>>> Senior Software Engineer
>>>> WSO2, Inc.; http://www.wso2.com.
>>>>
>>>> Mobile:
>>>> * +94716265766 <%2B94716265766>*
>>>>
>>>> _______________________________________________
>>>> Architecture mailing list
>>>> Architecture@wso2.org
>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>
>>>>
>>>
>>>
>>> --
>>> 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.
>>>
>>> _______________________________________________
>>> Architecture mailing list
>>> Architecture@wso2.org
>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>
>>>
>>
>
> _______________________________________________
> Architecture mailing list
> Architecture@wso2.org
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 

*S. Suhothayan*
Technical Lead & Team Lead of WSO2 Complex Event Processor
 *WSO2 Inc. *http://wso2.com
* <http://wso2.com/>*
lean . enterprise . middleware


*cell: (+94) 779 756 757 | blog: http://suhothayan.blogspot.com/
<http://suhothayan.blogspot.com/>twitter: http://twitter.com/suhothayan
<http://twitter.com/suhothayan> | linked-in:
http://lk.linkedin.com/in/suhothayan <http://lk.linkedin.com/in/suhothayan>*
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to