package rabbitmq import ( "time" "clickandjoin.app/serversenteventsserver/modules/config" gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper" ) const exchangeBroadcastMessages = "cnj.api.broadcast.messages" var ApiBroadcastClient *gocnjhelper.Client func Init() { cfg := config.Cfg /* * api broadcast messages */ ApiBroadcastClient = gocnjhelper.NewClient( gocnjhelper.ExchangeSettings{}, gocnjhelper.QueueSettings{ Enabled: true, Name: "", Durable: false, DeleteWhenUnused: false, Exclusive: true, NoWait: false, Arguments: nil, QueueBindSettings: gocnjhelper.QueueBindSettings{ Enabled: true, QueueName: gocnjhelper.SetQueueNameToAutomaticallyAssignedQueueName, RoutingKey: "", Exchange: exchangeBroadcastMessages, NoWait: false, Arguments: nil, }, }, 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)) // give the connection sometime to setup <-time.After(time.Second) go ApiBroadcastMessagesHandling() }