Class BaseWindowedBolt

java.lang.Object
org.apache.storm.topology.base.BaseWindowedBolt
All Implemented Interfaces:
Serializable, IComponent, IWindowedBolt
Direct Known Subclasses:
BaseStatefulWindowedBolt, JoinBolt, SlidingWindowSumBolt, TestWindowBolt, TimeDataVerificationBolt, VerificationBolt

public abstract class BaseWindowedBolt extends Object implements IWindowedBolt
See Also:
  • Field Details

  • Constructor Details

    • BaseWindowedBolt

      protected BaseWindowedBolt()
  • Method Details

    • withWindow

      public BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Count slidingInterval)
      Tuple count based sliding window configuration.
      Parameters:
      windowLength - the number of tuples in the window
      slidingInterval - the number of tuples after which the window slides
    • withWindow

      public BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength, BaseWindowedBolt.Duration slidingInterval)
      Tuple count and time duration based sliding window configuration.
      Parameters:
      windowLength - the number of tuples in the window
      slidingInterval - the time duration after which the window slides
    • withWindow

      public BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Count slidingInterval)
      Time duration and count based sliding window configuration.
      Parameters:
      windowLength - the time duration of the window
      slidingInterval - the number of tuples after which the window slides
    • withWindow

      public BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength, BaseWindowedBolt.Duration slidingInterval)
      Time duration based sliding window configuration.
      Parameters:
      windowLength - the time duration of the window
      slidingInterval - the time duration after which the window slides
    • withWindow

      public BaseWindowedBolt withWindow(BaseWindowedBolt.Count windowLength)
      A tuple count based window that slides with every incoming tuple.
      Parameters:
      windowLength - the number of tuples in the window
    • withWindow

      public BaseWindowedBolt withWindow(BaseWindowedBolt.Duration windowLength)
      A time duration based window that slides with every incoming tuple.
      Parameters:
      windowLength - the time duration of the window
    • withTumblingWindow

      public BaseWindowedBolt withTumblingWindow(BaseWindowedBolt.Count count)
      A count based tumbling window.
      Parameters:
      count - the number of tuples after which the window tumbles
    • withTumblingWindow

      public BaseWindowedBolt withTumblingWindow(BaseWindowedBolt.Duration duration)
      A time duration based tumbling window.
      Parameters:
      duration - the time duration after which the window tumbles
    • withTimestampField

      public BaseWindowedBolt withTimestampField(String fieldName)
      Specify a field in the tuple that represents the timestamp as a long value. If this field is not present in the incoming tuple, an IllegalArgumentException will be thrown. The field MUST contain a timestamp in milliseconds
      Parameters:
      fieldName - the name of the field that contains the timestamp
    • withTimestampExtractor

      public BaseWindowedBolt withTimestampExtractor(TimestampExtractor timestampExtractor)
      Specify the timestamp extractor implementation.
      Parameters:
      timestampExtractor - the TimestampExtractor implementation
    • getTimestampExtractor

      public TimestampExtractor getTimestampExtractor()
      Description copied from interface: IWindowedBolt
      Return a TimestampExtractor for extracting timestamps from a tuple for event time based processing, or null for processing time.
      Specified by:
      getTimestampExtractor in interface IWindowedBolt
      Returns:
      the timestamp extractor
    • withLateTupleStream

      public BaseWindowedBolt withLateTupleStream(String streamId)
      Specify a stream id on which late tuples are going to be emitted. They are going to be accessible via the WindowedBoltExecutor.LATE_TUPLE_FIELD field. It must be defined on a per-component basis, and in conjunction with the withTimestampField(java.lang.String), otherwise IllegalArgumentException will be thrown.
      Parameters:
      streamId - the name of the stream used to emit late tuples on
    • withLag

      public BaseWindowedBolt withLag(BaseWindowedBolt.Duration duration)
      Specify the maximum time lag of the tuple timestamp in milliseconds. It means that the tuple timestamps cannot be out of order by more than this amount.
      Parameters:
      duration - the max lag duration
    • withWatermarkInterval

      public BaseWindowedBolt withWatermarkInterval(BaseWindowedBolt.Duration interval)
      Specify the watermark event generation interval. For tuple based timestamps, watermark events are used to track the progress of time
      Parameters:
      interval - the interval at which watermark events are generated
    • prepare

      public void prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)
      Description copied from interface: IWindowedBolt
      This is similar to the IBolt.prepare(Map, TopologyContext, OutputCollector) except that while emitting, the tuples are automatically anchored to the tuples in the inputWindow.
      Specified by:
      prepare in interface IWindowedBolt
    • cleanup

      public void cleanup()
      Specified by:
      cleanup in interface IWindowedBolt
    • declareOutputFields

      public void declareOutputFields(OutputFieldsDeclarer declarer)
      Description copied from interface: IComponent
      Declare the output schema for all the streams of this topology.
      Specified by:
      declareOutputFields in interface IComponent
      Parameters:
      declarer - this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream
    • getComponentConfiguration

      public Map<String,Object> getComponentConfiguration()
      Description copied from interface: IComponent
      Declare configuration specific to this component. Only a subset of the "topology.*" configs can be overridden. The component configuration can be further overridden when constructing the topology using TopologyBuilder
      Specified by:
      getComponentConfiguration in interface IComponent