blob: a0f989c8972b13a5dcbc7eb4f8fd3348b8d7b999 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.18) on Wed Mar 01 02:01:42 GMT 2023 -->
<title>ISpout (Heron Java API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-03-01">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/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="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.min.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ISpout (Heron Java API)";
}
}
catch(err) {
}
//-->
var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<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="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.heron.api.spout</a></div>
<h2 title="Interface ISpout" class="title">Interface ISpout</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><code>java.io.Serializable</code></dd>
</dl>
<dl>
<dt>All Known Subinterfaces:</dt>
<dd><code><a href="IRichSpout.html" title="interface in org.apache.heron.api.spout">IRichSpout</a></code></dd>
</dl>
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="../../integration_test/common/spout/ABSpout.html" title="class in org.apache.heron.integration_test.common.spout">ABSpout</a></code>, <code><a href="BaseRichSpout.html" title="class in org.apache.heron.api.spout">BaseRichSpout</a></code>, <code><a href="../../streamlet/impl/sources/ComplexSource.html" title="class in org.apache.heron.streamlet.impl.sources">ComplexSource</a></code>, <code><a href="../../integration_test/topology/serialization/CustomSpout.html" title="class in org.apache.heron.integration_test.topology.serialization">CustomSpout</a></code>, <code><a href="../../integration_test/common/spout/HdfsStringSpout.html" title="class in org.apache.heron.integration_test.common.spout">HdfsStringSpout</a></code>, <code><a href="../../scheduler/yarn/HeronExecutorTaskTest.TestSpout.html" title="class in org.apache.heron.scheduler.yarn">HeronExecutorTaskTest.TestSpout</a></code>, <code><a href="../HeronSubmitterTest.TestSpout.html" title="class in org.apache.heron.api">HeronSubmitterTest.TestSpout</a></code>, <code><a href="../HeronSubmitterTest.TestSpout2.html" title="class in org.apache.heron.api">HeronSubmitterTest.TestSpout2</a></code>, <code><a href="../../integration_test/core/IntegrationTestSpout.html" title="class in org.apache.heron.integration_test.core">IntegrationTestSpout</a></code>, <code><a href="../../../../../backtype/storm/topology/IRichSpoutDelegate.html" title="class in backtype.storm.topology">IRichSpoutDelegate</a></code>, <code><a href="../../../storm/topology/IRichSpoutDelegate.html" title="class in org.apache.storm.topology">IRichSpoutDelegate</a></code>, <code><a href="../../spouts/kafka/KafkaSpout.html" title="class in org.apache.heron.spouts.kafka">KafkaSpout</a></code>, <code><a href="../../integration_test/common/spout/LocalFileSpout.html" title="class in org.apache.heron.integration_test.common.spout">LocalFileSpout</a></code>, <code><a href="../../integration_test/common/spout/PausedLocalFileSpout.html" title="class in org.apache.heron.integration_test.common.spout">PausedLocalFileSpout</a></code>, <code><a href="../../integration_topology_test/common/spout/StatefulABSpout.html" title="class in org.apache.heron.integration_topology_test.common.spout">StatefulABSpout</a></code>, <code><a href="../../integration_test/core/StatefulIntegrationTestSpout.html" title="class in org.apache.heron.integration_test.core">StatefulIntegrationTestSpout</a></code>, <code><a href="../../integration_topology_test/core/StatefulIntegrationTopologyTestSpout.html" title="class in org.apache.heron.integration_topology_test.core">StatefulIntegrationTopologyTestSpout</a></code>, <code><a href="../../examples/eco/StatefulNumberSpout.html" title="class in org.apache.heron.examples.eco">StatefulNumberSpout</a></code>, <code><a href="../../examples/eco/StatefulRandomIntSpout.html" title="class in org.apache.heron.examples.eco">StatefulRandomIntSpout</a></code>, <code><a href="../../integration_topology_test/core/StatefulSpout.html" title="class in org.apache.heron.integration_topology_test.core">StatefulSpout</a></code>, <code><a href="../../integration_test/topology/windowing/stateful/StatefulWindowingTest.RandomSentenceSpout.html" title="class in org.apache.heron.integration_test.topology.windowing.stateful">StatefulWindowingTest.RandomSentenceSpout</a></code>, <code><a href="../../streamlet/impl/sources/StreamletSource.html" title="class in org.apache.heron.streamlet.impl.sources">StreamletSource</a></code>, <code><a href="../../streamlet/impl/sources/SupplierSource.html" title="class in org.apache.heron.streamlet.impl.sources">SupplierSource</a></code>, <code><a href="../../resource/TestSpout.html" title="class in org.apache.heron.resource">TestSpout</a></code>, <code><a href="../../resource/TestStatefulSpout.html" title="class in org.apache.heron.resource">TestStatefulSpout</a></code>, <code><a href="../../resource/TestTwoPhaseStatefulSpout.html" title="class in org.apache.heron.resource">TestTwoPhaseStatefulSpout</a></code>, <code><a href="../../integration_test/topology/serialization/UnserializableCustomSpout.html" title="class in org.apache.heron.integration_test.topology.serialization">UnserializableCustomSpout</a></code>, <code><a href="../../integration_test/topology/windowing/WindowTestBase.IncrementingSpout.html" title="class in org.apache.heron.integration_test.topology.windowing">WindowTestBase.IncrementingSpout</a></code>, <code><a href="../../examples/eco/WordSpout.html" title="class in org.apache.heron.examples.eco">WordSpout</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">ISpout</span>
extends java.io.Serializable</pre>
<div class="block">ISpout is the core interface for implementing spouts. A Spout is responsible
for feeding messages into the topology for processing. For every tuple emitted by
a spout, Heron will track the (potentially very large) DAG of tuples generated
based on a tuple emitted by the spout. When Heron detects that every tuple in
that DAG has been successfully processed, it will send an ack message to the Spout.
<p>
<p>If a tuple fails to be fully process within the configured timeout for the
topology (see <a href="../Config.html" title="class in org.apache.heron.api"><code>Config</code></a>), Heron will send a fail
message to the spout
for the message.</p>
<p>
<p> When a Spout emits a tuple, it can tag the tuple with a message id. The message id
can be any type. When Heron acks or fails a message, it will pass back to the
spout the same message id to identify which tuple it's referring to. If the spout leaves out
the message id, or sets it to null, then Heron will not track the message and the spout
will not receive any ack or fail callbacks for the message.</p>
<p>
<p>Heron executes ack, fail, and nextTuple all on the same thread. This means that an implementor
of an ISpout does not need to worry about concurrency issues between those methods. However, it
also means that an implementor must ensure that nextTuple is non-blocking: otherwise
the method could await acks and fails that are pending to be processed.</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<section>
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ack(java.lang.Object)">ack</a></span>&#8203;(java.lang.Object&nbsp;msgId)</code></th>
<td class="colLast">
<div class="block">Heron has determined that the tuple emitted by this spout with the msgId identifier
has been fully processed.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#activate()">activate</a></span>()</code></th>
<td class="colLast">
<div class="block">Called when a spout has been activated out of a deactivated mode.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close()">close</a></span>()</code></th>
<td class="colLast">
<div class="block">Called when an ISpout is going to be shutdown.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#deactivate()">deactivate</a></span>()</code></th>
<td class="colLast">
<div class="block">Called when a spout has been deactivated.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fail(java.lang.Object)">fail</a></span>&#8203;(java.lang.Object&nbsp;msgId)</code></th>
<td class="colLast">
<div class="block">The tuple emitted by this spout with the msgId identifier has failed to be
fully processed.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#nextTuple()">nextTuple</a></span>()</code></th>
<td class="colLast">
<div class="block">When this method is called, Heron is requesting that the Spout emit tuples to the
output collector.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#open(java.util.Map,org.apache.heron.api.topology.TopologyContext,org.apache.heron.api.spout.SpoutOutputCollector)">open</a></span>&#8203;(java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;&nbsp;conf,
<a href="../topology/TopologyContext.html" title="interface in org.apache.heron.api.topology">TopologyContext</a>&nbsp;context,
<a href="SpoutOutputCollector.html" title="class in org.apache.heron.api.spout">SpoutOutputCollector</a>&nbsp;collector)</code></th>
<td class="colLast">
<div class="block">Called when a task for this component is initialized within a worker on the cluster.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<section>
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="open(java.util.Map,org.apache.heron.api.topology.TopologyContext,org.apache.heron.api.spout.SpoutOutputCollector)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>open</h4>
<pre class="methodSignature">void&nbsp;open&#8203;(java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;&nbsp;conf,
<a href="../topology/TopologyContext.html" title="interface in org.apache.heron.api.topology">TopologyContext</a>&nbsp;context,
<a href="SpoutOutputCollector.html" title="class in org.apache.heron.api.spout">SpoutOutputCollector</a>&nbsp;collector)</pre>
<div class="block">Called when a task for this component is initialized within a worker on the cluster.
It provides the spout with the environment in which the spout executes.
<p>
<p>This includes the:</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>conf</code> - The Heron configuration for this spout. 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 spout. Tuples can be emitted at any time, including the open and close methods. The collector is thread-safe and should be saved as an instance variable of this spout object.</dd>
</dl>
</li>
</ul>
<a id="close()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">void&nbsp;close()</pre>
<div class="block">Called when an ISpout is going to be shutdown. There is no guarentee that close
will be called, because the supervisor kill -9's worker processes on the cluster.
<p>
<p>The one context where close is guaranteed to be called is a topology is
killed when running Heron in simulator.</p></div>
</li>
</ul>
<a id="activate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>activate</h4>
<pre class="methodSignature">void&nbsp;activate()</pre>
<div class="block">Called when a spout has been activated out of a deactivated mode.
nextTuple will be called on this spout soon. A spout can become activated
after having been deactivated when the topology is manipulated using the
`heron` client.</div>
</li>
</ul>
<a id="deactivate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>deactivate</h4>
<pre class="methodSignature">void&nbsp;deactivate()</pre>
<div class="block">Called when a spout has been deactivated. nextTuple will not be called while
a spout is deactivated. The spout may or may not be reactivated in the future.</div>
</li>
</ul>
<a id="nextTuple()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nextTuple</h4>
<pre class="methodSignature">void&nbsp;nextTuple()</pre>
<div class="block">When this method is called, Heron is requesting that the Spout emit tuples to the
output collector. This method should be non-blocking, so if the Spout has no tuples
to emit, this method should return. nextTuple, ack, and fail are all called in a tight
loop in a single thread in the spout task. When there are no tuples to emit, it is courteous
to have nextTuple sleep for a short amount of time (like a single millisecond)
so as not to waste too much CPU.</div>
</li>
</ul>
<a id="ack(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ack</h4>
<pre class="methodSignature">void&nbsp;ack&#8203;(java.lang.Object&nbsp;msgId)</pre>
<div class="block">Heron has determined that the tuple emitted by this spout with the msgId identifier
has been fully processed. Typically, an implementation of this method will take that
message off the queue and prevent it from being replayed.</div>
</li>
</ul>
<a id="fail(java.lang.Object)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>fail</h4>
<pre class="methodSignature">void&nbsp;fail&#8203;(java.lang.Object&nbsp;msgId)</pre>
<div class="block">The tuple emitted by this spout with the msgId identifier has failed to be
fully processed. Typically, an implementation of this method will put that
message back on the queue to be replayed at a later time.</div>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<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="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>