You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: connection.go
    path of file: ./repos/eagle/pkg/queue/rabbitmq
    
    the code of the file until where you have to start completion: package rabbitmq

import (
	"fmt"
	"sync"
	"sync/atomic"

	"github.com/go-eagle/eagle/pkg/queue/rabbitmq/options"

	"github.com/cenkalti/backoff/v4"
	"github.com/rabbitmq/amqp091-go"

	"github.com/go-eagle/eagle/pkg/log"
)

type Connection struct {
	options   *options.ConnectionOptions
	conn      *amqp091.Connection
	connected chan struct{}
	closing   chan struct{}
	closed    int32

	logger  log.Logger
	mu      sync.RWMutex
	backoff backoff.BackOff
}

func NewConnection(opts *options.ConnectionOptions, logger log.Logger) (*Connection, error) {
	conn := &Connec
    
func (c *Connection) reconnect() {
	reconnect := func() error {
		c.logger.Info("rabbitmq: reconnecting connection")
		// if RabbitMQ server is shutdown, return err: Exception (501) Reason: "EOF"
		// or err: dial tcp [::1]:5672: connect: connection refused
		err := c.connect()
		if err == nil {
			c.logger.Info("rabbitmq: reconnected connection successfully")
			return nil
		}
		c.logger.Errorf("rabbitmq: reconnect failed, retrying, err: %v", err)
		if c.IsClosed() {
			return backoff.Permanent(fmt.Errorf("rabbitmq: connection is closed, err: %v", err))
		}

		return err
	}

	err := backoff.Retry(reconnect, c.backoff)
	if err != nil {
		c.logger.Errorf("rabbitmq: reconnect failed: %v", err)
	}
}