I'm using storm to process some data streams.
At the beginning I read an xml file where I find statements used in Esper bolts. Soon after I define my topology and run it on a cluster. Now, if I want to change a statement in a bolt, I have to modify the xml, stop the cluster, and restart it from the beginning.
Is possible a scenery that sees a thread that checks my xml and when finds new statements defined can update the Esper Bolt with the new statement while the cluster is going on?
I defined an Esper bolt as follows:
String statement = "select count(*) as userPerMinutes from event.win:time_batch(60 sec)";
EsperBolt esperBolt = new EsperBolt.Builder()
.inputs().aliasComponent("user")
.withField("field1").ofType(String.class)
.withField("field2").ofType(Integer.class)
.withField("field3").ofType(Long.class)
.toEventType("event")
.outputs().onDefaultStream().emit("userPerMinutes")
.statements().add(statement)
.build();
In a thread how can I access to this bolt and edit/add/remove its statement? Through the topology? And how?
I have a similar system. Using storm + esper to run a distributed event process system. Esper can remove and add epl at runtime. How my system does so is, start a new thread in bolt to sync epl from a database from time to time. Update the changed one (remove and then add).
Hope this helps.
add code might be useful
EPStatement statement = esperAdmin.getStatement(rule.getName());
if (statement != null) {
statement.destroy();
}