task id is what you are looking for: http://nathanmarz.github.io/storm/doc/backtype/storm/task/TopologyContext.html#getThisTaskId() On 2013年12月20日, at 下午6:41, Flavio Livide <[email protected]> wrote:
> I'm trying to figure out how to restore the state of a storm bolt task during > failover. I can persist the state externally (DB or file system) and > associate it to an ID, however once the bolt instance is restarted I need to > point to the specific state of that bolt task to recover it. The prepare > method of a bolt receives a context, documented here > > http://nathanmarz.github.io/storm/doc/backtype/storm/task/TopologyContext.html > > Is there any piece of this context that uniquely identifies the specific task > so I can understand which persistent state to point to? Is that ID preserved > during failover? Alternatively, is there any variable/object I can set for > the specific task that is preserved during failover? > I had a look at the Trident documentation, however I'm trying to embed a 3pp > inside a bolt, and the 3pp has a state, so trident is not a runner in this > case. I'm not in control of how the 3pp persists the state, but I can point > at it (file system or or DB) as long as I have an ID. > > Any help appreciated! > /FLAvio
