Java Kafka programming
A Kafka Java tutorial to get started — project setup, the kafka-clients dependency, and your first working Java producer and consumer step by step.
Build Kafka producers and consumers with Java
Java is the official language for Kafka development, providing the most complete and up-to-date client library. This section walks through creating a project and building your first producer and consumer.
What you'll learn:
- How to set up a Java project with Kafka dependencies
- How to create producers with callbacks and keys
- How to create consumers with consumer groups
- How to handle graceful shutdown
Learning path
| Step | Tutorial | Description |
|---|---|---|
| 1 | Project setup | Choose Maven or Gradle |
| 2 | Producer | Create producers with callbacks, keys, and batching |
| 3 | Consumer | Create consumers with groups and graceful shutdown |
| 4 | Advanced | Rebalance listeners, seek/assign, threading |
See it in practice with Conduktor
Conduktor Console helps you develop and debug Java applications by providing visual access to topics, consumer groups, and messages. Test your producer output and monitor consumer progress in real-time.
Next steps
- Set up your project with Maven to add the Kafka client dependencies
- Set up with Gradle if you prefer that build tool
- Build your first producer with callbacks and keys