36 lines
761 B
Go
36 lines
761 B
Go
package rabbitmq
|
|
|
|
import (
|
|
"time"
|
|
|
|
"clickandjoin.app/emailserver/modules/config"
|
|
gorabbitmqclient "git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client"
|
|
)
|
|
|
|
const queueMails = "cnj.mails"
|
|
|
|
var MailsClient *gorabbitmqclient.Client
|
|
|
|
func Init() {
|
|
cfg := config.Cfg
|
|
|
|
MailsClient = gorabbitmqclient.NewClient(
|
|
cfg.Debug,
|
|
gorabbitmqclient.ExchangeSettings{},
|
|
gorabbitmqclient.QueueSettings{},
|
|
gorabbitmqclient.ChannelQosSettingsDefault,
|
|
gorabbitmqclient.Config{
|
|
ReconnectDelay: 1 * time.Second,
|
|
ReInitDelay: 1 * time.Second,
|
|
ResendDelay: 5 * time.Second,
|
|
},
|
|
gorabbitmqclient.GetConnectionString(
|
|
cfg.RabbitMq.Username,
|
|
cfg.RabbitMq.Password,
|
|
cfg.RabbitMq.Host))
|
|
|
|
<-time.After(time.Second)
|
|
|
|
MailMessagesHandling()
|
|
}
|