kafka-test

module
v0.0.0-...-9381e57 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT

README

kafka-test

Sorry for codestyle...

Running Kafka in Cluster Mode

Run with docker compose:

CUR_IP=$(nmcli device show | grep IP4.ADDRESS | head -1 | awk '{print $2}' | rev | cut -c 4- | rev)
MY_IP=$CUR_IP docker-compose -f docker-compose-kafka.yml up -d
MY_IP=$CUR_IP docker-compose up -d

It will build and run the API and 2 Worker inside the docker.

Test:

curl "localhost:9091/api/v1/data" --include --request POST

HTTP answer:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Sat, 25 Mar 2023 08:23:08 GMT
Content-Length: 94

{"data":{"text":"Hello, here we go!"},"message":"success push data into kafka","success":true}

Worker2 log:

message at topic/partition/offset foo/0/0: {"text":"Hello, here we go!"}

Directories

Path Synopsis
cmd
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳