you can try using Hooks API http://storm.apache.org/documentation/Hooks.html; add desired block of code which is supposed to run when topology is started inside prepare() method.
On Thu, Feb 11, 2016 at 3:15 PM Stephen Powis <spo...@salesforce.com> wrote: > Hey! > > I have a question about the storm topology lifecycle. Are there any hooks > in the storm deployment/topology lifecycle? Basically I'd be great if > there was a way to run a block of code during deployment of a new topology > that got fired once on each JVM. > > The issue we've seen so far is when deploying a topology, sometimes we > need to setup some kind of shared resource, maybe a connection pool of some > type (JDBC, HTTP, etc..) and its currently not trivial to do that via the > bolt prepare methods such that it only happens once per JVM. Its > possible, but easy to get wrong :p > > Does something already exist within the storm framework for this that > we've missed? Is it a case of "you're doing it wrong"? > > Thanks! > Stephen >