Skip to content

Read a specific payload message from a Message Queue System and store it into the database system

License

Notifications You must be signed in to change notification settings

christiangda/mq-to-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mq-to-db

Read from Message Queue System and Store into Database

How to execute

source code

git clone https://github.com/christiangda/mq-to-db.git
cd mq-to-db/
go run -race  ./cmd/mq-to-db/main.go --help

# and then
go run -race  ./cmd/mq-to-db/main.go --configFile config-sample.yaml

NOTE: the parameter -raceis to check race conditions because we are using Go Concurrency

binary

./mq-to-db --help

RabbitMQ

docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management

NOTE:

PostgreSQL

docker run --rm  --name postgresql -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres

# logs
docker logs postgresql -f

# remember to  stop and remove (--rm in docker run do it for you)
docker stop postgresql

mq-to-db

go run -race  ./cmd/mq-to-db/main.go --configFile config-sample.yaml

o

make
./mq-to-db --configFile config-sample.yaml

How to build

go build \
    -o mq-to-db \
    -ldflags "-X github.com/christiangda/mq-to-db/internal/version.Version=$(git rev-parse --abbrev-ref HEAD) -X github.com/christiangda/mq-to-db/internal/version.Revision=$(git rev-parse HEAD) -X github.com/christiangda/mq-to-db/internal/version.Branch=$(git rev-parse --abbrev-ref HEAD) -X github.com/christiangda/mq-to-db/internal/version.BuildUser=\"$(git config --get user.name | tr -d '\040\011\012\015\n')\" -X github.com/christiangda/mq-to-db/internal/version.BuildDate=$(date +'%Y-%m-%dT%H:%M:%S')" \
    ./cmd/mq-to-db/main.go

Internal References

External References

Free books

Databases

Project Layout

Interfaces

Context

YAML|JSON to Struct

Config Files, Flags, Env Vars

RabbitMQ

Logs

### Metrics

### Test

Variable Injection

Iterators