Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomwright/sarama-example
https://github.com/tomwright/sarama-example
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tomwright/sarama-example
- Owner: TomWright
- Created: 2021-03-18T17:51:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-03-18T17:55:53.000Z (over 3 years ago)
- Last Synced: 2024-10-05T02:41:46.778Z (about 1 month ago)
- Language: Go
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sarama-example
Start kafka with:
```bash
docker-compose --project-name=sarama-example up
```Open 3 new terminal windows and run the following in each:
```
KAFKA_CONSUMER_ADDRESS=localhost:9092 KAFKA_PRODUCER_ADDRESS=localhost:9092 go run main.go
```Every 20 seconds, each instance of the app will publish 5 messages.
You should see that only 1 of the apps will be receiving any messages.
Even stopping the runner that is receiving the messages to cause a rebalance just pushes all messages to one of the other consumers.
Run the following to clean up kafka
```
docker-compose --project-name=sarama-example downdocker-compose --project-name=sarama-example rm
```