MailerServer/modules/rabbitmq/rabbitmq.go

35 lines
692 B
Go

package rabbitmq
import (
"time"
"clickandjoin.app/emailserver/modules/config"
gocnjhelper "git.ex.umbach.dev/ClickandJoin/go-cnj-helper"
)
const queueMails = "kk.mails"
var MailsClient *gocnjhelper.Client
func Init() {
cfg := config.Cfg
MailsClient = 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)
MailMessagesHandling()
}