I have query and execution plan, I want to take snapshot of that so that I could restore it on receiver side and start executing it again.
- What format should be sent to the receiver?
- How to restore on receiver side?
Following is some code which I have taken from Siddhi repository.
SiddhiManager siddhiManager = new SiddhiManager();
String query =
"define stream inStream(meta_roomNumber int,meta_temperature double);" +
"from inStream#window(10)[meta_temperature > 50]\n" +
"select *" +
"insert into outStream;";
ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(query);
executionPlanRuntime.start();
SiddhiContext siddhicontext = new SiddhiContext();
context.setSiddhiContext(siddhicontext);
context.setSnapshotService(new SnapshotService(context));
executionPlanRuntime.snapshot();
You can use
PersistenceStore
to persist the state (snapshot) of the execution plan and restore it later. Please refer to the following PersistenceTestCase to get an idea on its usage. i.e.;