From efb534099c3eddada21ea2f1f3b68355572a4452 Mon Sep 17 00:00:00 2001 From: KirylJazzSax <42591857+KirylJazzSax@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:40:58 +0200 Subject: [PATCH] replace kafka-console-consumer with mill util (#478) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kiryl Matsenka Co-authored-by: Miłosz Smółka --- _examples/basic/1-your-first-app/README.md | 4 ++-- _examples/basic/1-your-first-app/docker-compose.yml | 4 +++- _examples/basic/2-realtime-feed/README.md | 2 +- _examples/basic/2-realtime-feed/docker-compose.yml | 4 +++- _examples/real-world-examples/transactional-events/README.md | 2 +- .../transactional-events/docker-compose.yml | 4 +++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/_examples/basic/1-your-first-app/README.md b/_examples/basic/1-your-first-app/README.md index 44249a061..ca8d8856f 100644 --- a/_examples/basic/1-your-first-app/README.md +++ b/_examples/basic/1-your-first-app/README.md @@ -38,7 +38,7 @@ server_1 | 2019/08/29 19:41:29 received event {ID:9} Open another terminal and take a look at Kafka topics to see that all messages are there. The initial events should be present on the `events` topic: ```bash -> docker-compose exec kafka kafka-console-consumer --bootstrap-server localhost:9092 --topic events +> docker-compose exec server mill kafka consume -b kafka:9092 --topic events {"id":12} {"id":13} @@ -51,7 +51,7 @@ Open another terminal and take a look at Kafka topics to see that all messages a And the processed messages will be stored in the `events-processed` topic: ```bash -> docker-compose exec kafka kafka-console-consumer --bootstrap-server localhost:9092 --topic events-processed +> docker-compose exec server mill kafka consume -b kafka:9092 -t events-processed {"processed_id":21,"time":"2019-08-29T19:42:31.4464598Z"} {"processed_id":22,"time":"2019-08-29T19:42:32.4501767Z"} diff --git a/_examples/basic/1-your-first-app/docker-compose.yml b/_examples/basic/1-your-first-app/docker-compose.yml index 5366dcf17..5841b5022 100644 --- a/_examples/basic/1-your-first-app/docker-compose.yml +++ b/_examples/basic/1-your-first-app/docker-compose.yml @@ -6,7 +6,9 @@ services: - .:/app - $GOPATH/pkg/mod:/go/pkg/mod working_dir: /app - command: go run main.go + command: > + /bin/sh -c "go install github.com/ThreeDotsLabs/watermill/tools/mill@latest && + go run main.go" kafka: image: bitnami/kafka:3.5.0 diff --git a/_examples/basic/2-realtime-feed/README.md b/_examples/basic/2-realtime-feed/README.md index 68db9b0d3..fbd0ee1ea 100644 --- a/_examples/basic/2-realtime-feed/README.md +++ b/_examples/basic/2-realtime-feed/README.md @@ -27,7 +27,7 @@ You should see the live feed of posts on the standard output. 1. Peek into the posts counter published on `posts_count` topic. ``` -docker-compose exec kafka kafka-console-consumer --bootstrap-server localhost:9092 --topic posts_count +docker-compose exec consumer mill kafka consume -b kafka:9092 -t posts_count ``` 2. Add a persistent storage for incoming posts in the consumer service, instead of displaying them. diff --git a/_examples/basic/2-realtime-feed/docker-compose.yml b/_examples/basic/2-realtime-feed/docker-compose.yml index 6c7ac2dc5..af0147882 100644 --- a/_examples/basic/2-realtime-feed/docker-compose.yml +++ b/_examples/basic/2-realtime-feed/docker-compose.yml @@ -19,7 +19,9 @@ services: - .:/app - $GOPATH/pkg/mod:/go/pkg/mod working_dir: /app/consumer/ - command: go run main.go + command: > + /bin/sh -c "go install github.com/ThreeDotsLabs/watermill/tools/mill@latest && + go run main.go" zookeeper: image: confluentinc/cp-zookeeper:7.3.1 diff --git a/_examples/real-world-examples/transactional-events/README.md b/_examples/real-world-examples/transactional-events/README.md index 7305ee9ce..82626184c 100644 --- a/_examples/real-world-examples/transactional-events/README.md +++ b/_examples/real-world-examples/transactional-events/README.md @@ -36,5 +36,5 @@ Observe the log output. You will notice new events, generated by the example. In another terminal, run the following command to consume events produced on the Kafka topic. ```bash -docker-compose exec kafka kafka-console-consumer --bootstrap-server kafka:9092 --topic events +docker-compose exec server mill kafka consume -b kafka:9092 -t events ``` diff --git a/_examples/real-world-examples/transactional-events/docker-compose.yml b/_examples/real-world-examples/transactional-events/docker-compose.yml index 27de13c68..3b3b705b4 100644 --- a/_examples/real-world-examples/transactional-events/docker-compose.yml +++ b/_examples/real-world-examples/transactional-events/docker-compose.yml @@ -8,7 +8,9 @@ services: - .:/app - $GOPATH/pkg/mod:/go/pkg/mod working_dir: /app - command: go run main.go + command: > + /bin/sh -c "go install github.com/ThreeDotsLabs/watermill/tools/mill@latest && + go run main.go" mysql: image: mysql:8.0