func NewRabbitMQHATransport(configs []*TransportConfig) *RabbitMQTransport {
	return &RabbitMQTransport{
		ClosingChannel: make(chan bool),
		Configs:        configs,
		dialer:         amqpDialer,
		dialerConfig:   amqpDialerConfig,
	}
}
NewRabbitMQHATransport creates a RabbitMQTransport instance from a list of
TransportConfig objects in order to connect to a
High Availability RabbitMQ cluster
package rabbitmq
import (
	"errors"
	"fmt"
	"math/rand"
	"strconv"
	"time"
	"github.com/streadway/amqp"
	"github.com/upfluence/goutils/log"
)
type AMQPChannel interface {
	Consume(string, string, bool, bool, bool, bool, amqp.Table) (<-chan amqp.Delivery, error)
	ExchangeDeclare(string, string, bool, bool, bool, bool, amqp.Table) error
	NotifyClose(chan *amqp.Error) chan *amqp.Error
	Publish(string, string, bool, bool, amqp.Publishing) error
	Qos(int, int, bool) error
	QueueBind(string, string, string, bool, amqp.Table) error
	QueueDeclare(string, bool, bool, bool, bool, amqp.Table) (amqp.Queue, error)
}
type AMQPConnection interface {
	Channel() (AMQPChannel, error)
	Close() error
}
type Connection struct {
	*amqp.Connection
}
func (c *Connection) Channel() (AMQPChannel, error) {
	return c.Connection.Channel()
}
func (c *Connection) Close() error {
	return c.Connection.Close()
}
type RabbitMQTransport struct {
	Connection     AMQPConnection
	Channel        AMQPChannel
	ClosingChannel chan bool
	Configs        []*TransportConfig
	dialer         func(string) (AMQPConnection, error)
	dialerConfig   func(string, amqp.Config) (AMQPConnection, error)
}
func NewRabbitMQTransport(uri string) (*RabbitMQTransport, error) {
	config, err := NewTransportConfig(uri)
	if err != nil {
		return nil, fmt.Errorf("Received invalid URI: %s", err)
	}
	return NewRabbitMQHATransport([]*TransportConfig{config}), nil
}
func amqpDialer(url string) (AMQPConnection, error) {
	var conn = &Connection{}
	var err error
	conn.Connection, err = amqp.Dial(url)
	return conn, err
}
func amqpDialerConfig(url string, config amqp.Config) (AMQPConnection, error) {
	var conn = &Connection{}
	var err error
	conn.Connection, err = amqp.DialConfig(url, config)
	return conn, err
}