39 lines
728 B
Go
39 lines
728 B
Go
package rabbitmq
|
|
|
|
import (
|
|
"jannex/log-manager/modules/config"
|
|
"time"
|
|
|
|
gocnjhelper "git.ex.umbach.dev/ClickandJoin/go-cnj-helper"
|
|
)
|
|
|
|
const queueLogs = "cnj.logs"
|
|
|
|
var LogsClient *gocnjhelper.Client
|
|
|
|
func Init() {
|
|
cfg := config.Cfg
|
|
|
|
if !cfg.RabbitMq.RabbitMQEnabled {
|
|
return
|
|
}
|
|
|
|
LogsClient = gocnjhelper.NewClient(
|
|
gocnjhelper.ExchangeSettings{},
|
|
gocnjhelper.QueueSettings{},
|
|
gocnjhelper.ChannelQosSettingsDefault,
|
|
gocnjhelper.Config{
|
|
ReconnectDelay: 1 * time.Second,
|
|
ReInitDelay: 1 * time.Second,
|
|
ResendDelay: 5 * time.Second,
|
|
},
|
|
gocnjhelper.GetConnectionString(
|
|
cfg.RabbitMq.Username,
|
|
cfg.RabbitMq.Password,
|
|
cfg.RabbitMq.Host))
|
|
|
|
<-time.After(time.Second)
|
|
|
|
LogsMessagesHandling()
|
|
}
|