org.apache.storm.topology.base

## Class BaseStatefulBolt<T extends State>

- java.lang.Object
- - org.apache.storm.topology.base.BaseStatefulBolt<T>

- All Implemented Interfaces:
    Serializable, IComponent, IStatefulBolt<T>, IStatefulComponent<T>
  Direct Known Subclasses:
    StatefulWordCounter

      public abstract class BaseStatefulBolt<T extends State>
      extends Object
      implements IStatefulBolt<T>

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BaseStatefulBolt()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanup()` Analogue to bolt function.
    `void` | `declareOutputFields(OutputFieldsDeclarer declarer)` Declare the output schema for all the streams of this topology.
    `Map<String,Object>` | `getComponentConfiguration()` Declare configuration specific to this component.
    `void` | `preCommit(long txid)` This is a hook for the component to perform some actions just before the framework commits its state.
    `void` | `prepare(Map<String,Object> topoConf, TopologyContext context, OutputCollector collector)` Analogue to bolt function.
    `void` | `prePrepare(long txid)` This is a hook for the component to perform some actions just before the framework prepares its state.
    `void` | `preRollback()` This is a hook for the component to perform some actions just before the framework rolls back the prepared state.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.storm.topology.IStatefulBolt

      `execute`

    - ### Methods inherited from interface org.apache.storm.topology.IStatefulComponent

      `initState`

- - ### Constructor Detail

    - #### BaseStatefulBolt

          public BaseStatefulBolt()

  - ### Method Detail

    - #### prepare

          public void prepare(Map<String,Object> topoConf,
                              TopologyContext context,
                              OutputCollector collector)

      Description copied from interface: `IStatefulBolt`

      Analogue to bolt function.

      Specified by:
        `prepare` in interface `IStatefulBolt<T extends State>`
      See Also:
        `IBolt.prepare(Map, TopologyContext, OutputCollector)`

    - #### cleanup

          public void cleanup()

      Description copied from interface: `IStatefulBolt`

      Analogue to bolt function.

      Specified by:
        `cleanup` in interface `IStatefulBolt<T extends State>`
      See Also:
        `IBolt.cleanup()`

    - #### 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`

    - #### preCommit

          public void preCommit(long txid)

      Description copied from interface: `IStatefulComponent`

      This is a hook for the component to perform some actions just before the framework commits its state.

      Specified by:
        `preCommit` in interface `IStatefulComponent<T extends State>`

    - #### prePrepare

          public void prePrepare(long txid)

      Description copied from interface: `IStatefulComponent`

      This is a hook for the component to perform some actions just before the framework prepares its state.

      Specified by:
        `prePrepare` in interface `IStatefulComponent<T extends State>`

    - #### preRollback

          public void preRollback()

      Description copied from interface: `IStatefulComponent`

      This is a hook for the component to perform some actions just before the framework rolls back the prepared state.

      Specified by:
        `preRollback` in interface `IStatefulComponent<T extends State>`

Copyright © 2021 The Apache Software Foundation. All rights reserved.