A TopologyContext is given to bolts and spouts in their "prepare" and "open"
methods, respectively. This object provides information about the component's
place within the topology, such as task ids, inputs and outputs, etc.

The TopologyContext is also used to declare ISubscribedState objects to
synchronize state with StateSpouts this object is subscribed to.

getThisStreams

getThisTaskIndex

public int getThisTaskIndex()

Gets the index of this task id in getComponentTasks(getThisComponentId()).
An example use case for this method is determining which task
accesses which resource in a distributed resource to ensure an even distribution.

getRegisteredMetricByName

Get component's metric from registered metrics by name.
Notice: Normally, one component can only register one metric name once.
But now registerMetric has a bug(https://issues.apache.org/jira/browse/STORM-254)
cause the same metric name can register twice.
So we just return the first metric we meet.