Update KafkaConsumer Javadoc examples to use poll(Duration timeout) API
Author: Matthias Wessendorf
Reviewers: Manikumar Reddy
Closes from matzew/use_new_poll_api
@@ -210,7 +210,7 @@ import java.util.regex.Pattern;
* KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;&gt;(props);
* consumer.subscribe(Arrays.asList(&quot;foo&quot;, &quot;bar&quot;));
* while (true) {
- * ConsumerRecords&lt;String, String&gt; records = consumer.poll(100);
+ * ConsumerRecords&lt;String, String&gt; records = consumer.poll(Duration.ofMillis(100));
* for (ConsumerRecord&lt;String, String&gt; record : records)
* System.out.printf(&quot;offset = %d, key = %s, value = %s%n&quot;, record.offset(), record.key(), record.value());
* }
@@ -249,7 +249,7 @@ import java.util.regex.Pattern;
* final int minBatchSize = 200;
* List&lt;ConsumerRecord&lt;String, String&gt;&gt; buffer = new ArrayList&lt;&gt;();
* while (true) {
- * ConsumerRecords&lt;String, String&gt; records = consumer.poll(100);
+ * ConsumerRecords&lt;String, String&gt; records = consumer.poll(Duration.ofMillis(100);
* for (ConsumerRecord&lt;String, String&gt; record : records) {
* buffer.add(record);
* }
@@ -288,7 +288,7 @@ import java.util.regex.Pattern;
* <pre>
* try {
* while(running) {
- * ConsumerRecords&lt;String, String&gt; records = consumer.poll(Long.MAX_VALUE);
+ * ConsumerRecords&lt;String, String&gt; records = consumer.poll(Duration.ofMillis(Long.MAX_VALUE));
* for (TopicPartition partition : records.partitions()) {
* List&lt;ConsumerRecord&lt;String, String&gt;&gt; partitionRecords = records.records(partition);
* for (ConsumerRecord&lt;String, String&gt; record : partitionRecords) {
