Commit Graph

57 Commits

Author SHA1 Message Date
Federico Valeri 4cb20379c7
MINOR: Add retry mechanism to EOS example (#15561)
In the initial EOS example, a retry logic was implemented within the resetToLastCommittedPositions method. During refactoring, this logic was removed becasue a poison pill prevented the example from reaching the final phase of consuming from the output topic.

In this change, I suggest to add it back, but with a retry limit defined as MAX_RETRIES. Once this limit is reached, the problematic batch will be logged and skipped, allowing the processor to move on and process remaining records. If some records are skipped, the example will still hit the hard timeout (2 minutes), but after consuming all processed records.

Reviewers: Luke Chen <showuon@gmail.com>
2024-03-27 16:31:27 +08:00
Divij Vaidya 6250049e10
KAFKA-13950: Fix resource leak in error scenarios (#12228)
We are not properly closing Closeable resources in the code base at multiple places especially when we have an exception. This code change fixes multiple of these leaks.

Reviewers: Ismael Juma <ismael@juma.me.uk>, Luke Chen <showuon@gmail.com>, Mickael Maison <mickael.maison@gmail.com>
2023-12-21 13:47:22 +01:00
Federico Valeri 111df859f0
MINOR: Add comment to onPartitionsLost override (#14121)
This adds comments to the ConsumerRebalanceListener overrides, in order to briefly explain why we are overriding these methods, when they are called, and what you can or can't do. Especially onPartitionsLost can create some confusion given the default implementation.

Reviewers: Luke Chen <showuon@gmail.com>, David Jacot <djacot@confluent.io>
2023-08-11 10:34:55 +08:00
Said Boudjelda 2574bef61c
MINOR: remove unused variable in examples (#14021)
Reviewers: Divij Vaidya <diviv@amazon.com>
2023-07-17 21:40:21 +02:00
Federico Valeri c757af5f7c
KAFKA-14752: Kafka examples improvements - demo changes (#13517)
KAFKA-14752: Kafka examples improvements - demo changes

Reviewers: Luke Chen <showuon@gmail.com>
2023-05-12 10:39:12 +08:00
Federico Valeri ee41328635
KAFKA-14752: Kafka examples improvements - processor changes (#13516)
Reviewers: Luke Chen <showuon@gmail.com>
2023-05-11 17:19:32 +08:00
Federico Valeri 78090bb4cd
KAFKA-14752: Kafka examples improvements - producer changes (#13515)
KAFKA-14752: Kafka examples improvements - producer changes

Reviewers: Luke Chen <showuon@gmail.com>, Christo Lolov <christololov@gmail.com>
2023-05-08 10:15:52 +08:00
Federico Valeri 33012b5ec3
KAFKA-14752: Kafka examples improvements - consumer changes (#13514)
KAFKA-14752: Kafka examples improvements - consumer changes

This is extracted from the original PR for better review.
https://github.com/apache/kafka/pull/13492

Signed-off-by: Federico Valeri <fedevaleri@gmail.com>

Reviewers: Christo Lolov <christololov@gmail.com>, Luke Chen <showuon@gmail.com>
2023-05-02 20:28:42 +08:00
Philip Nee 4527e54647
KAFKA-14753: Improve kafka producer example (#13354)
Reviewers: Guozhang Wang <wangguoz@gmail.com>
2023-03-07 16:25:49 -08:00
Philip Nee b19ae7857b
KAFKA-14752: Improving the existing consumer examples (#13353)
Reviewers: Guozhang Wang <wangguoz@gmail.com>
2023-03-07 16:24:38 -08:00
Philip Nee 6d64075230
KAFKA-14708: Use Java thread instead of kafka library for example purpose (#13238)
Remove "kafka.examples.Consumer" dependency on ShutdownableThread. "examples" module should be dependent only on public APIs but not to be dependent upon server common/internal components.

Reviewers: Luke Chen <showuon@gmail.com>
2023-02-16 11:28:32 +08:00
liuzhuang2017 109b74c590
MINOR: Update the README file in examples. (#12272)
Modify Intellij to IntelliJ IDEA, and mention KRaft in example docs.

Reviewers: Divij Vaidya <divijvaidya13@gmail.com>, Kvicii <kvicii.yu@gmail.com>, dengziming <dengziming1993@gmail.com>
2022-10-18 13:03:52 +08:00
jiameixie 8a83025109
KAFKA-9922: Update demo instructions in examples README (#8559)
Class kafka.examples.SimpleConsumerDemo was removed. But the java-simple-consumer-demo.sh was not removed and README was not updated.

This commit removes java-simple-consumer-demo.sh and updates the demo instructions in the examples README. 

Author: Jiamei Xie <jiamei.xie@arm.com>
Reviewers: Konstantine Karantasis <konstantine@confluent.io>
2020-04-29 19:31:26 -07:00
Lee Dongjin b2aec9496d
MINOR: Fix javadoc at org.apache.kafka.clients.producer.KafkaProducer.InterceptorCallback#onCompletion (#7337)
Reviewers: Guozhang Wang <wangguoz@gmail.com>
2020-02-20 10:56:11 -08:00
Boyang Chen 776565f7a8
MINOR: Improve EOS example exception handling (#8052)
The current EOS example mixes fatal and non-fatal error handling. This patch fixes this problem and simplifies the example.

Reviewers: Jason Gustafson <jason@confluent.io>
2020-02-20 09:59:09 -08:00
Boyang Chen 07db26c20f
KAFKA-9417: New Integration Test for KIP-447 (#8000)
This change mainly have 2 components:

1. extend the existing transactions_test.py to also try out new sendTxnOffsets(groupMetadata) API to make sure we are not introducing any regression or compatibility issue
  a. We shrink the time window to 10 seconds for the txn timeout scheduler on broker so that we could trigger expiration earlier than later

2. create a completely new system test class called group_mode_transactions_test which is more complicated than the existing system test, as we are taking rebalance into consideration and using multiple partitions instead of one. For further breakdown:
  a. The message count was done on partition level, instead of global as we need to visualize 
the per partition order throughout the test. For this sake, we extend ConsoleConsumer to print out the data partition as well to help message copier interpret the per partition data.
  b. The progress count includes the time for completing the pending txn offset expiration
  c. More visibility and feature improvements on TransactionMessageCopier to better work under either standalone or group mode.

Reviewers: Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
2020-02-12 12:34:12 -08:00
Boyang Chen f48946f572
HOTFIX: Fix spotsbug failure in Kafka examples (#8051)
Reviewers: Jason Gustafson <jason@confluent.io>
2020-02-06 10:58:05 -08:00
Boyang Chen 9d17bf98b6
KAFKA-9447: Add new customized EOS model example (#8031)
With the improvement of 447, we are now offering developers a better experience on writing their customized EOS apps with group subscription, instead of manual assignments. With the demo, user should be able to get started more quickly on writing their own EOS app, and understand the processing logic much better.

Reviewers: Guozhang Wang <wangguoz@gmail.com>
2020-02-05 16:51:07 -08:00
huxi 895c83f88d KAFKA-7412: clarify the doc for producer callback (#5798)
The metadata in the callback is not null with non-null exception.

Reviewers: Jun Rao <junrao@gmail.com>
2018-11-08 16:58:14 -08:00
Viktor Somogyi 8a78d76466 KAFKA-7140; Remove deprecated poll usages (#5319)
Reviewers: Matthias J. Sax <mjsax@apache.org>, Jason Gustafson <jason@confluent.io>
2018-08-10 22:51:17 -07:00
Ismael Juma cc4dce94af
KAFKA-2983: Remove Scala consumers and related code (#5230)
- Removed Scala consumers (`SimpleConsumer` and `ZooKeeperConsumerConnector`)
and their tests.
- Removed Scala request/response/message classes.
- Removed any mention of new consumer or new producer in the code
with the exception of MirrorMaker where the new.consumer option was
never deprecated so we have to keep it for now. The non-code
documentation has not been updated either, that will be done
separately.
- Removed a number of tools that only made sense in the context
of the Scala consumers (see upgrade notes).
- Updated some tools that worked with both Scala and Java consumers
so that they only support the latter (see upgrade notes).
- Removed `BaseConsumer` and related classes apart from `BaseRecord`
which is used in `MirrorMakerMessageHandler`. The latter is a pluggable
interface so effectively public API.
- Removed `ZkUtils` methods that were only used by the old consumers.
- Removed `ZkUtils.registerBroker` and `ZKCheckedEphemeral` since
the broker now uses the methods in `KafkaZkClient` and no-one else
should be using that method.
- Updated system tests so that they don't use the Scala consumers except
for multi-version tests.
- Updated LogDirFailureTest so that the consumer offsets topic would
continue to be available after all the failures. This was necessary for it
to work with the Java consumer.
- Some multi-version system tests had not been updated to include
recently released Kafka versions, fixed it.
- Updated findBugs and checkstyle configs not to refer to deleted
classes and packages.

Reviewers: Dong Lin <lindong28@gmail.com>, Manikumar Reddy <manikumar.reddy@gmail.com>
2018-06-19 07:32:54 -07:00
UVN 1667c16be1 MINOR: Read configuration fields from ProducerConfig in example (#4601)
Reading the configuration field names from ProducerConfig class and taking the key and value serializer names from class name directly instead of hardcoding.
2018-02-21 08:58:35 -08:00
Vahid Hashemian f85c18032b KAFKA-3264; Deprecate the old Scala consumer (KIP-109)
Author: Vahid Hashemian <vahidhashemian@us.ibm.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

This patch had conflicts when merged, resolved by
Committer: Ismael Juma <ismael@juma.me.uk>

Closes #2328 from vahidhashemian/KAFKA-3264
2017-06-02 12:27:47 +01:00
Matthias J. Sax d0e436c471 MINOR: improve license header check by providing head file instead of (prefix) header regex
Author: Matthias J. Sax <matthias@confluent.io>

Reviewers: Jason Gustafson <jason@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #2303 from mjsax/licenseHeader
2017-02-28 12:35:04 -08:00
Qian Zheng 39a1c42dfc MINOR: add a space to separate two words
I think we should add a space here, otherwise the two words will join together.
And replace the host string with a constant, otherwise when I need to modify the host, I need to modify several files.

Author: 郑谦00117553 <00117553@zte.intra>

Reviewers: Guozhang Wang <wangguoz@gmail.com>

Closes #2132 from ZhengQian1/trunk
2016-11-16 11:36:05 -08:00
Rajini Sivaram 9d71489ff0 KAFKA-3548: Use root locale for case transformation of constant strings
For enums and other constant strings, use locale independent case conversions to enable comparisons to work regardless of the default locale.

Author: Rajini Sivaram <rajinisivaram@googlemail.com>

Reviewers: Manikumar Reddy, Ismael Juma, Guozhang Wang, Gwen Shapira

Closes #1220 from rajinisivaram/KAFKA-3548
2016-04-20 18:54:30 -07:00
Ismael Juma e3ab96b2f0 MINOR: Example style improvements
These are minor, but no reason to make our example code look worse than it has to.

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Grant Henke

Closes #940 from ijuma/example-style-improvements
2016-02-22 11:40:33 -08:00
Grant Henke 64b746bd8b KAFKA-3020; Ensure CheckStyle runs on all Java code
- Adds CheckStyle to core and examples modules
- Fixes any existing CheckStyle issues

Author: Grant Henke <granthenke@gmail.com>

Reviewers: Ewen Cheslack-Postava <ewen@confluent.io>

Closes #703 from granthenke/checkstyle-core
2015-12-21 22:48:03 -08:00
Ashish Singh 5338f8432f KAFKA-2487: change kafka.examples.Consumer to use the new java consumer
Author: Ashish Singh <asingh@cloudera.com>

Reviewers: Guozhang Wang

Closes #297 from SinghAsDev/KAFKA-2487
2015-10-15 17:28:23 -07:00
Ismael Juma ed1a548c50 KAFKA-2140 Improve code readability; reviewed by Neha Narkhede 2015-04-26 08:40:58 -07:00
Ashish Singh 5408931a29 kafka-1982; change kafka.examples.Producer to use the new java producer; patched by Ashish Singh; reviewed by Gwen Shapira, Mayuresh Gharat and Jun Rao 2015-04-19 07:46:58 -07:00
Jay Kreps 1c6d5bbac6 KAFKA-1915: Add checkstyle for java code. 2015-02-03 09:16:55 -08:00
Geoffrey Anderson b77099626e kafka-1700; examples directory - README and shell scripts are out of date; patched by Geoffrey Anderson; reviewed by Jun Rao 2014-10-23 16:12:54 -07:00
Joe Stein a8297cc6ca KAFKA-1254 remove vestigial sbt patch by Joe Stein; reviewed by Jun Rao 2014-02-20 00:11:31 -05:00
Ailing Zhang e1f7bea157 kafka-1205; README in examples not update; patched by Ailing Zhang; reviewed by Jun Rao 2014-01-17 08:29:28 -08:00
Jun Rao c98bdd3e4f kafka-896; merge 0.8 (988d4d8e65) to trunk; patched by Jun Rao; reviewed by Jay Kreps 2013-07-08 15:42:24 -07:00
Swapnil Ghike 2d7403174f kafka-871; Rename ZkConfig properties; patched by Swapnil Ghike; reviewed by Jun Rao 2013-04-25 18:57:31 -07:00
Jun Rao 92f177b309 merge 0.8 to trunk and resolve conflicts 2013-01-25 22:03:39 -08:00
Joe Stein e6aa600813 KAFKA-139 cross-compile multiple Scala versions and upgrade to SBT 0.12.1 patch by Derek Chen-Becker reviewed by Joe Stein 2013-01-21 14:41:47 -05:00
Jun Rao 9249b76d1d merge from 0.8 and resolve conflicts 2013-01-11 18:25:56 -08:00
Jun Rao a40953196e Use uniform convention for naming properties keys; kafka-648; patched by Sriram Subramanian; reviewed by Jun Rao 2013-01-11 16:12:57 -08:00
Jay Kreps 32dae955d5 Merge branch '0.8' into trunk
Conflicts:
	core/src/main/scala/kafka/log/Log.scala
	core/src/test/scala/unit/kafka/admin/AdminTest.scala
	core/src/test/scala/unit/kafka/log/LogTest.scala
	core/src/test/scala/unit/kafka/server/LogOffsetTest.scala
2012-12-18 09:43:41 -08:00
Derek Chen-Becker 45cb03d456 Re-applied old patch from KAFKA-139
Had to make some additional changes based on further mainline work. Leaving
KafkaProject.scala in place as a reference for now.
2012-12-14 17:12:38 -07:00
Edward Jay Kreps 4be0b1be29 KAFKA-521 Refactor the log subsystem. Patch reviewed by Neha.
git-svn-id: https://svn.apache.org/repos/asf/kafka/trunk@1416253 13f79535-47bb-0310-9956-ffa450edef68
2012-12-02 20:50:01 +00:00
Neha Narkhede d7c71c0949 KAFKA-622 Create mbeans per client; patched by Swapnil; reviewed by Neha Narkhede
git-svn-id: https://svn.apache.org/repos/asf/kafka/branches/0.8@1415021 13f79535-47bb-0310-9956-ffa450edef68
2012-11-29 01:31:18 +00:00
Edward Jay Kreps 60d0587e8f KAFKA-545 Add some log performance tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1410088 13f79535-47bb-0310-9956-ffa450edef68
2012-11-15 22:54:45 +00:00
Edward Jay Kreps f4ccf21d5d KAFKA-544 Store the key given to the producer in the message. Expose this key in the consumer. Patch reviewed by Jun.
git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1410055 13f79535-47bb-0310-9956-ffa450edef68
2012-11-15 22:15:14 +00:00
Neha Narkhede 98f6407089 KAFKA-537 Expose clientId in ConsumerConfig and fix correlation id; patched by Yang Ye; reviewed by Neha Narkhede
git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1398893 13f79535-47bb-0310-9956-ffa450edef68
2012-10-16 17:30:46 +00:00
Jun Rao ee855fe1aa remove ZK dependency on producer; patched by Yang Ye; reviewed by Jun Rao; KAFKA-369
git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1372724 13f79535-47bb-0310-9956-ffa450edef68
2012-08-14 04:17:27 +00:00
Joe Stein 822963bb9d KAFKA-348 merge trunk to branch 1239902:1310937 patch by Joe Stein reviewed by Jun Rao
git-svn-id: https://svn.apache.org/repos/asf/incubator/kafka/branches/0.8@1344526 13f79535-47bb-0310-9956-ffa450edef68
2012-05-31 01:51:23 +00:00