Golang - Kafka segmentio
- Download dependencies
$ go mod download
- Vendor local
$ go mod vendor
- Rename file
.envsample
to.env
$ cp .envsample .env
Name | Required | Description |
---|---|---|
KAFKA_URL | TRUE | Kafka URL |
-
Running
docker-compose up -d
-
Producer
$ go run producer/main.go --topic ecommerce --message info
- Consumer
group[order]
$ go run consumer/main.go --topic ecommerce --group order
$ message at topic:ecommerce partition:0 offset:2 = info
- Consumer
group[payment]
$ go run consumer/main.go --topic ecommerce --group payment
$ message at topic:ecommerce partition:0 offset:2 = info
- Consumer
group[notify]
$ go run consumer/main.go --topic ecommerce --group notify
$ message at topic:ecommerce partition:0 offset:2 = info