public abstract class AbstractJdbcBolt extends BaseTickTupleAwareRichBolt
Modifier and Type | Field and Description |
---|---|
protected OutputCollector |
collector |
protected String |
configKey |
protected ConnectionProvider |
connectionProvider |
protected JdbcClient |
jdbcClient |
protected Integer |
queryTimeoutSecs |
Constructor and Description |
---|
AbstractJdbcBolt(ConnectionProvider connectionProviderParam)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleanup.
|
void |
prepare(Map 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.
|
execute, onTickTuple, process
getComponentConfiguration
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
declareOutputFields, getComponentConfiguration
protected OutputCollector collector
protected transient JdbcClient jdbcClient
protected String configKey
protected Integer queryTimeoutSecs
protected ConnectionProvider connectionProvider
public AbstractJdbcBolt(ConnectionProvider connectionProviderParam)
Constructor.
connectionProviderParam
- database connection providerpublic void prepare(Map 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.public void cleanup()
Cleanup.
Subclasses should call this to ensure connection provider can be also cleaned up.cleanup
in interface IBolt
cleanup
in class BaseRichBolt
Copyright © 2022 The Apache Software Foundation. All Rights Reserved.