Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
Storm provides hooks with which users can insert custom code to run on any number of events(emit, cleanup, spoutAck...) within Storm. Users create a hook by extending the BaseTaskHook class and overriding the appropriate method for the event users want to catch.
There are two ways to register your hook:
1.In the open method of your spout or prepare method of your bolt using the TopologyContext#addTaskHook method.
2.Through the Storm configuration using the "topology.auto.task.hooks" config.You can use user-defined hooks class names as value of "topology.auto.task.hooks" .These hooks are automatically registered in every spout or bolt.
When the events happen, it will get hooks-list from TopologyContext and call hooks function.