blob: 854f04a4ad76f2e79d9009029fb35371e22fd980 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="de">
<head>
<!-- Generated by javadoc (17) -->
<title>RollingCountBolt (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.starter.bolt, class: RollingCountBolt">
<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/RollingCountBolt.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><a href="#constructor-summary">Constr</a>&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><a href="#constructor-detail">Constr</a>&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.starter.bolt</a></div>
<h1 title="Class RollingCountBolt" class="title">Class RollingCountBolt</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><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">java.lang.Object</a>
<div class="inheritance"><a href="../../topology/base/BaseComponent.html" title="class in org.apache.storm.topology.base">org.apache.storm.topology.base.BaseComponent</a>
<div class="inheritance"><a href="../../topology/base/BaseRichBolt.html" title="class in org.apache.storm.topology.base">org.apache.storm.topology.base.BaseRichBolt</a>
<div class="inheritance">org.apache.storm.starter.bolt.RollingCountBolt</div>
</div>
</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Implemented Interfaces:</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>, <code><a href="../../task/IBolt.html" title="interface in org.apache.storm.task">IBolt</a></code>, <code><a href="../../topology/IComponent.html" title="interface in org.apache.storm.topology">IComponent</a></code>, <code><a href="../../topology/IRichBolt.html" title="interface in org.apache.storm.topology">IRichBolt</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">RollingCountBolt</span>
<span class="extends-implements">extends <a href="../../topology/base/BaseRichBolt.html" title="class in org.apache.storm.topology.base">BaseRichBolt</a></span></div>
<div class="block">This bolt performs rolling counts of incoming objects, i.e. sliding window based counting.
<p/>
The bolt is configured by two parameters, the length of the sliding window in seconds (which influences the output
data of the bolt, i.e. how it will count objects) and the emit frequency in seconds (which influences how often the
bolt will output the latest window counts). For instance, if the window length is set to an equivalent of five
minutes and the emit frequency to one minute, then the bolt will output the latest five-minute sliding window every
minute.
<p/>
The bolt emits a rolling count tuple per object, consisting of the object itself, its latest rolling count, and the
actual duration of the sliding window. The latter is included in case the expected sliding window length (as
configured by the user) is different from the actual length, e.g. due to high system load. Note that the actual
window length is tracked and calculated for the window, and not individually for each object within a window.
<p/>
Note: During the startup phase you will usually observe that the bolt warns you about the actual sliding window
length being smaller than the expected length. This behavior is expected and is caused by the way the sliding window
counts are initially "loaded up". You can safely ignore this warning during startup (e.g. you will see this warning
during the first ~ five minutes of startup time if the window length is set to five minutes).</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../serialized-form.html#org.apache.storm.starter.bolt.RollingCountBolt">Serialized Form</a></li>
</ul>
</dd>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">RollingCountBolt</a>()</code></div>
<div class="col-last even-row-color">&nbsp;</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(int,int)" class="member-name-link">RollingCountBolt</a><wbr>(int&nbsp;windowLengthInSeconds,
int&nbsp;emitFrequencyInSeconds)</code></div>
<div class="col-last odd-row-color">&nbsp;</div>
</div>
</section>
</li>
<!-- ========== 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-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete 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-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#declareOutputFields(org.apache.storm.topology.OutputFieldsDeclarer)" class="member-name-link">declareOutputFields</a><wbr>(<a href="../../topology/OutputFieldsDeclarer.html" title="interface in org.apache.storm.topology">OutputFieldsDeclarer</a>&nbsp;declarer)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Declare the output schema for all the streams of this topology.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><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;tuple)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<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-tab4"><code><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;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getComponentConfiguration()" class="member-name-link">getComponentConfiguration</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Declare configuration specific to this component.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><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="../../task/TopologyContext.html" title="class in org.apache.storm.task">TopologyContext</a>&nbsp;context,
<a href="../../task/OutputCollector.html" title="class in org.apache.storm.task">OutputCollector</a>&nbsp;collector)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Called when a task for this component is initialized within a worker on the cluster.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-org.apache.storm.topology.base.BaseRichBolt">Methods inherited from class&nbsp;org.apache.storm.topology.base.<a href="../../topology/base/BaseRichBolt.html" title="class in org.apache.storm.topology.base">BaseRichBolt</a></h3>
<code><a href="../../topology/base/BaseRichBolt.html#cleanup()">cleanup</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<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></h3>
<code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;()">
<h3>RollingCountBolt</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">RollingCountBolt</span>()</div>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(int,int)">
<h3>RollingCountBolt</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">RollingCountBolt</span><wbr><span class="parameters">(int&nbsp;windowLengthInSeconds,
int&nbsp;emitFrequencyInSeconds)</span></div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ 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="modifiers">public</span>&nbsp;<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="../../task/TopologyContext.html" title="class in org.apache.storm.task">TopologyContext</a>&nbsp;context,
<a href="../../task/OutputCollector.html" title="class in org.apache.storm.task">OutputCollector</a>&nbsp;collector)</span></div>
<div class="block"><span class="descfrm-type-label">Description copied from interface:&nbsp;<code><a href="../../task/IBolt.html#prepare(java.util.Map,org.apache.storm.task.TopologyContext,org.apache.storm.task.OutputCollector)">IBolt</a></code></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="modifiers">public</span>&nbsp;<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;tuple)</span></div>
<div class="block"><span class="descfrm-type-label">Description copied from interface:&nbsp;<code><a href="../../task/IBolt.html#execute(org.apache.storm.tuple.Tuple)">IBolt</a></code></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>tuple</code> - The input tuple to be processed.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="declareOutputFields(org.apache.storm.topology.OutputFieldsDeclarer)">
<h3>declareOutputFields</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">declareOutputFields</span><wbr><span class="parameters">(<a href="../../topology/OutputFieldsDeclarer.html" title="interface in org.apache.storm.topology">OutputFieldsDeclarer</a>&nbsp;declarer)</span></div>
<div class="block"><span class="descfrm-type-label">Description copied from interface:&nbsp;<code><a href="../../topology/IComponent.html#declareOutputFields(org.apache.storm.topology.OutputFieldsDeclarer)">IComponent</a></code></span></div>
<div class="block">Declare the output schema for all the streams of this topology.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>declarer</code> - this is used to declare output stream ids, output fields, and whether or not each output stream is a direct stream</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getComponentConfiguration()">
<h3>getComponentConfiguration</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><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;</span>&nbsp;<span class="element-name">getComponentConfiguration</span>()</div>
<div class="block"><span class="descfrm-type-label">Description copied from interface:&nbsp;<code><a href="../../topology/IComponent.html#getComponentConfiguration()">IComponent</a></code></span></div>
<div class="block">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 <a href="../../topology/TopologyBuilder.html" title="class in org.apache.storm.topology"><code>TopologyBuilder</code></a></div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="../../topology/IComponent.html#getComponentConfiguration()">getComponentConfiguration</a></code>&nbsp;in interface&nbsp;<code><a href="../../topology/IComponent.html" title="interface in org.apache.storm.topology">IComponent</a></code></dd>
<dt>Overrides:</dt>
<dd><code><a href="../../topology/base/BaseComponent.html#getComponentConfiguration()">getComponentConfiguration</a></code>&nbsp;in class&nbsp;<code><a href="../../topology/base/BaseComponent.html" title="class in org.apache.storm.topology.base">BaseComponent</a></code></dd>
</dl>
</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>