You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "zaracoder-stack (via GitHub)" <gi...@apache.org> on 2025/12/07 14:37:22 UTC
[PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
zaracoder-stack opened a new pull request, #21100:
URL: https://github.com/apache/kafka/pull/21100
## Motivation
This pull request addresses a common pain point for new users learning how to develop applications with Kafka clients: testing without relying on a full Kafka cluster.
The existing examples primarily focus on runtime operation. These new examples show the proper use of the built-in `MockProducer` and `MockConsumer` classes for writing fast, reliable, and decoupled unit tests.
## Changes
Adds a new directory for testing examples: `examples/src/main/java/kafka/examples/testing/`
1. **`MockProducerExample.java`**: Demonstrates basic usage, topic routing, metadata checks, and error simulation.
2. **`MockConsumerExample.java`**: Demonstrates basic usage, message processing, offset management (seek/commit), and partition rebalancing.
3. **`README.md`**: Provides instructions on how to compile and run the new examples using Gradle, along with guidance on when to use mocks versus real brokers.
## Notes
The example files follow the style of existing examples in the `examples` module and include the Apache License header.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21100:
URL: https://github.com/apache/kafka/pull/21100#issuecomment-4704785601
This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.
<p>
If you are having difficulty finding a reviewer, please reach out on the
[mailing list](https://kafka.apache.org/contact).
<p>
If this PR is no longer valid or desired, please feel free to close it. If no activity
occurs in the next 30 days, it will be automatically closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21100:
URL: https://github.com/apache/kafka/pull/21100#issuecomment-4726002912
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the `triage` label
should be removed to prevent this automation from happening again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
Posted by "ghost (via GitHub)" <gi...@apache.org>.
ghost closed pull request #21100: MINOR: Add MockProducer and MockConsumer testing examples
URL: https://github.com/apache/kafka/pull/21100
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21100:
URL: https://github.com/apache/kafka/pull/21100#issuecomment-3652749359
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the `triage` label
should be removed to prevent this automation from happening again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21100:
URL: https://github.com/apache/kafka/pull/21100#issuecomment-4062176453
This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.
<p>
If you are having difficulty finding a reviewer, please reach out on the
[mailing list](https://kafka.apache.org/contact).
<p>
If this PR is no longer valid or desired, please feel free to close it. If no activity
occurs in the next 30 days, it will be automatically closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Add MockProducer and MockConsumer testing examples [kafka]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21100:
URL: https://github.com/apache/kafka/pull/21100#issuecomment-4072156651
A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the `triage` label
should be removed to prevent this automation from happening again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org