Class TrackedTopology

java.lang.Object
org.apache.storm.testing.TrackedTopology

public class TrackedTopology extends Object
A tracked topology keeps metrics for every bolt and spout. This allows a test to know how many tuples have been fully processed. Metrics are tracked on a per cluster basis. So only one tracked topology should be run in a tracked cluster to avoid conflicts.
  • Constructor Details

    • TrackedTopology

      public TrackedTopology(StormTopology origTopo, ILocalCluster cluster)
      Create a new topology to be tracked.
      Parameters:
      origTopo - the original topology.
      cluster - a cluster that should have been launched with tracking enabled.
  • Method Details

    • getTopology

      public StormTopology getTopology()
    • getCluster

      public ILocalCluster getCluster()
    • trackedWait

      public void trackedWait()
      Wait for 1 tuple to be fully processed.
    • trackedWait

      public void trackedWait(int amt)
      Wait for amt tuples to be fully processed.
    • trackedWait

      public void trackedWait(int amt, int timeoutMs)
      Wait for amt tuples to be fully processed timeoutMs happens.
    • globalAmt

      public int globalAmt(String key)
      Read a metric from the tracked cluster (NOT JUST THIS TOPOLOGY).
      Parameters:
      key - one of "spout-emitted", "processed", or "transferred"
      Returns:
      the amount of that metric