blob: 082e0875211308aefcd5301a309cfde67f90b8ca [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_80) on Fri Nov 10 23:49:16 GMT 2017 -->
<title>LogAndSkipOnInvalidTimestamp (kafka 0.11.0.2 API)</title>
<meta name="date" content="2017-11-10">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="LogAndSkipOnInvalidTimestamp (kafka 0.11.0.2 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.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">
<li><a href="../../../../../org/apache/kafka/streams/processor/FailOnInvalidTimestamp.html" title="class in org.apache.kafka.streams.processor"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/kafka/streams/processor/PartitionGrouper.html" title="interface in org.apache.kafka.streams.processor"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/kafka/streams/processor/LogAndSkipOnInvalidTimestamp.html" target="_top">Frames</a></li>
<li><a href="LogAndSkipOnInvalidTimestamp.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></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>
</div>
<div>
<ul class="subNavList">
<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="subNavList">
<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>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.kafka.streams.processor</div>
<h2 title="Class LogAndSkipOnInvalidTimestamp" class="title">Class LogAndSkipOnInvalidTimestamp</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.kafka.streams.processor.LogAndSkipOnInvalidTimestamp</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../org/apache/kafka/streams/processor/TimestampExtractor.html" title="interface in org.apache.kafka.streams.processor">TimestampExtractor</a></dd>
</dl>
<hr>
<br>
<pre><a href="../../../../../org/apache/kafka/common/annotation/InterfaceStability.Evolving.html" title="annotation in org.apache.kafka.common.annotation">@InterfaceStability.Evolving</a>
public class <span class="strong">LogAndSkipOnInvalidTimestamp</span>
extends java.lang.Object</pre>
<div class="block">Retrieves embedded metadata timestamps from Kafka messages.
If a record has a negative (invalid) timestamp value the timestamp is returned as-is;
in addition, a WARN message is logged in your application.
Returning the timestamp as-is results in dropping the record, i.e., the record will not be processed.
<p>
Embedded metadata timestamp was introduced in "KIP-32: Add timestamps to Kafka message" for the new
0.10+ Kafka message format.
<p>
Here, "embedded metadata" refers to the fact that compatible Kafka producer clients automatically and
transparently embed such timestamps into message metadata they send to Kafka, which can then be retrieved
via this timestamp extractor.
<p>
If the embedded metadata timestamp represents <i>CreateTime</i> (cf. Kafka broker setting
<code>message.timestamp.type</code> and Kafka topic setting <code>log.message.timestamp.type</code>),
this extractor effectively provides <i>event-time</i> semantics.
If <i>LogAppendTime</i> is used as broker/topic setting to define the embedded metadata timestamps,
using this extractor effectively provides <i>ingestion-time</i> semantics.
<p>
If you need <i>processing-time</i> semantics, use <a href="../../../../../org/apache/kafka/streams/processor/WallclockTimestampExtractor.html" title="class in org.apache.kafka.streams.processor"><code>WallclockTimestampExtractor</code></a>.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/apache/kafka/streams/processor/FailOnInvalidTimestamp.html" title="class in org.apache.kafka.streams.processor"><code>FailOnInvalidTimestamp</code></a>,
<a href="../../../../../org/apache/kafka/streams/processor/UsePreviousTimeOnInvalidTimestamp.html" title="class in org.apache.kafka.streams.processor"><code>UsePreviousTimeOnInvalidTimestamp</code></a>,
<a href="../../../../../org/apache/kafka/streams/processor/WallclockTimestampExtractor.html" title="class in org.apache.kafka.streams.processor"><code>WallclockTimestampExtractor</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/apache/kafka/streams/processor/LogAndSkipOnInvalidTimestamp.html#LogAndSkipOnInvalidTimestamp()">LogAndSkipOnInvalidTimestamp</a></strong>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/streams/processor/LogAndSkipOnInvalidTimestamp.html#extract(org.apache.kafka.clients.consumer.ConsumerRecord,%20long)">extract</a></strong>(<a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer">ConsumerRecord</a>&lt;java.lang.Object,java.lang.Object&gt;&nbsp;record,
long&nbsp;previousTimestamp)</code>
<div class="block">Extracts the embedded metadata timestamp from the given <a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer"><code>ConsumerRecord</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/streams/processor/LogAndSkipOnInvalidTimestamp.html#onInvalidTimestamp(org.apache.kafka.clients.consumer.ConsumerRecord,%20long,%20long)">onInvalidTimestamp</a></strong>(<a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer">ConsumerRecord</a>&lt;java.lang.Object,java.lang.Object&gt;&nbsp;record,
long&nbsp;recordTimestamp,
long&nbsp;previousTimestamp)</code>
<div class="block">Writes a log WARN message when the extracted timestamp is invalid (negative) but returns the invalid timestamp as-is,
which ultimately causes the record to be skipped and not to be processed.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="LogAndSkipOnInvalidTimestamp()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LogAndSkipOnInvalidTimestamp</h4>
<pre>public&nbsp;LogAndSkipOnInvalidTimestamp()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="onInvalidTimestamp(org.apache.kafka.clients.consumer.ConsumerRecord, long, long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onInvalidTimestamp</h4>
<pre>public&nbsp;long&nbsp;onInvalidTimestamp(<a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer">ConsumerRecord</a>&lt;java.lang.Object,java.lang.Object&gt;&nbsp;record,
long&nbsp;recordTimestamp,
long&nbsp;previousTimestamp)</pre>
<div class="block">Writes a log WARN message when the extracted timestamp is invalid (negative) but returns the invalid timestamp as-is,
which ultimately causes the record to be skipped and not to be processed.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>record</code> - a data record</dd><dd><code>recordTimestamp</code> - the timestamp extractor from the record</dd><dd><code>previousTimestamp</code> - the latest extracted valid timestamp of the current record's partition˙ (could be -1 if unknown)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the originally extracted timestamp of the record</dd></dl>
</li>
</ul>
<a name="extract(org.apache.kafka.clients.consumer.ConsumerRecord, long)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>extract</h4>
<pre>public&nbsp;long&nbsp;extract(<a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer">ConsumerRecord</a>&lt;java.lang.Object,java.lang.Object&gt;&nbsp;record,
long&nbsp;previousTimestamp)</pre>
<div class="block">Extracts the embedded metadata timestamp from the given <a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer"><code>ConsumerRecord</code></a>.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../../org/apache/kafka/streams/processor/TimestampExtractor.html#extract(org.apache.kafka.clients.consumer.ConsumerRecord,%20long)">extract</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../org/apache/kafka/streams/processor/TimestampExtractor.html" title="interface in org.apache.kafka.streams.processor">TimestampExtractor</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>record</code> - a data record</dd><dd><code>previousTimestamp</code> - the latest extracted valid timestamp of the current record's partition˙ (could be -1 if unknown)</dd>
<dt><span class="strong">Returns:</span></dt><dd>the embedded metadata timestamp of the given <a href="../../../../../org/apache/kafka/clients/consumer/ConsumerRecord.html" title="class in org.apache.kafka.clients.consumer"><code>ConsumerRecord</code></a></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.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">
<li><a href="../../../../../org/apache/kafka/streams/processor/FailOnInvalidTimestamp.html" title="class in org.apache.kafka.streams.processor"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/apache/kafka/streams/processor/PartitionGrouper.html" title="interface in org.apache.kafka.streams.processor"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/kafka/streams/processor/LogAndSkipOnInvalidTimestamp.html" target="_top">Frames</a></li>
<li><a href="LogAndSkipOnInvalidTimestamp.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All 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>
</div>
<div>
<ul class="subNavList">
<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="subNavList">
<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>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>