You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ew...@apache.org on 2017/02/25 00:41:22 UTC
[37/51] [partial] kafka-site git commit: Use 0.10.2.0 release version
of javadocs.
http://git-wip-us.apache.org/repos/asf/kafka-site/blob/836bb442/0102/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html
----------------------------------------------------------------------
diff --git a/0102/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html b/0102/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html
index 87aa35a..9969770 100644
--- a/0102/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html
+++ b/0102/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html
@@ -2,38 +2,25 @@
<!-- NewPage -->
<html lang="en">
<head>
-<!-- Generated by javadoc (1.8.0_66) on Thu Feb 23 11:45:51 PST 2017 -->
-<title>KafkaProducer (kafka-work 0.10.2.1-SNAPSHOT API)</title>
-<meta name="date" content="2017-02-23">
+<!-- Generated by javadoc (version 1.7.0_80) on Tue Feb 14 09:29:18 PST 2017 -->
+<title>KafkaProducer (kafka 0.10.2.0 API)</title>
+<meta name="date" content="2017-02-14">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
-<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
- try {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="KafkaProducer (kafka-work 0.10.2.1-SNAPSHOT API)";
- }
- }
- catch(err) {
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="KafkaProducer (kafka 0.10.2.0 API)";
}
//-->
-var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10};
-var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
-var altColor = "altColor";
-var rowColor = "rowColor";
-var tableTab = "tableTab";
-var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
-<div class="topNav"><a name="navbar.top">
+<div class="topNav"><a name="navbar_top">
<!-- -->
-</a>
-<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
-<a name="navbar.top.firstrow">
+</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
@@ -48,15 +35,15 @@ var activeTableTab = "activeTableTab";
</div>
<div class="subNav">
<ul class="navList">
-<li><a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer"><span class="typeNameLink">Prev Class</span></a></li>
-<li><a href="../../../../../org/apache/kafka/clients/producer/MockProducer.html" title="class in org.apache.kafka.clients.producer"><span class="typeNameLink">Next Class</span></a></li>
+<li><a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer"><span class="strong">Prev Class</span></a></li>
+<li><a href="../../../../../org/apache/kafka/clients/producer/MockProducer.html" title="class in org.apache.kafka.clients.producer"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/kafka/clients/producer/KafkaProducer.html" target="_top">Frames</a></li>
-<li><a href="KafkaProducer.html" target="_top">No Frames</a></li>
+<li><a href="KafkaProducer.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>
+<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
@@ -75,17 +62,17 @@ var activeTableTab = "activeTableTab";
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
-<li><a href="#constructor.summary">Constr</a> | </li>
-<li><a href="#method.summary">Method</a></li>
+<li><a href="#constructor_summary">Constr</a> | </li>
+<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
-<li><a href="#constructor.detail">Constr</a> | </li>
-<li><a href="#method.detail">Method</a></li>
+<li><a href="#constructor_detail">Constr</a> | </li>
+<li><a href="#method_detail">Method</a></li>
</ul>
</div>
-<a name="skip.navbar.top">
+<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
@@ -112,7 +99,7 @@ var activeTableTab = "activeTableTab";
</dl>
<hr>
<br>
-<pre>public class <span class="typeNameLabel">KafkaProducer<K,V></span>
+<pre>public class <span class="strong">KafkaProducer<K,V></span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><K,V></pre>
<div class="block">A Kafka client that publishes records to the Kafka cluster.
@@ -123,8 +110,7 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
Here is a simple example of using the producer to send records with strings containing sequential numbers as the key/value
pairs.
<pre>
- <code>
- Properties props = new Properties();
+ <code>Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("acks", "all");
props.put("retries", 0);
@@ -145,7 +131,7 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
as well as a background I/O thread that is responsible for turning these records into requests and transmitting them
to the cluster. Failure to close the producer after use will leak these resources.
<p>
- The <a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send-org.apache.kafka.clients.producer.ProducerRecord-"><code>send()</code></a> method is asynchronous. When called it adds the record to a buffer of pending record sends
+ The <a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send(org.apache.kafka.clients.producer.ProducerRecord)"><code>send()</code></a> method is asynchronous. When called it adds the record to a buffer of pending record sends
and immediately returns. This allows the producer to batch together individual records for efficiency.
<p>
The <code>acks</code> config controls the criteria under which requests are considered complete. The "all" setting
@@ -189,34 +175,34 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
-<li class="blockList"><a name="constructor.summary">
+<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
-<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
+<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"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
-<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer-java.util.Map-">KafkaProducer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> configs)</code>
+<td class="colOne"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer(java.util.Map)">KafkaProducer</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> configs)</code>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration.</div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer-java.util.Map-org.apache.kafka.common.serialization.Serializer-org.apache.kafka.common.serialization.Serializer-">KafkaProducer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> configs,
+<td class="colOne"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer(java.util.Map,%20org.apache.kafka.common.serialization.Serializer,%20org.apache.kafka.common.serialization.Serializer)">KafkaProducer</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> configs,
<a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>> keySerializer,
<a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> valueSerializer)</code>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration, a key and a value <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>.</div>
</td>
</tr>
<tr class="altColor">
-<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer-java.util.Properties-">KafkaProducer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</a> properties)</code>
+<td class="colOne"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer(java.util.Properties)">KafkaProducer</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</a> properties)</code>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration.</div>
</td>
</tr>
<tr class="rowColor">
-<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer-java.util.Properties-org.apache.kafka.common.serialization.Serializer-org.apache.kafka.common.serialization.Serializer-">KafkaProducer</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</a> properties,
+<td class="colOne"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#KafkaProducer(java.util.Properties,%20org.apache.kafka.common.serialization.Serializer,%20org.apache.kafka.common.serialization.Serializer)">KafkaProducer</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</a> properties,
<a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>> keySerializer,
<a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> valueSerializer)</code>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration, a key and a value <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>.</div>
@@ -227,68 +213,68 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
-<li class="blockList"><a name="method.summary">
+<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
-<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
-<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
+<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"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
-<tr id="i0" class="altColor">
+<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#close--">close</a></span>()</code>
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#close()">close</a></strong>()</code>
<div class="block">Close this producer.</div>
</td>
</tr>
-<tr id="i1" class="rowColor">
+<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#close-long-java.util.concurrent.TimeUnit-">close</a></span>(long timeout,
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#close(long,%20java.util.concurrent.TimeUnit)">close</a></strong>(long timeout,
<a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a> timeUnit)</code>
<div class="block">This method waits up to <code>timeout</code> for the producer to complete the sending of all incomplete requests.</div>
</td>
</tr>
-<tr id="i2" class="altColor">
+<tr class="altColor">
<td class="colFirst"><code>void</code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#flush--">flush</a></span>()</code>
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#flush()">flush</a></strong>()</code>
<div class="block">Invoking this method makes all buffered records immediately available to send (even if <code>linger.ms</code> is
greater than 0) and blocks on the completion of the requests associated with these records.</div>
</td>
</tr>
-<tr id="i3" class="rowColor">
+<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="../../../../../org/apache/kafka/common/MetricName.html" title="class in org.apache.kafka.common">MetricName</a>,? extends <a href="../../../../../org/apache/kafka/common/Metric.html" title="interface in org.apache.kafka.common">Metric</a>></code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#metrics--">metrics</a></span>()</code>
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#metrics()">metrics</a></strong>()</code>
<div class="block">Get the full set of internal metrics maintained by the producer.</div>
</td>
</tr>
-<tr id="i4" class="altColor">
+<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../../org/apache/kafka/common/PartitionInfo.html" title="class in org.apache.kafka.common">PartitionInfo</a>></code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#partitionsFor-java.lang.String-">partitionsFor</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> topic)</code>
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#partitionsFor(java.lang.String)">partitionsFor</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> topic)</code>
<div class="block">Get the partition metadata for the give topic.</div>
</td>
</tr>
-<tr id="i5" class="rowColor">
+<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</a><<a href="../../../../../org/apache/kafka/clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer">RecordMetadata</a>></code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send-org.apache.kafka.clients.producer.ProducerRecord-">send</a></span>(<a href="../../../../../org/apache/kafka/clients/producer/ProducerRecord.html" title="class in org.apache.kafka.clients.producer">ProducerRecord</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> record)</code>
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send(org.apache.kafka.clients.producer.ProducerRecord)">send</a></strong>(<a href="../../../../../org/apache/kafka/clients/producer/ProducerRecord.html" title="class in org.apache.kafka.clients.producer">ProducerRecord</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> record)</code>
<div class="block">Asynchronously send a record to a topic.</div>
</td>
</tr>
-<tr id="i6" class="altColor">
+<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</a><<a href="../../../../../org/apache/kafka/clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer">RecordMetadata</a>></code></td>
-<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send-org.apache.kafka.clients.producer.ProducerRecord-org.apache.kafka.clients.producer.Callback-">send</a></span>(<a href="../../../../../org/apache/kafka/clients/producer/ProducerRecord.html" title="class in org.apache.kafka.clients.producer">ProducerRecord</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> record,
+<td class="colLast"><code><strong><a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send(org.apache.kafka.clients.producer.ProducerRecord,%20org.apache.kafka.clients.producer.Callback)">send</a></strong>(<a href="../../../../../org/apache/kafka/clients/producer/ProducerRecord.html" title="class in org.apache.kafka.clients.producer">ProducerRecord</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> record,
<a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer">Callback</a> callback)</code>
<div class="block">Asynchronously send a record to a topic and invoke the provided callback when the send has been acknowledged.</div>
</td>
</tr>
</table>
<ul class="blockList">
-<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
+<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
-<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang
/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
+<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang
/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
@@ -300,11 +286,11 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
-<li class="blockList"><a name="constructor.detail">
+<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
-<a name="KafkaProducer-java.util.Map-">
+<a name="KafkaProducer(java.util.Map)">
<!-- -->
</a>
<ul class="blockList">
@@ -315,36 +301,28 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
are documented <a href="http://kafka.apache.org/documentation.html#producerconfigs">here</a>. Values can be
either strings or Objects of the appropriate type (for example a numeric configuration would accept either the
string "42" or the integer 42).</div>
-<dl>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>configs</code> - The producer configs</dd>
-</dl>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>configs</code> - The producer configs</dd></dl>
</li>
</ul>
-<a name="KafkaProducer-java.util.Map-org.apache.kafka.common.serialization.Serializer-org.apache.kafka.common.serialization.Serializer-">
+<a name="KafkaProducer(java.util.Map, org.apache.kafka.common.serialization.Serializer, org.apache.kafka.common.serialization.Serializer)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>KafkaProducer</h4>
<pre>public KafkaProducer(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> configs,
- <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>> keySerializer,
- <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> valueSerializer)</pre>
+ <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>> keySerializer,
+ <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> valueSerializer)</pre>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration, a key and a value <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>.
Valid configuration strings are documented <a href="http://kafka.apache.org/documentation.html#producerconfigs">here</a>.
Values can be either strings or Objects of the appropriate type (for example a numeric configuration would accept
either the string "42" or the integer 42).</div>
-<dl>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>configs</code> - The producer configs</dd>
-<dd><code>keySerializer</code> - The serializer for key that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't be
- called in the producer when the serializer is passed in directly.</dd>
-<dd><code>valueSerializer</code> - The serializer for value that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't
- be called in the producer when the serializer is passed in directly.</dd>
-</dl>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>configs</code> - The producer configs</dd><dd><code>keySerializer</code> - The serializer for key that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't be
+ called in the producer when the serializer is passed in directly.</dd><dd><code>valueSerializer</code> - The serializer for value that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't
+ be called in the producer when the serializer is passed in directly.</dd></dl>
</li>
</ul>
-<a name="KafkaProducer-java.util.Properties-">
+<a name="KafkaProducer(java.util.Properties)">
<!-- -->
</a>
<ul class="blockList">
@@ -353,42 +331,34 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<pre>public KafkaProducer(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</a> properties)</pre>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration. Valid configuration strings
are documented <a href="http://kafka.apache.org/documentation.html#producerconfigs">here</a>.</div>
-<dl>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>properties</code> - The producer configs</dd>
-</dl>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>properties</code> - The producer configs</dd></dl>
</li>
</ul>
-<a name="KafkaProducer-java.util.Properties-org.apache.kafka.common.serialization.Serializer-org.apache.kafka.common.serialization.Serializer-">
+<a name="KafkaProducer(java.util.Properties, org.apache.kafka.common.serialization.Serializer, org.apache.kafka.common.serialization.Serializer)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>KafkaProducer</h4>
<pre>public KafkaProducer(<a href="http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html?is-external=true" title="class or interface in java.util">Properties</a> properties,
- <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>> keySerializer,
- <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> valueSerializer)</pre>
+ <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>> keySerializer,
+ <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization">Serializer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> valueSerializer)</pre>
<div class="block">A producer is instantiated by providing a set of key-value pairs as configuration, a key and a value <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>.
Valid configuration strings are documented <a href="http://kafka.apache.org/documentation.html#producerconfigs">here</a>.</div>
-<dl>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>properties</code> - The producer configs</dd>
-<dd><code>keySerializer</code> - The serializer for key that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't be
- called in the producer when the serializer is passed in directly.</dd>
-<dd><code>valueSerializer</code> - The serializer for value that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't
- be called in the producer when the serializer is passed in directly.</dd>
-</dl>
+<dl><dt><span class="strong">Parameters:</span></dt><dd><code>properties</code> - The producer configs</dd><dd><code>keySerializer</code> - The serializer for key that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't be
+ called in the producer when the serializer is passed in directly.</dd><dd><code>valueSerializer</code> - The serializer for value that implements <a href="../../../../../org/apache/kafka/common/serialization/Serializer.html" title="interface in org.apache.kafka.common.serialization"><code>Serializer</code></a>. The configure() method won't
+ be called in the producer when the serializer is passed in directly.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
-<li class="blockList"><a name="method.detail">
+<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
-<a name="send-org.apache.kafka.clients.producer.ProducerRecord-">
+<a name="send(org.apache.kafka.clients.producer.ProducerRecord)">
<!-- -->
</a>
<ul class="blockList">
@@ -396,25 +366,22 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<h4>send</h4>
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</a><<a href="../../../../../org/apache/kafka/clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer">RecordMetadata</a>> send(<a href="../../../../../org/apache/kafka/clients/producer/ProducerRecord.html" title="class in org.apache.kafka.clients.producer">ProducerRecord</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> record)</pre>
<div class="block">Asynchronously send a record to a topic. Equivalent to <code>send(record, null)</code>.
- See <a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send-org.apache.kafka.clients.producer.ProducerRecord-org.apache.kafka.clients.producer.Callback-"><code>send(ProducerRecord, Callback)</code></a> for details.</div>
+ See <a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html#send(org.apache.kafka.clients.producer.ProducerRecord,%20org.apache.kafka.clients.producer.Callback)"><code>send(ProducerRecord, Callback)</code></a> for details.</div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#send-org.apache.kafka.clients.producer.ProducerRecord-">send</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>record</code> - The record to send</dd>
-<dt><span class="returnLabel">Returns:</span></dt>
-<dd>A future which will eventually contain the response information</dd>
-</dl>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#send(org.apache.kafka.clients.producer.ProducerRecord)">send</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><span class="strong">Parameters:</span></dt><dd><code>record</code> - The record to send</dd>
+<dt><span class="strong">Returns:</span></dt><dd>A future which will eventually contain the response information</dd></dl>
</li>
</ul>
-<a name="send-org.apache.kafka.clients.producer.ProducerRecord-org.apache.kafka.clients.producer.Callback-">
+<a name="send(org.apache.kafka.clients.producer.ProducerRecord, org.apache.kafka.clients.producer.Callback)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>send</h4>
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</a><<a href="../../../../../org/apache/kafka/clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer">RecordMetadata</a>> send(<a href="../../../../../org/apache/kafka/clients/producer/ProducerRecord.html" title="class in org.apache.kafka.clients.producer">ProducerRecord</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>> record,
- <a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer">Callback</a> callback)</pre>
+ <a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer">Callback</a> callback)</pre>
<div class="block">Asynchronously send a record to a topic and invoke the provided callback when the send has been acknowledged.
<p>
The send is asynchronous and this method will return immediately once the record has been stored in the buffer of
@@ -429,14 +396,13 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
topic, the timestamp will be the Kafka broker local time when the message is appended.
<p>
Since the send call is asynchronous it returns a <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent"><code>Future</code></a> for the
- <a href="../../../../../org/apache/kafka/clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer"><code>RecordMetadata</code></a> that will be assigned to this record. Invoking <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true#get--" title="class or interface in java.util.concurrent"><code>get()</code></a> on this future will block until the associated request completes and then return the metadata for the record
+ <a href="../../../../../org/apache/kafka/clients/producer/RecordMetadata.html" title="class in org.apache.kafka.clients.producer"><code>RecordMetadata</code></a> that will be assigned to this record. Invoking <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html?is-external=true#get()" title="class or interface in java.util.concurrent"><code>get()</code></a> on this future will block until the associated request completes and then return the metadata for the record
or throw any exception that occurred while sending the record.
<p>
If you want to simulate a simple blocking call you can call the <code>get()</code> method immediately:
<pre>
- <code>
- byte[] key = "key".getBytes();
+ <code>byte[] key = "key".getBytes();
byte[] value = "value".getBytes();
ProducerRecord<byte[],byte[]> record = new ProducerRecord<byte[],byte[]>("my-topic", key, value)
producer.send(record).get();
@@ -446,8 +412,7 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
will be invoked when the request is complete.
<pre>
- <code>
- ProducerRecord<byte[],byte[]> record = new ProducerRecord<byte[],byte[]>("the-topic", key, value);
+ <code>ProducerRecord<byte[],byte[]> record = new ProducerRecord<byte[],byte[]>("the-topic", key, value);
producer.send(myRecord,
new Callback() {
public void onCompletion(RecordMetadata metadata, Exception e) {
@@ -465,8 +430,7 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
following example <code>callback1</code> is guaranteed to execute before <code>callback2</code>:
<pre>
- <code>
- producer.send(new ProducerRecord<byte[],byte[]>(topic, partition, key1, value1), callback1);
+ <code>producer.send(new ProducerRecord<byte[],byte[]>(topic, partition, key1, value1), callback1);
producer.send(new ProducerRecord<byte[],byte[]>(topic, partition, key2, value2), callback2);
</code>
</pre>
@@ -476,21 +440,18 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
expensive callbacks it is recommended to use your own <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent"><code>Executor</code></a> in the callback body
to parallelize processing.</div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#send-org.apache.kafka.clients.producer.ProducerRecord-org.apache.kafka.clients.producer.Callback-">send</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>record</code> - The record to send</dd>
-<dd><code>callback</code> - A user-supplied callback to execute when the record has been acknowledged by the server (null
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#send(org.apache.kafka.clients.producer.ProducerRecord,%20org.apache.kafka.clients.producer.Callback)">send</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><span class="strong">Parameters:</span></dt><dd><code>record</code> - The record to send</dd><dd><code>callback</code> - A user-supplied callback to execute when the record has been acknowledged by the server (null
indicates no callback)</dd>
-<dt><span class="throwsLabel">Throws:</span></dt>
+<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd>
<dd><code><a href="../../../../../org/apache/kafka/common/errors/SerializationException.html" title="class in org.apache.kafka.common.errors">SerializationException</a></code> - If the key or value are not valid objects given the configured serializers</dd>
<dd><code><a href="../../../../../org/apache/kafka/common/errors/TimeoutException.html" title="class in org.apache.kafka.common.errors">TimeoutException</a></code> - If the time taken for fetching metadata or allocating memory for the record has surpassed <code>max.block.ms</code>.</dd>
-<dd><code><a href="../../../../../org/apache/kafka/common/KafkaException.html" title="class in org.apache.kafka.common">KafkaException</a></code> - If a Kafka related error occurs that does not belong to the public API exceptions.</dd>
-</dl>
+<dd><code><a href="../../../../../org/apache/kafka/common/KafkaException.html" title="class in org.apache.kafka.common">KafkaException</a></code> - If a Kafka related error occurs that does not belong to the public API exceptions.</dd></dl>
</li>
</ul>
-<a name="flush--">
+<a name="flush()">
<!-- -->
</a>
<ul class="blockList">
@@ -511,8 +472,7 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<p>
This example shows how to consume from one Kafka topic and produce to another Kafka topic:
<pre>
- <code>
- for(ConsumerRecord<String, String> record: consumer.poll(100))
+ <code>for(ConsumerRecord<String, String> record: consumer.poll(100))
producer.send(new ProducerRecord("my-topic", record.key(), record.value());
producer.flush();
consumer.commit();
@@ -522,14 +482,13 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
Note that the above example may drop records if the produce request fails. If we want to ensure that this does not occur
we need to set <code>retries=<large_number></code> in our config.</div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#flush--">flush</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
-<dt><span class="throwsLabel">Throws:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd>
-</dl>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#flush()">flush</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd></dl>
</li>
</ul>
-<a name="partitionsFor-java.lang.String-">
+<a name="partitionsFor(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
@@ -538,14 +497,13 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../../../org/apache/kafka/common/PartitionInfo.html" title="class in org.apache.kafka.common">PartitionInfo</a>> partitionsFor(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> topic)</pre>
<div class="block">Get the partition metadata for the give topic. This can be used for custom partitioning.</div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#partitionsFor-java.lang.String-">partitionsFor</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
-<dt><span class="throwsLabel">Throws:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd>
-</dl>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#partitionsFor(java.lang.String)">partitionsFor</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd></dl>
</li>
</ul>
-<a name="metrics--">
+<a name="metrics()">
<!-- -->
</a>
<ul class="blockList">
@@ -554,12 +512,12 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="../../../../../org/apache/kafka/common/MetricName.html" title="class in org.apache.kafka.common">MetricName</a>,? extends <a href="../../../../../org/apache/kafka/common/Metric.html" title="interface in org.apache.kafka.common">Metric</a>> metrics()</pre>
<div class="block">Get the full set of internal metrics maintained by the producer.</div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#metrics--">metrics</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#metrics()">metrics</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
</dl>
</li>
</ul>
-<a name="close--">
+<a name="close()">
<!-- -->
</a>
<ul class="blockList">
@@ -574,25 +532,24 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
block forever.</strong>
<p></div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html?is-external=true#close--" title="class or interface in java.io">close</a></code> in interface <code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a></code></dd>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true#close--" title="class or interface in java.lang">close</a></code> in interface <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a></code></dd>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#close--">close</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
-<dt><span class="throwsLabel">Throws:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd>
-</dl>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html?is-external=true#close()" title="class or interface in java.io">close</a></code> in interface <code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</a></code></dd>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true#close()" title="class or interface in java.lang">close</a></code> in interface <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html?is-external=true" title="class or interface in java.lang">AutoCloseable</a></code></dd>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#close()">close</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><span class="strong">Throws:</span></dt>
+<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd></dl>
</li>
</ul>
-<a name="close-long-java.util.concurrent.TimeUnit-">
+<a name="close(long, java.util.concurrent.TimeUnit)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>close</h4>
<pre>public void close(long timeout,
- <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a> timeUnit)</pre>
+ <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</a> timeUnit)</pre>
<div class="block">This method waits up to <code>timeout</code> for the producer to complete the sending of all incomplete requests.
<p>
If the producer is unable to complete all requests before the timeout expires, this method will fail
@@ -602,16 +559,13 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<code>close(0, TimeUnit.MILLISECONDS)</code>. This is done since no further sending will happen while
blocking the I/O thread of the producer.</div>
<dl>
-<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
-<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#close-long-java.util.concurrent.TimeUnit-">close</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
-<dt><span class="paramLabel">Parameters:</span></dt>
-<dd><code>timeout</code> - The maximum time to wait for producer to complete any pending requests. The value should be
- non-negative. Specifying a timeout of zero means do not wait for pending send requests to complete.</dd>
-<dd><code>timeUnit</code> - The time unit for the <code>timeout</code></dd>
-<dt><span class="throwsLabel">Throws:</span></dt>
+<dt><strong>Specified by:</strong></dt>
+<dd><code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html#close(long,%20java.util.concurrent.TimeUnit)">close</a></code> in interface <code><a href="../../../../../org/apache/kafka/clients/producer/Producer.html" title="interface in org.apache.kafka.clients.producer">Producer</a><<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">K</a>,<a href="../../../../../org/apache/kafka/clients/producer/KafkaProducer.html" title="type parameter in KafkaProducer">V</a>></code></dd>
+<dt><span class="strong">Parameters:</span></dt><dd><code>timeout</code> - The maximum time to wait for producer to complete any pending requests. The value should be
+ non-negative. Specifying a timeout of zero means do not wait for pending send requests to complete.</dd><dd><code>timeUnit</code> - The time unit for the <code>timeout</code></dd>
+<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../org/apache/kafka/common/errors/InterruptException.html" title="class in org.apache.kafka.common.errors">InterruptException</a></code> - If the thread is interrupted while blocked</dd>
-<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - If the <code>timeout</code> is negative.</dd>
-</dl>
+<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - If the <code>timeout</code> is negative.</dd></dl>
</li>
</ul>
</li>
@@ -622,11 +576,9 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
-<div class="bottomNav"><a name="navbar.bottom">
+<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
-</a>
-<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
-<a name="navbar.bottom.firstrow">
+</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
@@ -641,15 +593,15 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
</div>
<div class="subNav">
<ul class="navList">
-<li><a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer"><span class="typeNameLink">Prev Class</span></a></li>
-<li><a href="../../../../../org/apache/kafka/clients/producer/MockProducer.html" title="class in org.apache.kafka.clients.producer"><span class="typeNameLink">Next Class</span></a></li>
+<li><a href="../../../../../org/apache/kafka/clients/producer/Callback.html" title="interface in org.apache.kafka.clients.producer"><span class="strong">Prev Class</span></a></li>
+<li><a href="../../../../../org/apache/kafka/clients/producer/MockProducer.html" title="class in org.apache.kafka.clients.producer"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/kafka/clients/producer/KafkaProducer.html" target="_top">Frames</a></li>
-<li><a href="KafkaProducer.html" target="_top">No Frames</a></li>
+<li><a href="KafkaProducer.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>
+<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
@@ -668,17 +620,17 @@ implements <a href="../../../../../org/apache/kafka/clients/producer/Producer.ht
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
-<li><a href="#constructor.summary">Constr</a> | </li>
-<li><a href="#method.summary">Method</a></li>
+<li><a href="#constructor_summary">Constr</a> | </li>
+<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
-<li><a href="#constructor.detail">Constr</a> | </li>
-<li><a href="#method.detail">Method</a></li>
+<li><a href="#constructor_detail">Constr</a> | </li>
+<li><a href="#method_detail">Method</a></li>
</ul>
</div>
-<a name="skip.navbar.bottom">
+<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->