| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>SinkTask (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.sink, class: SinkTask"> |
| <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":10,"i2":10,"i3":42,"i4":42,"i5":10,"i6":10,"i7":6,"i8":6,"i9":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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </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> <a href="package-summary.html">org.apache.kafka.connect.sink</a></div> |
| <h1 title="Class SinkTask" class="title">Class SinkTask</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.sink.SinkTask</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">SinkTask</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">SinkTask is a Task that takes records loaded from Kafka and sends them to another system. Each task |
| instance is assigned a set of partitions by the Connect framework and will handle all records received |
| from those partitions. As records are fetched from Kafka, they will be passed to the sink task using the |
| <a href="#put(java.util.Collection)"><code>put(Collection)</code></a> API, which should either write them to the downstream system or batch them for |
| later writing. Periodically, Connect will call <a href="#flush(java.util.Map)"><code>flush(Map)</code></a> to ensure that batched records are |
| actually pushed to the downstream system.. |
| |
| Below we describe the lifecycle of a SinkTask. |
| |
| <ol> |
| <li><b>Initialization:</b> SinkTasks are first initialized using <a href="#initialize(org.apache.kafka.connect.sink.SinkTaskContext)"><code>initialize(SinkTaskContext)</code></a> |
| to prepare the task's context and <a href="#start(java.util.Map)"><code>start(Map)</code></a> to accept configuration and start any services |
| needed for processing.</li> |
| <li><b>Partition Assignment:</b> After initialization, Connect will assign the task a set of partitions |
| using <a href="#open(java.util.Collection)"><code>open(Collection)</code></a>. These partitions are owned exclusively by this task until they |
| have been closed with <a href="#close(java.util.Collection)"><code>close(Collection)</code></a>.</li> |
| <li><b>Record Processing:</b> Once partitions have been opened for writing, Connect will begin forwarding |
| records from Kafka using the <a href="#put(java.util.Collection)"><code>put(Collection)</code></a> API. Periodically, Connect will ask the task |
| to flush records using <a href="#flush(java.util.Map)"><code>flush(Map)</code></a> as described above.</li> |
| <li><b>Partition Rebalancing:</b> Occasionally, Connect will need to change the assignment of this task. |
| When this happens, the currently assigned partitions will be closed with <a href="#close(java.util.Collection)"><code>close(Collection)</code></a> and |
| the new assignment will be opened using <a href="#open(java.util.Collection)"><code>open(Collection)</code></a>.</li> |
| <li><b>Shutdown:</b> When the task needs to be shutdown, Connect will close active partitions (if there |
| are any) and stop the task using <a href="#stop()"><code>stop()</code></a></li> |
| </ol></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="SinkTaskContext.html" title="interface in org.apache.kafka.connect.sink">SinkTaskContext</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"> </td> |
| </tr> |
| <tr class="row-color"> |
| <td class="col-first"><code>static <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></code></td> |
| <th class="col-second" scope="row"><code><span class="member-name-link"><a href="#TOPICS_CONFIG">TOPICS_CONFIG</a></span></code></th> |
| <td class="col-last"> |
| <div class="block"> |
| The configuration key that provides the list of topics that are inputs for this |
| SinkTask.</div> |
| </td> |
| </tr> |
| <tr class="alt-color"> |
| <td class="col-first"><code>static <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></code></td> |
| <th class="col-second" scope="row"><code><span class="member-name-link"><a href="#TOPICS_REGEX_CONFIG">TOPICS_REGEX_CONFIG</a></span></code></th> |
| <td class="col-last"> |
| <div class="block"> |
| The configuration key that provides a regex specifying which topics to include as inputs |
| for this SinkTask.</div> |
| </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()">SinkTask</a></span>()</code></th> |
| <td class="col-last"> </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="#close(java.util.Collection)">close</a></span>​(<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</code></th> |
| <td class="col-last"> |
| <div class="block">The SinkTask use this method to close writers for partitions that are no |
| longer assigned to the SinkTask.</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="#flush(java.util.Map)">flush</a></span>​(<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><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>,​<a href="../../clients/consumer/OffsetAndMetadata.html" title="class in org.apache.kafka.clients.consumer">OffsetAndMetadata</a>> currentOffsets)</code></th> |
| <td class="col-last"> |
| <div class="block">Flush all records that have been <a href="#put(java.util.Collection)"><code>put(Collection)</code></a> for the specified topic-partitions.</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="#initialize(org.apache.kafka.connect.sink.SinkTaskContext)">initialize</a></span>​(<a href="SinkTaskContext.html" title="interface in org.apache.kafka.connect.sink">SinkTaskContext</a> context)</code></th> |
| <td class="col-last"> |
| <div class="block">Initialize the context of this task.</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="#onPartitionsAssigned(java.util.Collection)">onPartitionsAssigned</a></span>​(<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</code></th> |
| <td class="col-last"> |
| <div class="block"><span class="deprecated-label">Deprecated.</span> |
| <div class="deprecation-comment">Use <a href="#open(java.util.Collection)"><code>open(Collection)</code></a> for partition initialization.</div> |
| </div> |
| </td> |
| </tr> |
| <tr class="alt-color" id="i4"> |
| <td class="col-first"><code>void</code></td> |
| <th class="col-second" scope="row"><code><span class="member-name-link"><a href="#onPartitionsRevoked(java.util.Collection)">onPartitionsRevoked</a></span>​(<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</code></th> |
| <td class="col-last"> |
| <div class="block"><span class="deprecated-label">Deprecated.</span> |
| <div class="deprecation-comment">Use <a href="#close(java.util.Collection)"><code>close(Collection)</code></a> instead for partition cleanup.</div> |
| </div> |
| </td> |
| </tr> |
| <tr class="row-color" id="i5"> |
| <td class="col-first"><code>void</code></td> |
| <th class="col-second" scope="row"><code><span class="member-name-link"><a href="#open(java.util.Collection)">open</a></span>​(<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</code></th> |
| <td class="col-last"> |
| <div class="block">The SinkTask use this method to create writers for newly assigned partitions in case of partition |
| rebalance.</div> |
| </td> |
| </tr> |
| <tr class="alt-color" id="i6"> |
| <td class="col-first"><code><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><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>,​<a href="../../clients/consumer/OffsetAndMetadata.html" title="class in org.apache.kafka.clients.consumer">OffsetAndMetadata</a>></code></td> |
| <th class="col-second" scope="row"><code><span class="member-name-link"><a href="#preCommit(java.util.Map)">preCommit</a></span>​(<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><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>,​<a href="../../clients/consumer/OffsetAndMetadata.html" title="class in org.apache.kafka.clients.consumer">OffsetAndMetadata</a>> currentOffsets)</code></th> |
| <td class="col-last"> |
| <div class="block">Pre-commit hook invoked prior to an offset commit.</div> |
| </td> |
| </tr> |
| <tr class="row-color" id="i7"> |
| <td class="col-first"><code>abstract void</code></td> |
| <th class="col-second" scope="row"><code><span class="member-name-link"><a href="#put(java.util.Collection)">put</a></span>​(<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="SinkRecord.html" title="class in org.apache.kafka.connect.sink">SinkRecord</a>> records)</code></th> |
| <td class="col-last"> |
| <div class="block">Put the records in the sink.</div> |
| </td> |
| </tr> |
| <tr class="alt-color" id="i8"> |
| <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>​(<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><<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>,​<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>> props)</code></th> |
| <td class="col-last"> |
| <div class="block">Start the Task.</div> |
| </td> |
| </tr> |
| <tr class="row-color" id="i9"> |
| <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">Perform any cleanup to stop this task.</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods.inherited.from.class.java.lang.Object">Methods inherited from class 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 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="TOPICS_CONFIG"> |
| <h3>TOPICS_CONFIG</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><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></span> <span class="member-name">TOPICS_CONFIG</span></div> |
| <div class="block"><p> |
| The configuration key that provides the list of topics that are inputs for this |
| SinkTask. |
| </p></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.kafka.connect.sink.SinkTask.TOPICS_CONFIG">Constant Field Values</a></dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="TOPICS_REGEX_CONFIG"> |
| <h3>TOPICS_REGEX_CONFIG</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type"><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></span> <span class="member-name">TOPICS_REGEX_CONFIG</span></div> |
| <div class="block"><p> |
| The configuration key that provides a regex specifying which topics to include as inputs |
| for this SinkTask. |
| </p></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.kafka.connect.sink.SinkTask.TOPICS_REGEX_CONFIG">Constant Field Values</a></dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="context"> |
| <h3>context</h3> |
| <div class="member-signature"><span class="modifiers">protected</span> <span class="return-type"><a href="SinkTaskContext.html" title="interface in org.apache.kafka.connect.sink">SinkTaskContext</a></span> <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="<init>()"> |
| <h3>SinkTask</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="member-name">SinkTask</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.sink.SinkTaskContext)"> |
| <h3>initialize</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="member-name">initialize</span>​(<span class="parameters"><a href="SinkTaskContext.html" title="interface in org.apache.kafka.connect.sink">SinkTaskContext</a> context)</span></div> |
| <div class="block">Initialize the context of this task. Note that the partition assignment will be empty until |
| Connect has opened the partitions for writing with <a href="#open(java.util.Collection)"><code>open(Collection)</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>context</code> - The sink task's context</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="start(java.util.Map)"> |
| <h3>start</h3> |
| <div class="member-signature"><span class="modifiers">public abstract</span> <span class="return-type">void</span> <span class="member-name">start</span>​(<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><<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>,​<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>> 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> in interface <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="put(java.util.Collection)"> |
| <h3>put</h3> |
| <div class="member-signature"><span class="modifiers">public abstract</span> <span class="return-type">void</span> <span class="member-name">put</span>​(<span class="parameters"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="SinkRecord.html" title="class in org.apache.kafka.connect.sink">SinkRecord</a>> records)</span></div> |
| <div class="block">Put the records in the sink. Usually this should send the records to the sink asynchronously |
| and immediately return. |
| |
| If this operation fails, the SinkTask may throw a <a href="../errors/RetriableException.html" title="class in org.apache.kafka.connect.errors"><code>RetriableException</code></a> to |
| indicate that the framework should attempt to retry the same call again. Other exceptions will cause the task to |
| be stopped immediately. <a href="SinkTaskContext.html#timeout(long)"><code>SinkTaskContext.timeout(long)</code></a> can be used to set the maximum time before the |
| batch will be retried.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>records</code> - the set of records to send</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="flush(java.util.Map)"> |
| <h3>flush</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="member-name">flush</span>​(<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><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>,​<a href="../../clients/consumer/OffsetAndMetadata.html" title="class in org.apache.kafka.clients.consumer">OffsetAndMetadata</a>> currentOffsets)</span></div> |
| <div class="block">Flush all records that have been <a href="#put(java.util.Collection)"><code>put(Collection)</code></a> for the specified topic-partitions.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>currentOffsets</code> - the current offset state as of the last call to <a href="#put(java.util.Collection)"><code>put(Collection)</code></a>}, |
| provided for convenience but could also be determined by tracking all offsets included in the <a href="SinkRecord.html" title="class in org.apache.kafka.connect.sink"><code>SinkRecord</code></a>s |
| passed to <a href="#put(java.util.Collection)"><code>put(java.util.Collection<org.apache.kafka.connect.sink.SinkRecord>)</code></a>.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="preCommit(java.util.Map)"> |
| <h3>preCommit</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type"><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><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>,​<a href="../../clients/consumer/OffsetAndMetadata.html" title="class in org.apache.kafka.clients.consumer">OffsetAndMetadata</a>></span> <span class="member-name">preCommit</span>​(<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><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>,​<a href="../../clients/consumer/OffsetAndMetadata.html" title="class in org.apache.kafka.clients.consumer">OffsetAndMetadata</a>> currentOffsets)</span></div> |
| <div class="block">Pre-commit hook invoked prior to an offset commit. |
| |
| The default implementation simply invokes <a href="#flush(java.util.Map)"><code>flush(Map)</code></a> and is thus able to assume all <code>currentOffsets</code> are safe to commit.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>currentOffsets</code> - the current offset state as of the last call to <a href="#put(java.util.Collection)"><code>put(Collection)</code></a>}, |
| provided for convenience but could also be determined by tracking all offsets included in the <a href="SinkRecord.html" title="class in org.apache.kafka.connect.sink"><code>SinkRecord</code></a>s |
| passed to <a href="#put(java.util.Collection)"><code>put(java.util.Collection<org.apache.kafka.connect.sink.SinkRecord>)</code></a>.</dd> |
| <dt>Returns:</dt> |
| <dd>an empty map if Connect-managed offset commit is not desired, otherwise a map of offsets by topic-partition that are safe to commit.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="open(java.util.Collection)"> |
| <h3>open</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="member-name">open</span>​(<span class="parameters"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</span></div> |
| <div class="block">The SinkTask use this method to create writers for newly assigned partitions in case of partition |
| rebalance. This method will be called after partition re-assignment completes and before the SinkTask starts |
| fetching data. Note that any errors raised from this method will cause the task to stop.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>partitions</code> - The list of partitions that are now assigned to the task (may include |
| partitions previously assigned to the task)</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="onPartitionsAssigned(java.util.Collection)"> |
| <h3>onPartitionsAssigned</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> <span class="return-type">void</span> <span class="member-name">onPartitionsAssigned</span>​(<span class="parameters"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</span></div> |
| <div class="deprecation-block"><span class="deprecated-label">Deprecated.</span> |
| <div class="deprecation-comment">Use <a href="#open(java.util.Collection)"><code>open(Collection)</code></a> for partition initialization.</div> |
| </div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="close(java.util.Collection)"> |
| <h3>close</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="return-type">void</span> <span class="member-name">close</span>​(<span class="parameters"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</span></div> |
| <div class="block">The SinkTask use this method to close writers for partitions that are no |
| longer assigned to the SinkTask. This method will be called before a rebalance operation starts |
| and after the SinkTask stops fetching data. After being closed, Connect will not write |
| any records to the task until a new set of partitions has been opened. Note that any errors raised |
| from this method will cause the task to stop.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>partitions</code> - The list of partitions that should be closed</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="onPartitionsRevoked(java.util.Collection)"> |
| <h3>onPartitionsRevoked</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> <span class="return-type">void</span> <span class="member-name">onPartitionsRevoked</span>​(<span class="parameters"><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><<a href="../../common/TopicPartition.html" title="class in org.apache.kafka.common">TopicPartition</a>> partitions)</span></div> |
| <div class="deprecation-block"><span class="deprecated-label">Deprecated.</span> |
| <div class="deprecation-comment">Use <a href="#close(java.util.Collection)"><code>close(Collection)</code></a> instead for partition cleanup.</div> |
| </div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="stop()"> |
| <h3>stop</h3> |
| <div class="member-signature"><span class="modifiers">public abstract</span> <span class="return-type">void</span> <span class="member-name">stop</span>()</div> |
| <div class="block">Perform any cleanup to stop this task. In SinkTasks, this method is invoked only once outstanding calls to other |
| methods have completed (e.g., <a href="#put(java.util.Collection)"><code>put(Collection)</code></a> has returned) and a final <a href="#flush(java.util.Map)"><code>flush(Map)</code></a> and offset |
| commit has completed. Implementations of this method should only need to perform final cleanup operations, such |
| as closing network connections to the sink system.</div> |
| <dl class="notes"> |
| <dt>Specified by:</dt> |
| <dd><code><a href="../connector/Task.html#stop()">stop</a></code> in interface <code><a href="../connector/Task.html" title="interface in org.apache.kafka.connect.connector">Task</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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </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> |