03-batch-consumer-service

command
v0.0.0-...-e665a74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 10 Imported by: 0

README

Batch Consumer

  1. Slide Batch Consumer Service

  2. Open directory

cd /root/automation-technology/chapter02-microservices/2.2-microservices-types/03-batch-consumer-service
  1. Start kafka and zookeeper
docker compose up -d
  1. Wait until container is ready
docker ps
docker ps --format '{{.Image}}\t{{.Status}}\t{{.Ports}}'
CONTAINER ID   IMAGE                             COMMAND                  CREATED          STATUS         PORTS                                                           NAMES
11fd6a7ff959   3dsinteractive/kafka:2.0-custom   "/app-entrypoint.sh …"   9 seconds ago    Up 8 seconds   9092/tcp, 0.0.0.0:9094->9094/tcp, :::9094->9094/tcp             02-consumer-service-kafka-1
09f00c0618e8   3dsinteractive/zookeeper:3.0      "/app-entrypoint.sh …"   10 seconds ago   Up 9 seconds   2888/tcp, 0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 3888/tcp   02-consumer-service-zookeeper-1
  1. Run command to init project
go mod init automationworkshop/main
go mod tidy
  1. Run command to build project
go build .
  1. Run program
./main
Batch Consumer:  Begin Batch
Batch Consumer:  {"message_id":0}
Batch Consumer:  {"message_id":1}
Batch Consumer:  {"message_id":2}
Batch Consumer:  End Batch
Batch Consumer:  Begin Batch
Batch Consumer:  {"message_id":3}
Batch Consumer:  End Batch
Batch Consumer:  Begin Batch
Batch Consumer:  {"message_id":4}
Batch Consumer:  {"message_id":5}
Batch Consumer:  {"message_id":6}
Batch Consumer:  End Batch
Batch Consumer:  Begin Batch
Batch Consumer:  {"message_id":7}
Batch Consumer:  {"message_id":8}
Batch Consumer:  End Batch
Batch Consumer:  Begin Batch
Batch Consumer:  {"message_id":9}
Batch Consumer:  End Batch
  1. Run command to cleanup
docker compose down

Documentation

Overview

Create and maintain by Chaiyapong Lapliengtrakul (chaiyapong@3dsinteractive.com), All right reserved (2021 - Present)

Create and maintain by Chaiyapong Lapliengtrakul (chaiyapong@3dsinteractive.com), All right reserved (2021 - Present)

Create and maintain by Chaiyapong Lapliengtrakul (chaiyapong@3dsinteractive.com), All right reserved (2021 - Present)

Create and maintain by Chaiyapong Lapliengtrakul (chaiyapong@3dsinteractive.com), All right reserved (2021 - Present)

Create and maintain by Chaiyapong Lapliengtrakul (chaiyapong@3dsinteractive.com), All right reserved (2021 - Present)

Create and maintain by Chaiyapong Lapliengtrakul (chaiyapong@3dsinteractive.com), All right reserved (2021 - Present)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL