apache /kafka

Apache Kafka - A distributed event streaming platform

★ 34,207⑂ 15,681👁 1,045⑃ 24,178● 0▤ 0◈ 0
JavaApache-2.0Created 2011-08-15kafka.apache.org/
34,207
stars
15,681
forks
1,045
watchers
24,178
prs
0
issues
0
releases
0
discussions

README

Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.

You need to have Java installed.

We build and test Apache Kafka with Java versions 17 and 25. The release parameter in javac is set to 11 for the clients 
and streams modules, and 17 for the rest, ensuring compatibility with their respective
minimum Java versions. Similarly, the release parameter in scalac is set to 11 for the streams modules and 17
for the rest.

Scala 2.13 is the only supported version in Apache Kafka.

 Build a JAR and run it
bash
./gradlew jar


Follow instructions in https://kafka.apache.org/quickstart

 Build source JAR
bash
./gradlew srcJar


 Build aggregated javadoc
bash
./gradlew aggregatedJavadoc --no-parallel


 Build javadoc and scaladoc
bash
./gradlew javadoc
./gradlew javadocJar  builds a javadoc jar for each module
./gradlew scaladoc
./gradlew scaladocJar  builds a scaladoc jar for each module
./gradlew docsJar  builds both (if applicable) javadoc and scaladoc jars for each module


 Run unit/integration tests
bash
./gradlew test   runs both unit and integration tests
./gradlew unitTest
./gradlew integrationTest
./gradlew test -Pkafka.test.run.flaky=true   runs tests that are marked as flaky


 Force re-running tests without code change
bash
./gradlew test --rerun-tasks
./gradlew unitTest --rerun-tasks
./gradlew integrationTest --rerun-tasks


 Running a particular unit/integration test
bash
./gradlew clients:test --tests RequestResponseTest
./gradlew streams:integration-tests:test --tests RestoreIntegrationTest


 Running a particular unit/integration test N times
bash
N=500; I=0; while [ $I -lt $N ] && ./gradlew clients:test --tests RequestResponseTest --rerun --fail-fast; do (( I=$I+1 )); echo "Completed run: $I"; sleep 1; done


 Running a particular test method within a unit/integration test
bash
./gradlew clients:test --tests org.apache.kafka.clients.MetadataTest.testTimeToNextUpdate
./gradlew clients:clients-integration-tests:test --tests org.apache.kafka.clients.producer.ProducerFailureHandlingTest.testCannotSendToInternalTopic
./gradlew streams:integration-tests:test --tests org.apache.kafka.streams.integration.RestoreIntegrationTest.shouldRestoreNullRecord


 Running a particular unit/integration test with log4j output
By default, there will be only a small number of logs output while testing. You can adjust it by changing the log4j2.yaml file in the module's src/test/resources directory.

For example, if you want to see more logs for clients project tests, you can modify the line in clients/src/test/resources/log4j2.yaml 
to level: INFO and then run:

bash
./gradlew cleanTest clients:test --tests NetworkClientTest


And you should see INFO level logs in the file under the clients/build/test-results/test directory.

 Specifying test retries
Retries are disabled by default, but you can set maxTest

Snapshot: 2026-11-11T15:31:17Z · Data license Apache-2.0 · JSON