public class TopologyContext extends WorkerTopologyContext implements IMetricsContext
The TopologyContext is also used to declare ISubscribedState objects to synchronize state with StateSpouts this object is subscribed to.
Constructor and Description |
---|
TopologyContext(StormTopology topology,
java.util.Map<java.lang.String,java.lang.Object> stormConf,
java.util.Map<java.lang.Integer,java.lang.String> taskToComponent,
java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> componentToSortedTasks,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,Fields>> componentToStreamToFields,
java.lang.String stormId,
java.lang.String codeDir,
java.lang.String pidDir,
java.lang.Integer taskId,
java.lang.Integer workerPort,
java.util.List<java.lang.Integer> workerTasks,
java.util.Map<java.lang.String,java.lang.Object> defaultResources,
java.util.Map<java.lang.String,java.lang.Object> userResources,
java.util.Map<java.lang.String,java.lang.Object> executorData,
java.util.Map<java.lang.String,java.lang.Object> registeredMetrics,
clojure.lang.Atom openOrPrepareWasCalled) |
TopologyContext(TopologyContext delegate) |
Modifier and Type | Method and Description |
---|---|
void |
addTaskHook(ITaskHook newHook) |
java.util.Collection<ITaskHook> |
getHooks() |
java.lang.Object |
getTaskData(java.lang.String name) |
java.lang.String |
getThisComponentId()
Gets the component id for this task.
|
Fields |
getThisOutputFields(java.lang.String streamId)
Gets the declared output fields for the specified stream id for the component
this task is a part of.
|
java.util.Set<java.lang.String> |
getThisStreams()
Gets the set of streams declared for the component of this task.
|
int |
getThisTaskId()
Gets the task id of this task.
|
int |
getThisTaskIndex()
Gets the index of this task id in getComponentTasks(getThisComponentId()).
|
CombinedMetric |
registerMetric(java.lang.String name,
ICombiner combiner,
int timeBucketSizeInSecs) |
ReducedMetric |
registerMetric(java.lang.String name,
IReducer reducer,
int timeBucketSizeInSecs) |
<T extends IMetric> |
registerMetric(java.lang.String name,
T metric,
int timeBucketSizeInSecs) |
void |
setTaskData(java.lang.String name,
java.lang.Object data) |
getCodeDir, getPIDDir, getResource, getSharedExecutor, getThisWorkerPort, getThisWorkerTasks
getComponentId, getComponentIds, getComponentOutputFields, getComponentStreams, getComponentTasks, getStormId, getTaskToComponent, toJSONString
public TopologyContext(StormTopology topology, java.util.Map<java.lang.String,java.lang.Object> stormConf, java.util.Map<java.lang.Integer,java.lang.String> taskToComponent, java.util.Map<java.lang.String,java.util.List<java.lang.Integer>> componentToSortedTasks, java.util.Map<java.lang.String,java.util.Map<java.lang.String,Fields>> componentToStreamToFields, java.lang.String stormId, java.lang.String codeDir, java.lang.String pidDir, java.lang.Integer taskId, java.lang.Integer workerPort, java.util.List<java.lang.Integer> workerTasks, java.util.Map<java.lang.String,java.lang.Object> defaultResources, java.util.Map<java.lang.String,java.lang.Object> userResources, java.util.Map<java.lang.String,java.lang.Object> executorData, java.util.Map<java.lang.String,java.lang.Object> registeredMetrics, clojure.lang.Atom openOrPrepareWasCalled)
public TopologyContext(TopologyContext delegate)
public int getThisTaskId()
public java.lang.String getThisComponentId()
public Fields getThisOutputFields(java.lang.String streamId)
public java.util.Set<java.lang.String> getThisStreams()
public int getThisTaskIndex()
public void setTaskData(java.lang.String name, java.lang.Object data)
public java.lang.Object getTaskData(java.lang.String name)
public void addTaskHook(ITaskHook newHook)
public java.util.Collection<ITaskHook> getHooks()
public <T extends IMetric> T registerMetric(java.lang.String name, T metric, int timeBucketSizeInSecs)
registerMetric
in interface IMetricsContext
public ReducedMetric registerMetric(java.lang.String name, IReducer reducer, int timeBucketSizeInSecs)
registerMetric
in interface IMetricsContext
public CombinedMetric registerMetric(java.lang.String name, ICombiner combiner, int timeBucketSizeInSecs)
registerMetric
in interface IMetricsContext