Class AbstractJdbcBolt

All Implemented Interfaces:
Serializable, IBolt, IComponent, IRichBolt
Direct Known Subclasses:
JdbcInsertBolt, JdbcLookupBolt

public abstract class AbstractJdbcBolt extends BaseTickTupleAwareRichBolt
See Also:
  • Field Details

  • Constructor Details

    • AbstractJdbcBolt

      public AbstractJdbcBolt(ConnectionProvider connectionProviderParam)

      connectionProviderParam - database connection provider
  • Method Details

    • prepare

      public void prepare(Map<String,Object> map, TopologyContext topologyContext, OutputCollector outputCollector)
      Subclasses should call this to ensure output collector and connection provider are set up, and finally jdbcClient is initialized properly.

      Called when a task for this component is initialized within a worker on the cluster. It provides the bolt with the environment in which the bolt executes.

      This includes the:

      map - The Storm configuration for this bolt. This is the configuration provided to the topology merged in with cluster configuration on this machine.
      topologyContext - This object can be used to get information about this task's place within the topology, including the task id and component id of this task, input and output information, etc.
      outputCollector - The collector is used to emit tuples from this bolt. Tuples can be emitted at any time, including the prepare and cleanup methods. The collector is thread-safe and should be saved as an instance variable of this bolt object.
    • cleanup

      public void cleanup()

      Subclasses should call this to ensure connection provider can be also cleaned up.

      Specified by:
      cleanup in interface IBolt
      cleanup in class BaseRichBolt