func (p *Pool) ChannelWithConfirm(ctx context.Context) (ChannelKeeper, error) {
	var (
		k   ChannelKeeper
		err error
	)
	p.mx.Lock()
	last := len(p.set) - 1
	if last >= 0 {
		k = p.set[last]
		p.set = p.set[:last]
	}
	p.mx.Unlock()
	if last < 0 {
		k, err = p.new(ctx)
		if err != nil {
			return k, errors.Wrap(err, "failed to create new")
		}
	}
	return k, nil
}
ChannelWithConfirm returns a ChannelKeeper with AMQP Channel into confirm mode.
package rabbitroutine
import (
	"context"
	"sync"
	"github.com/pkg/errors"
	"github.com/streadway/amqp"
)
type ChannelKeeper struct {
	msgCh     *amqp.Channel
	errorCh   chan *amqp.Error
	confirmCh chan amqp.Confirmation
	returnCh  chan amqp.Return
}
func (k *ChannelKeeper) Channel() *amqp.Channel {
	return k.msgCh
}
func (k *ChannelKeeper) Error() <-chan *amqp.Error {
	return k.errorCh
}
func (k *ChannelKeeper) Confirm() <-chan amqp.Confirmation {
	return k.confirmCh
}
func (k *ChannelKeeper) Return() <-chan amqp.Return {
	return k.returnCh
}
func (k *ChannelKeeper) Close() error {
	return k.msgCh.Close()
}
type Pool struct {
	conn *Connector
	mx   sync.Mutex
	set  []ChannelKeeper
}
func NewPool(conn *Connector) *Pool {
	return &Pool{
		conn: conn,
	}
}