donkeyForward / Kafka-MultiThread-Java-Example

Create Multi-threaded Apache Kafka Consumer

Home Page:http://howtoprogram.xyz/2016/05/29/create-multi-threaded-apache-kafka-consumer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"# 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

About

Create Multi-threaded Apache Kafka Consumer

http://howtoprogram.xyz/2016/05/29/create-multi-threaded-apache-kafka-consumer/


Languages

Language:Java 97.5%Language:Batchfile 1.3%Language:Shell 1.2%