blob: 2f2c27e8b15404b8a1433b9530839526a35a48ef [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="de">
<head>
<!-- Generated by javadoc (17) -->
<title>IBolt (Storm 2.6.2 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.storm.task, interface: IBolt">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/IBolt.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.storm.task</a></div>
<h1 title="Interface IBolt" class="title">Interface IBolt</h1>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Superinterfaces:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></code></dd>
</dl>
<dl class="notes">
<dt>All Known Subinterfaces:</dt>
<dd><code><a href="../topology/IRichBolt.html" title="interface in org.apache.storm.topology">IRichBolt</a></code></dd>
</dl>
<dl class="notes">
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="../elasticsearch/bolt/AbstractEsBolt.html" title="class in org.apache.storm.elasticsearch.bolt">AbstractEsBolt</a></code>, <code><a href="../hdfs/bolt/AbstractHdfsBolt.html" title="class in org.apache.storm.hdfs.bolt">AbstractHdfsBolt</a></code>, <code><a href="../jdbc/bolt/AbstractJdbcBolt.html" title="class in org.apache.storm.jdbc.bolt">AbstractJdbcBolt</a></code>, <code><a href="../redis/bolt/AbstractRedisBolt.html" title="class in org.apache.storm.redis.bolt">AbstractRedisBolt</a></code>, <code><a href="../daemon/Acker.html" title="class in org.apache.storm.daemon">Acker</a></code>, <code><a href="../hdfs/bolt/AvroGenericRecordBolt.html" title="class in org.apache.storm.hdfs.bolt">AvroGenericRecordBolt</a></code>, <code><a href="../topology/base/BaseRichBolt.html" title="class in org.apache.storm.topology.base">BaseRichBolt</a></code>, <code><a href="../topology/BaseStatefulBoltExecutor.html" title="class in org.apache.storm.topology">BaseStatefulBoltExecutor</a></code>, <code><a href="../topology/base/BaseTickTupleAwareRichBolt.html" title="class in org.apache.storm.topology.base">BaseTickTupleAwareRichBolt</a></code>, <code><a href="../topology/BasicBoltExecutor.html" title="class in org.apache.storm.topology">BasicBoltExecutor</a></code>, <code><a href="../coordination/BatchBoltExecutor.html" title="class in org.apache.storm.coordination">BatchBoltExecutor</a></code>, <code><a href="../starter/BlobStoreAPIWordCountTopology.SplitSentence.html" title="class in org.apache.storm.starter">BlobStoreAPIWordCountTopology.SplitSentence</a></code>, <code><a href="../testing/BoltTracker.html" title="class in org.apache.storm.testing">BoltTracker</a></code>, <code><a href="../topology/CheckpointTupleForwarder.html" title="class in org.apache.storm.topology">CheckpointTupleForwarder</a></code>, <code><a href="../clojure/ClojureBolt.html" title="class in org.apache.storm.clojure">ClojureBolt</a></code>, <code><a href="../coordination/CoordinatedBolt.html" title="class in org.apache.storm.coordination">CoordinatedBolt</a></code>, <code><a href="../perf/bolt/DevNullBolt.html" title="class in org.apache.storm.perf.bolt">DevNullBolt</a></code>, <code><a href="../elasticsearch/bolt/EsIndexBolt.html" title="class in org.apache.storm.elasticsearch.bolt">EsIndexBolt</a></code>, <code><a href="../elasticsearch/bolt/EsLookupBolt.html" title="class in org.apache.storm.elasticsearch.bolt">EsLookupBolt</a></code>, <code><a href="../elasticsearch/bolt/EsPercolateBolt.html" title="class in org.apache.storm.elasticsearch.bolt">EsPercolateBolt</a></code>, <code><a href="../metric/EventLoggerBolt.html" title="class in org.apache.storm.metric">EventLoggerBolt</a></code>, <code><a href="../ExclamationTopology.ExclamationBolt.html" title="class in org.apache.storm">ExclamationTopology.ExclamationBolt</a></code>, <code><a href="../starter/ExclamationTopology.ExclamationBolt.html" title="class in org.apache.storm.starter">ExclamationTopology.ExclamationBolt</a></code>, <code><a href="../flux/wrappers/bolts/FluxShellBolt.html" title="class in org.apache.storm.flux.wrappers.bolts">FluxShellBolt</a></code>, <code><a href="../jms/example/GenericBolt.html" title="class in org.apache.storm.jms.example">GenericBolt</a></code>, <code><a href="../hdfs/bolt/HdfsBolt.html" title="class in org.apache.storm.hdfs.bolt">HdfsBolt</a></code>, <code><a href="../hdfs/bolt/HdfsFileTopology.MyBolt.html" title="class in org.apache.storm.hdfs.bolt">HdfsFileTopology.MyBolt</a></code>, <code><a href="../hdfs/spout/HdfsSpoutTopology.ConstBolt.html" title="class in org.apache.storm.hdfs.spout">HdfsSpoutTopology.ConstBolt</a></code>, <code><a href="../hive/bolt/HiveBolt.html" title="class in org.apache.storm.hive.bolt">HiveBolt</a></code>, <code><a href="../perf/bolt/IdBolt.html" title="class in org.apache.storm.perf.bolt">IdBolt</a></code>, <code><a href="../perf/utils/IdentityBolt.html" title="class in org.apache.storm.perf.utils">IdentityBolt</a></code>, <code><a href="../jdbc/bolt/JdbcInsertBolt.html" title="class in org.apache.storm.jdbc.bolt">JdbcInsertBolt</a></code>, <code><a href="../jdbc/bolt/JdbcLookupBolt.html" title="class in org.apache.storm.jdbc.bolt">JdbcLookupBolt</a></code>, <code><a href="../jms/bolt/JmsBolt.html" title="class in org.apache.storm.jms.bolt">JmsBolt</a></code>, <code><a href="../drpc/JoinResult.html" title="class in org.apache.storm.drpc">JoinResult</a></code>, <code><a href="../kafka/bolt/KafkaBolt.html" title="class in org.apache.storm.kafka.bolt">KafkaBolt</a></code>, <code><a href="../kafka/spout/KafkaSpoutTestBolt.html" title="class in org.apache.storm.kafka.spout">KafkaSpoutTestBolt</a></code>, <code><a href="../drpc/KeyedFairBolt.html" title="class in org.apache.storm.drpc">KeyedFairBolt</a></code>, <code><a href="../loadgen/LoadBolt.html" title="class in org.apache.storm.loadgen">LoadBolt</a></code>, <code><a href="../redis/topology/LookupWordCount.PrintWordTotalCountBolt.html" title="class in org.apache.storm.redis.topology">LookupWordCount.PrintWordTotalCountBolt</a></code>, <code><a href="../metric/MetricsConsumerBolt.html" title="class in org.apache.storm.metric">MetricsConsumerBolt</a></code>, <code><a href="../starter/MultipleLoggerTopology.ExclamationLoggingBolt.html" title="class in org.apache.storm.starter">MultipleLoggerTopology.ExclamationLoggingBolt</a></code>, <code><a href="../starter/MultiThreadWordCountTopology.MultiThreadedSplitSentence.html" title="class in org.apache.storm.starter">MultiThreadWordCountTopology.MultiThreadedSplitSentence</a></code>, <code><a href="../testing/NonRichBoltTracker.html" title="class in org.apache.storm.testing">NonRichBoltTracker</a></code>, <code><a href="../topology/PersistentWindowedBoltExecutor.html" title="class in org.apache.storm.topology">PersistentWindowedBoltExecutor</a></code>, <code><a href="../testing/PythonShellMetricsBolt.html" title="class in org.apache.storm.testing">PythonShellMetricsBolt</a></code>, <code><a href="../redis/bolt/RedisFilterBolt.html" title="class in org.apache.storm.redis.bolt">RedisFilterBolt</a></code>, <code><a href="../redis/bolt/RedisLookupBolt.html" title="class in org.apache.storm.redis.bolt">RedisLookupBolt</a></code>, <code><a href="../redis/bolt/RedisStoreBolt.html" title="class in org.apache.storm.redis.bolt">RedisStoreBolt</a></code>, <code><a href="../starter/ResourceAwareExampleTopology.ExclamationBolt.html" title="class in org.apache.storm.starter">ResourceAwareExampleTopology.ExclamationBolt</a></code>, <code><a href="../drpc/ReturnResults.html" title="class in org.apache.storm.drpc">ReturnResults</a></code>, <code><a href="../clojure/RichShellBolt.html" title="class in org.apache.storm.clojure">RichShellBolt</a></code>, <code><a href="../starter/bolt/RollingCountAggBolt.html" title="class in org.apache.storm.starter.bolt">RollingCountAggBolt</a></code>, <code><a href="../starter/bolt/RollingCountBolt.html" title="class in org.apache.storm.starter.bolt">RollingCountBolt</a></code>, <code><a href="../hdfs/bolt/SequenceFileBolt.html" title="class in org.apache.storm.hdfs.bolt">SequenceFileBolt</a></code>, <code><a href="../hdfs/bolt/SequenceFileTopology.MyBolt.html" title="class in org.apache.storm.hdfs.bolt">SequenceFileTopology.MyBolt</a></code>, <code><a href="ShellBolt.html" title="class in org.apache.storm.task">ShellBolt</a></code>, <code><a href="../starter/bolt/SingleJoinBolt.html" title="class in org.apache.storm.starter.bolt">SingleJoinBolt</a></code>, <code><a href="../sql/runtime/datasource/socket/bolt/SocketBolt.html" title="class in org.apache.storm.sql.runtime.datasource.socket.bolt">SocketBolt</a></code>, <code><a href="../topology/StatefulBoltExecutor.html" title="class in org.apache.storm.topology">StatefulBoltExecutor</a></code>, <code><a href="../topology/StatefulWindowedBoltExecutor.html" title="class in org.apache.storm.topology">StatefulWindowedBoltExecutor</a></code>, <code><a href="../metric/SystemBolt.html" title="class in org.apache.storm.metric">SystemBolt</a></code>, <code><a href="../testing/TestAggregatesCounter.html" title="class in org.apache.storm.testing">TestAggregatesCounter</a></code>, <code><a href="../testing/TestEventOrderCheckBolt.html" title="class in org.apache.storm.testing">TestEventOrderCheckBolt</a></code>, <code><a href="../testing/TestGlobalCount.html" title="class in org.apache.storm.testing">TestGlobalCount</a></code>, <code><a href="../testing/TestPlannerBolt.html" title="class in org.apache.storm.testing">TestPlannerBolt</a></code>, <code><a href="../trident/topology/TridentBoltExecutor.html" title="class in org.apache.storm.trident.topology">TridentBoltExecutor</a></code>, <code><a href="../testing/TupleCaptureBolt.html" title="class in org.apache.storm.testing">TupleCaptureBolt</a></code>, <code><a href="../redis/topology/WhitelistWordCount.PrintWordTotalCountBolt.html" title="class in org.apache.storm.redis.topology">WhitelistWordCount.PrintWordTotalCountBolt</a></code>, <code><a href="../topology/WindowedBoltExecutor.html" title="class in org.apache.storm.topology">WindowedBoltExecutor</a></code>, <code><a href="../starter/WordCountTopology.SplitSentence.html" title="class in org.apache.storm.starter">WordCountTopology.SplitSentence</a></code>, <code><a href="../starter/WordCountTopologyNode.SplitSentence.html" title="class in org.apache.storm.starter">WordCountTopologyNode.SplitSentence</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public interface </span><span class="element-name type-name-label">IBolt</span><span class="extends-implements">
extends <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a></span></div>
<div class="block">An IBolt represents a component that takes tuples as input and produces tuples as output. An IBolt can do everything from filtering to
joining to functions to aggregations. It does not have to process a tuple immediately and may hold onto tuples to process later.
<p>A bolt's lifecycle is as follows:
<p>IBolt object created on client machine. The IBolt is serialized into the topology (using Java serialization) and
submitted to the master machine of the cluster (Nimbus). Nimbus then launches workers which deserialize the object,
call prepare on it, and then start processing tuples.
<p>If you want to parameterize an IBolt, you should set the parameters through its constructor and save the parameterization state as
instance variables (which will then get serialized and shipped to every task executing this bolt across the cluster).
<p>When defining bolts in Java, you should use the IRichBolt interface which adds necessary methods for using the
Java TopologyBuilder API.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#cleanup()" class="member-name-link">cleanup</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Called when an IBolt is going to be shutdown.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#execute(org.apache.storm.tuple.Tuple)" class="member-name-link">execute</a><wbr>(<a href="../tuple/Tuple.html" title="interface in org.apache.storm.tuple">Tuple</a>&nbsp;input)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Process a single tuple of input.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#prepare(java.util.Map,org.apache.storm.task.TopologyContext,org.apache.storm.task.OutputCollector)" class="member-name-link">prepare</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&gt;&nbsp;topoConf,
<a href="TopologyContext.html" title="class in org.apache.storm.task">TopologyContext</a>&nbsp;context,
<a href="OutputCollector.html" title="class in org.apache.storm.task">OutputCollector</a>&nbsp;collector)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Called when a task for this component is initialized within a worker on the cluster.</div>
</div>
</div>
</div>
</div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="prepare(java.util.Map,org.apache.storm.task.TopologyContext,org.apache.storm.task.OutputCollector)">
<h3>prepare</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">prepare</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&gt;&nbsp;topoConf,
<a href="TopologyContext.html" title="class in org.apache.storm.task">TopologyContext</a>&nbsp;context,
<a href="OutputCollector.html" title="class in org.apache.storm.task">OutputCollector</a>&nbsp;collector)</span></div>
<div class="block">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.
<p>This includes the:</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>topoConf</code> - The Storm configuration for this bolt. This is the configuration provided to the topology merged in with cluster
configuration on this machine.</dd>
<dd><code>context</code> - 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.</dd>
<dd><code>collector</code> - 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.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="execute(org.apache.storm.tuple.Tuple)">
<h3>execute</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">execute</span><wbr><span class="parameters">(<a href="../tuple/Tuple.html" title="interface in org.apache.storm.tuple">Tuple</a>&nbsp;input)</span></div>
<div class="block">Process a single tuple of input. The Tuple object contains metadata on it about which component/stream/task it came from. The values
of the Tuple can be accessed using Tuple#getValue. The IBolt does not have to process the Tuple immediately. It is perfectly fine to
hang onto a tuple and process it later (for instance, to do an aggregation or join).
<p>Tuples should be emitted using the OutputCollector provided through the prepare method. It is required that all input tuples are
acked or failed at some point using the OutputCollector. Otherwise, Storm will be unable to determine when tuples coming off the
spouts have been completed.
<p>For the common case of acking an input tuple at the end of the execute method, see IBasicBolt which automates this.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>input</code> - The input tuple to be processed.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="cleanup()">
<h3>cleanup</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">cleanup</span>()</div>
<div class="block">Called when an IBolt is going to be shutdown. Storm will make a best-effort attempt to call this if the worker shutdown is orderly.
The <a href="../Config.html#SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS"><code>Config.SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS</code></a> setting controls how long orderly shutdown is allowed to take.
There is no guarantee that cleanup will be called if shutdown is not orderly, or if the shutdown exceeds the time limit.
<p>The one context where cleanup is guaranteed to be called is when a topology is killed when running Storm in local mode.</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2023 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>