https://github.com/epomatti/go-kafka
Minimalist Kafka go client demo running on docker scratch
https://github.com/epomatti/go-kafka
alpine c cpp docker go kafka musl scratch
Last synced: 3 months ago
JSON representation
Minimalist Kafka go client demo running on docker scratch
- Host: GitHub
- URL: https://github.com/epomatti/go-kafka
- Owner: epomatti
- License: mit
- Created: 2023-05-05T20:58:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-05T23:44:23.000Z (about 3 years ago)
- Last Synced: 2025-03-11T02:51:15.283Z (over 1 year ago)
- Topics: alpine, c, cpp, docker, go, kafka, musl, scratch
- Language: Go
- Homepage:
- Size: 94.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Kafka - Demo
This demo runs with a statically compiled Go application using the Kafka SDK.
## Running locally
Use this segment to run your Go code locally with a sidecar docker Kafka.
Start Kafka:
```
docker-compose -f docker-compose-kafkaonly.yaml up -d
```
Create the `demo` topic:
```
docker exec broker kafka-topics --bootstrap-server broker:9092 --create --topic demo
```
Start the Go consumer:
```
go mod tidy
go run .
```
Use the CLI producer to send inline events to Kafka:
```
docker exec --interactive --tty broker kafka-console-producer --bootstrap-server broker:9092 --topic demo
```
## Running on Docker
Start up the complete environment:
```
docker-compose -f docker-compose-full.yaml build
docker-compose -f docker-compose-full.yaml up
```
Create the Kafka topic:
```
docker-compose -f docker-compose-full.yaml exec broker kafka-topics --bootstrap-server broker:9092 --create --topic demo
```
Connect to the broker and send messages for consumption:
```
docker-compose -f docker-compose-full.yaml exec --interactive --tty broker kafka-console-producer --bootstrap-server broker:9092 --topic demo
```