https://github.com/ejunjsh/java-code
all kinds of java code in different topics or fields
https://github.com/ejunjsh/java-code
Last synced: 3 months ago
JSON representation
all kinds of java code in different topics or fields
- Host: GitHub
- URL: https://github.com/ejunjsh/java-code
- Owner: ejunjsh
- Created: 2017-01-25T07:18:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-11T13:39:22.000Z (over 6 years ago)
- Last Synced: 2024-12-29T08:41:59.576Z (4 months ago)
- Language: Java
- Size: 70.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# java-code
all kinds of java code in different topics or fields# kafka
## run and test a kafka cluster
run a kafka code, please install `docker` and `docker-compose`````
sudo docker-compose run target
````then, the docker will give a bash back.run below command to start a producer
````
mvn install
mvn exec:java -Dexec.mainClass="com.sky.code.kafka.CustomPartitionProducer"
````open another terminal,and run
````
sudo docker-compose run target
````in the returned bash, run below command to start a consumer.
````
mvn exec:java -Dexec.mainClass="com.sky.code.kafka.CustomPartitionConsumer"
````you will see the both processes, one produce a message then another will consume it.
## destroy a cluster
````
sudo docker-compose down
````