blob: 7d8c51c6c4def0f15c481e974082b5a79a9e9c5e [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>SourceTask (kafka 3.0.0 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.kafka.connect.source, class: SourceTask">
<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.5.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 data = {"i0":10,"i1":42,"i2":10,"i3":10,"i4":6,"i5":6,"i6":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "alt-color";
var rowColor = "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="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="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" 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.kafka.connect.source</a></div>
<h1 title="Class SourceTask" class="title">Class SourceTask</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/15/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">org.apache.kafka.connect.source.SourceTask</div>
</div>
<section class="description">
<dl class="notes">
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="../connector/Task.html" title="interface in org.apache.kafka.connect.connector">Task</a></code></dd>
</dl>
<hr>
<pre>public abstract class <span class="type-name-label">SourceTask</span>
extends <a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
implements <a href="../connector/Task.html" title="interface in org.apache.kafka.connect.connector">Task</a></pre>
<div class="block">SourceTask is a Task that pulls records from another system for storage in Kafka.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field.summary">
<h2>Field Summary</h2>
<div class="member-summary">
<table class="summary-table">
<caption><span>Fields</span></caption>
<thead>
<tr>
<th class="col-first" scope="col">Modifier and Type</th>
<th class="col-second" scope="col">Field</th>
<th class="col-last" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="alt-color">
<td class="col-first"><code>protected <a href="SourceTaskContext.html" title="interface in org.apache.kafka.connect.source">SourceTaskContext</a></code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#context">context</a></span></code></th>
<td class="col-last">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor.summary">
<h2>Constructor Summary</h2>
<div class="member-summary">
<table class="summary-table">
<caption><span>Constructors</span></caption>
<thead>
<tr>
<th class="col-first" scope="col">Constructor</th>
<th class="col-last" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="alt-color">
<th class="col-constructor-name" scope="row"><code><span class="member-name-link"><a href="#%3Cinit%3E()">SourceTask</a></span>()</code></th>
<td class="col-last">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method.summary">
<h2>Method Summary</h2>
<div class="member-summary" id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" id="t0" class="active-table-tab">All Methods</button><button role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t2" class="table-tab" onclick="show(2);">Instance Methods</button><button role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t3" class="table-tab" onclick="show(4);">Abstract Methods</button><button role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t4" class="table-tab" onclick="show(8);">Concrete Methods</button><button role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t6" class="table-tab" onclick="show(32);">Deprecated Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<table class="summary-table" aria-labelledby="t0">
<thead>
<tr>
<th class="col-first" scope="col">Modifier and Type</th>
<th class="col-second" scope="col">Method</th>
<th class="col-last" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="alt-color" id="i0">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#commit()">commit</a></span>()</code></th>
<td class="col-last">
<div class="block">
Commit the offsets, up to the offsets that have been returned by <a href="#poll()"><code>poll()</code></a>.</div>
</td>
</tr>
<tr class="row-color" id="i1">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord)">commitRecord</a></span>&#8203;(<a href="SourceRecord.html" title="class in org.apache.kafka.connect.source">SourceRecord</a>&nbsp;record)</code></th>
<td class="col-last">
<div class="block"><span class="deprecated-label">Deprecated.</span>
<div class="deprecation-comment">Use <a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord,org.apache.kafka.clients.producer.RecordMetadata)"><code>commitRecord(SourceRecord, RecordMetadata)</code></a> instead.</div>
</div>
</td>
</tr>
<tr class="alt-color" id="i2">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord,org.apache.kafka.clients.producer.RecordMetadata)">commitRecord</a></span>&#8203;(<a href="SourceRecord.html" title="class in org.apache.kafka.connect.source">SourceRecord</a>&nbsp;record,
<a href="../../clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer">RecordMetadata</a>&nbsp;metadata)</code></th>
<td class="col-last">
<div class="block">
Commit an individual <a href="SourceRecord.html" title="class in org.apache.kafka.connect.source"><code>SourceRecord</code></a> when the callback from the producer client is received.</div>
</td>
</tr>
<tr class="row-color" id="i3">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#initialize(org.apache.kafka.connect.source.SourceTaskContext)">initialize</a></span>&#8203;(<a href="SourceTaskContext.html" title="interface in org.apache.kafka.connect.source">SourceTaskContext</a>&nbsp;context)</code></th>
<td class="col-last">
<div class="block">Initialize this SourceTask with the specified context object.</div>
</td>
</tr>
<tr class="alt-color" id="i4">
<td class="col-first"><code>abstract <a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="SourceRecord.html" title="class in org.apache.kafka.connect.source">SourceRecord</a>&gt;</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#poll()">poll</a></span>()</code></th>
<td class="col-last">
<div class="block">
Poll this source task for new records.</div>
</td>
</tr>
<tr class="row-color" id="i5">
<td class="col-first"><code>abstract void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#start(java.util.Map)">start</a></span>&#8203;(<a href="https://docs.oracle.com/en/java/javase/15/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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,&#8203;<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;&nbsp;props)</code></th>
<td class="col-last">
<div class="block">Start the Task.</div>
</td>
</tr>
<tr class="alt-color" id="i6">
<td class="col-first"><code>abstract void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#stop()">stop</a></span>()</code></th>
<td class="col-last">
<div class="block">Signal this SourceTask to stop.</div>
</td>
</tr>
</tbody>
</table>
</div>
</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/15/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/15/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/15/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/15/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/15/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/15/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/15/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/15/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/15/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/15/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/15/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/15/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>
<div class="inherited-list">
<h3 id="methods.inherited.from.class.org.apache.kafka.connect.connector.Task">Methods inherited from interface&nbsp;org.apache.kafka.connect.connector.<a href="../connector/Task.html" title="interface in org.apache.kafka.connect.connector">Task</a></h3>
<code><a href="../connector/Task.html#version()">version</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field.detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="context">
<h3>context</h3>
<div class="member-signature"><span class="modifiers">protected</span>&nbsp;<span class="return-type"><a href="SourceTaskContext.html" title="interface in org.apache.kafka.connect.source">SourceTaskContext</a></span>&nbsp;<span class="member-name">context</span></div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= 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>SourceTask</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="member-name">SourceTask</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="initialize(org.apache.kafka.connect.source.SourceTaskContext)">
<h3>initialize</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="member-name">initialize</span>&#8203;(<span class="parameters"><a href="SourceTaskContext.html" title="interface in org.apache.kafka.connect.source">SourceTaskContext</a>&nbsp;context)</span></div>
<div class="block">Initialize this SourceTask with the specified context object.</div>
</section>
</li>
<li>
<section class="detail" id="start(java.util.Map)">
<h3>start</h3>
<div class="member-signature"><span class="modifiers">public abstract</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="member-name">start</span>&#8203;(<span class="parameters"><a href="https://docs.oracle.com/en/java/javase/15/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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,&#8203;<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;&nbsp;props)</span></div>
<div class="block">Start the Task. This should handle any configuration parsing and one-time setup of the task.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="../connector/Task.html#start(java.util.Map)">start</a></code>&nbsp;in interface&nbsp;<code><a href="../connector/Task.html" title="interface in org.apache.kafka.connect.connector">Task</a></code></dd>
<dt>Parameters:</dt>
<dd><code>props</code> - initial configuration</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="poll()">
<h3>poll</h3>
<div class="member-signature"><span class="modifiers">public abstract</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="SourceRecord.html" title="class in org.apache.kafka.connect.source">SourceRecord</a>&gt;</span>&nbsp;<span class="member-name">poll</span>()
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></span></div>
<div class="block"><p>
Poll this source task for new records. If no data is currently available, this method
should block but return control to the caller regularly (by returning <code>null</code>) in
order for the task to transition to the <code>PAUSED</code> state if requested to do so.
</p>
<p>
The task will be <a href="#stop()"><code>stopped</code></a> on a separate thread, and when that happens
this method is expected to unblock, quickly finish up any remaining processing, and
return.
</p></div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a list of source records</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="commit()">
<h3>commit</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="member-name">commit</span>()
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></span></div>
<div class="block"><p>
Commit the offsets, up to the offsets that have been returned by <a href="#poll()"><code>poll()</code></a>. This
method should block until the commit is complete.
</p>
<p>
SourceTasks are not required to implement this functionality; Kafka Connect will record offsets
automatically. This hook is provided for systems that also need to store offsets internally
in their own system.
</p></div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="stop()">
<h3>stop</h3>
<div class="member-signature"><span class="modifiers">public abstract</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="member-name">stop</span>()</div>
<div class="block">Signal this SourceTask to stop. In SourceTasks, this method only needs to signal to the task that it should stop
trying to poll for new data and interrupt any outstanding poll() requests. It is not required that the task has
fully stopped. Note that this method necessarily may be invoked from a different thread than <a href="#poll()"><code>poll()</code></a> and
<a href="#commit()"><code>commit()</code></a>.
For example, if a task uses a <a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/nio/channels/Selector.html" title="class or interface in java.nio.channels" class="external-link"><code>Selector</code></a> to receive data over the network, this method
could set a flag that will force <a href="#poll()"><code>poll()</code></a> to exit immediately and invoke
<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/nio/channels/Selector.html#wakeup()" title="class or interface in java.nio.channels" class="external-link"><code>wakeup()</code></a> to interrupt any ongoing requests.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="../connector/Task.html#stop()">stop</a></code>&nbsp;in interface&nbsp;<code><a href="../connector/Task.html" title="interface in org.apache.kafka.connect.connector">Task</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="commitRecord(org.apache.kafka.connect.source.SourceRecord)">
<h3>commitRecord</h3>
<div class="member-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Deprecated.html" title="class or interface in java.lang" class="external-link">@Deprecated</a>
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="member-name">commitRecord</span>&#8203;(<span class="parameters"><a href="SourceRecord.html" title="class in org.apache.kafka.connect.source">SourceRecord</a>&nbsp;record)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></span></div>
<div class="deprecation-block"><span class="deprecated-label">Deprecated.</span>
<div class="deprecation-comment">Use <a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord,org.apache.kafka.clients.producer.RecordMetadata)"><code>commitRecord(SourceRecord, RecordMetadata)</code></a> instead.</div>
</div>
<div class="block"><p>
Commit an individual <a href="SourceRecord.html" title="class in org.apache.kafka.connect.source"><code>SourceRecord</code></a> when the callback from the producer client is received. This method is
also called when a record is filtered by a transformation, and thus will never be ACK'd by a broker.
</p>
<p>
This is an alias for <a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord,org.apache.kafka.clients.producer.RecordMetadata)"><code>commitRecord(SourceRecord, RecordMetadata)</code></a> for backwards compatibility. The default
implementation of <a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord,org.apache.kafka.clients.producer.RecordMetadata)"><code>commitRecord(SourceRecord, RecordMetadata)</code></a> just calls this method. It is not necessary
to override both methods.
</p>
<p>
SourceTasks are not required to implement this functionality; Kafka Connect will record offsets
automatically. This hook is provided for systems that also need to store offsets internally
in their own system.
</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>record</code> - <a href="SourceRecord.html" title="class in org.apache.kafka.connect.source"><code>SourceRecord</code></a> that was successfully sent via the producer or filtered by a transformation</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="commitRecord(org.apache.kafka.connect.source.SourceRecord,org.apache.kafka.clients.producer.RecordMetadata)">
<h3>commitRecord</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="member-name">commitRecord</span>&#8203;(<span class="parameters"><a href="SourceRecord.html" title="class in org.apache.kafka.connect.source">SourceRecord</a>&nbsp;record,
<a href="../../clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer">RecordMetadata</a>&nbsp;metadata)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></span></div>
<div class="block"><p>
Commit an individual <a href="SourceRecord.html" title="class in org.apache.kafka.connect.source"><code>SourceRecord</code></a> when the callback from the producer client is received. This method is
also called when a record is filtered by a transformation, and thus will never be ACK'd by a broker. In this case
<code>metadata</code> will be null.
</p>
<p>
SourceTasks are not required to implement this functionality; Kafka Connect will record offsets
automatically. This hook is provided for systems that also need to store offsets internally
in their own system.
</p>
<p>
The default implementation just calls <a href="#commitRecord(org.apache.kafka.connect.source.SourceRecord)"><code>commitRecord(SourceRecord)</code></a>, which is a nop by default. It is
not necessary to implement both methods.
</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>record</code> - <a href="SourceRecord.html" title="class in org.apache.kafka.connect.source"><code>SourceRecord</code></a> that was successfully sent via the producer or filtered by a transformation</dd>
<dd><code>metadata</code> - <a href="../../clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer"><code>RecordMetadata</code></a> record metadata returned from the broker, or null if the record was filtered</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></code></dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottom-nav" id="navbar.bottom">
<div class="skip-nav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar.bottom.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="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="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
</div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<span class="skip-nav" id="skip.navbar.bottom">
<!-- -->
</span></nav>
</footer>
</div>
</div>
</body>
</html>