Simple command line application to read/write message to kafka topic using protobuf
MIT License
This is an application which
metrics
metrics
defaultdb.metrics
on remote serverSimply to make myself aware of the followings in rust-ecosystem:
The application is divided into two sub-parts: metrics-publisher
and metrics-subscriber
. Each of these two subparts is exposed as a command line entry point.
metrics-publisher
:
metrics
data/message.proto
data/message.proto
file and re-generate the definitions using:make generate-proto
metrics-subscriber
:
metrics
.cargo install sqlx-cli
make migrations
There are two methods for the execution - dockerized and local installation. You need to follow until step 5 for both the methods.
The default configuration is in config/env.dev
.
For local development please run docker-compose up -d
This will launch a bunch of docker containers locally, check it by running docker ps
$ docker ps
docker ps
CONTAINER ID IMAGE COMMAND PORTS NAMES
00886360bf34 timescale/timescaledb:latest-pg11 "docker-entrypoint.s…" 0.0.0.0:5432->5432/tcp timescale-db
0c78b8ad9c6c postgres:11-alpine "docker-entrypoint.s…" 0.0.0.0:54321->5432/tcp pg-docker
6022042c83fe confluentinc/cp-kafka:5.3.1 "/etc/confluent/dock…" 0.0.0.0:9092->9092/tcp kafka
Run the migration using ( ensure you have cargo install sqlx-cli
)
make migrations
After building the project (cargo build
), you will find a binary inside target/debug/kafka-rust-example
Run the publisher as:
RUST_LOG=info APPLICATION_CONFIG_PATH=./config/env.dev ./target/debug/kafka-rust-example metrics-publisher
Run the subscriber as:
RUST_LOG=debug APPLICATION_CONFIG_PATH=./config/env.dev ./target/debug/kafka-rust-example metrics-subscriber
Check rows in DB:
RUST_LOG=info APPLICATION_CONFIG_PATH=./config/env.dev ./target/debug/kafka-rust-example check-db-data
MIT