3

we are currently testing siddhi wso2 cep.

we need to be able to restart the wso2 server process without loosing data which has been accumulated in a window (for example time window).

Is there a way to make time windows persistent so that the server can be restarted without loosing its state ?

Do we have to configure the server to use persistence ?

Or do we just have to adapt the query and use event table ?

Here a sample of our query:

from every data= DataInStream[state == 1] -> 
   every event = EventInStream[event.no == data.no] within 24h
       insert into duplicatesOutStream data.id as id
Kasun Gajasinghe
  • 2,735
  • 1
  • 21
  • 30
ron
  • 418
  • 4
  • 12

1 Answers1

4

You can make the CEP persist it's state by enabling snapshots. The documentation can be found here. But note that this will persist the "entire state" of the CEP "periodically" (configurable in minutes). Since this is done only periodically, you may lose the latest few events that arrived after the last snapshot operation. If you want cep to recover after a crash, this is the easiest option.

Apart from this, there's no other way to make a pre-defined window persistent. But if you want, you can write a your own custom time window (documentation) that will do the persistence and plug it to CEP.

You can also use event tables instead. When you use event tables, you can make sure that all arrived events are persisted. (but one disadvantage of this approach is this can be a performance hit compared to windows + snapshots approach).

Rajeev Sampath
  • 2,739
  • 1
  • 16
  • 19
  • I have been able to activate cassandra and thus persist the bucket state. The issue we are having now is that when the server is shut down using cntrl-c or when wrapped with yajsw the shutdown hooks are executed in parallel and cassandra is shut down before the state is persisted. Is there a way to call shutdownGracefully from some static method or through a shutdown port (similarly to tomcat) ? – ron Dec 06 '13 at 10:47
  • There are two ways to gracefully shutdown a wso2carbon based server: 1. from the terminal - open another terminal, switch to /bin and run the command ./wso2server.sh -stop 2. you can also shut down from the web ui (management console) – Rajeev Sampath Dec 06 '13 at 13:24
  • thanks. to cleanly close the wso2 server i have added the following to the yajsw wrapper.conf: `wrapper.app.shutdown.script=${wrapper_home}/scripts/wso2_shutdown.gv` the groovy script is invoked when wso2 receives a stop command from yajsw. the script invokes shutdownGracefully on the mbean server: `import javax.management.* servers = MBeanServerFactory.findMBeanServer(null) beanName = "org.wso2.carbon:type=ServerAdmin" servers.each(){try{new GroovyMBean(it, beanName).shutdownGracefully()} catch (Exception ex){println ex}}` – ron Dec 06 '13 at 15:11
  • i will add this script and the wso2 configuration to the samples of the next yajsw release. – ron Dec 09 '13 at 13:40