func (m *ConnectionManager) Connect(connectionURL string) (<-chan *amqp.Error, error) {
	for attempt := 0; attempt < 3; attempt++ {
		con, err := m.dial(connectionURL)
		if err == nil {
			log.Println("Successfully established connection to Rabbit MQ Cluster")
			m.lock.Lock()
			m.con = con
			m.lock.Unlock()
			closeChannel := make(chan *amqp.Error)
			con.NotifyClose(closeChannel)
			return closeChannel, nil
		}
		log.Printf("Failed to establish connection due to %s. Attempt: %d/3", err, attempt)
		time.Sleep(time.Duration(2*attempt+1) * time.Second)
	}
	return nil, errors.New("could not establish connection to Rabbit MQ Cluster")
}
Connect uses the provided connection urls and tries up to 3 times to establish a connection.
The retries are performed exponentially starting with 2s. It also creates a listener for close notifications.
package rabbitmq
import (
	"crypto/tls"
	"log"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/streadway/amqp"
)
type Connector interface {
	Connect(connectionURL string) (<-chan *amqp.Error, error)
	Disconnect()
}
type Manager interface {
	Connector
	ChannelCreator
}
type ConnectionManager struct {
	con     RBConnection
	lock    sync.RWMutex
	dialer  RBDialer
	tlsConf *tls.Config
}
func NewConnectionManager(dialer RBDialer, conf *tls.Config) Manager {
	return &ConnectionManager{
		lock:    sync.RWMutex{},
		con:     nil,
		dialer:  dialer,
		tlsConf: conf,
	}
}