Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wso2 理解siddhi快照概念_Wso2_Buffer_Complex Event Processing_Siddhi_Wso2mb - Fatal编程技术网

Wso2 理解siddhi快照概念

Wso2 理解siddhi快照概念,wso2,buffer,complex-event-processing,siddhi,wso2mb,Wso2,Buffer,Complex Event Processing,Siddhi,Wso2mb,我有查询和执行计划,我想拍下它的快照,这样我就可以在接收方恢复它并再次开始执行它 应该向接收者发送什么格式 如何在接收方恢复 以下是我从Siddhi存储库中获取的一些代码 SiddhiManager siddhiManager = new SiddhiManager(); String query = "define stream inStream(meta_roomNumber int,meta_temperature double);" +

我有查询和执行计划,我想拍下它的快照,这样我就可以在接收方恢复它并再次开始执行它

  • 应该向接收者发送什么格式
  • 如何在接收方恢复 以下是我从Siddhi存储库中获取的一些代码

     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();
    

    您可以使用
    PersistenceStore
    持久化执行计划的状态(快照)并在以后恢复。请参考以下内容了解其用法。i、 e

        // Create executionPlanRuntime
        ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(executionPlan);
    
        // Register Callbacks, InputHandlers
        executionPlanRuntime.addCallback("query1", queryCallback);
        stream1 = executionPlanRuntime.getInputHandler("Stream1");
    
        // Start executionPlanRuntime
        executionPlanRuntime.start();
    
        // Send events
        stream1.send(new Object[]{"WSO2", 25.6f, 100});
        Thread.sleep(100);
        stream1.send(new Object[]{"GOOG", 47.6f, 100});
        Thread.sleep(100);
    
        // Persist the state
        executionPlanRuntime.persist();
    
        // Shutdown the running execution plan
        executionPlanRuntime.shutdown();
    
        // Create new executionPlanRuntime
        executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(executionPlan);
    
        // Register Callbacks, InputHandlers
        executionPlanRuntime.addCallback("query1", queryCallback);
        stream1 = executionPlanRuntime.getInputHandler("Stream1");
    
        // Start executionPlanRuntime
        executionPlanRuntime.start();
    
        // Restore to previously persisted state
        executionPlanRuntime.restoreLastRevision();