This is about how to fill the configuration file for the service
The configuration file needed by the application need to be in yaml
format.
The configuration file could be named as you want
, by default if you don't specified the parameter --configFile
is config.yaml
This could be located in any place, but by default when service start this find the configuration file in the following location:
./config.yaml
Next to the service binarymq-to-db
/etc/mq-to-db/config.yaml
Into the standardLinux
configuration File System$HOME/config.yaml
Into theuser home
which is executing the service binarymq-to-db
NOTE: Remember that thanks to the parameter --configFile
you can tell to the service which configuration file you want to use, for example:
mq-to-db --configFile '/tmp/myconfig.yaml'
mq-to-db --configFile './mq-to-db.yaml'
To read the config file we are using the golang
package viper and pflag
The config file config-sample.yaml could be used as template
---
dispatcher:
consumerConcurrency: 4 # Number of go routines consuming messages from Queue
storageWorkers: 40 # Number of go routines processing the messages received from consumers and sending messages to storage
consumer:
kind: rabbitmq
address: 127.0.0.1
port: 5672
requestedHeartbeat: 25s
username: guest
password: guest
virtualHost: my.virtualhost # Optional
queue:
name: my.queue
routingKey: my.routeKey
durable: true
autoDelete: false
exclusive: false
autoACK: false
PrefetchCount: 1500
PrefetchSize: 0
args: # Optional
x-message-ttl: 180000
x-dead-letter-exchange: retry.exchange
exchange:
name: my.exchange
type: topic
durable: true
autoDelete: false
args: # Optional
alternate-exchange: my.ae
database:
kind: postgresql
address: 127.0.0.1
port: 5432
username: postgres
password: mysecretpassword
database: postgres
sslMode: disable
maxPingTimeOut: 1s
maxQueryTimeOut: 10s
connMaxLifetime: 0
maxIdleConns: 5
maxOpenConns: 100