"# Kafka-MultiThread-Java-Example"

1. Import source code into Eclipse

Menu File –> Import –> Maven –> Existing Maven Projects

Browse to your source code location

Click Finish button to finish the importing

2. Create the Kafka Topic

Using commands in create-topics.sh (Linux) and create-topics.bat(Windows)

3. Run the example

Model #1. Multiple consumers with their own threads

Open the MultipleConsumersMain.java

Right click -> Run As -> Java Application or use the shortcut: Alt+Shift+x, j to start the main method

Model #2. Single consumer, multiple worker processing threads

Open the SingleConsumerMain.java

Right click -> Run As -> Java Application or use the shortcut: Alt+Shift+x, j to start the main method

All the source code are described in: Create Multi-threaded Apache Kafka Consumer

4. Related Posts