func New(name string) Queue {
	q := &queue{
		chanSubs:  make(map[string]*chanSub),
		name:      name,
		done:      make(chan struct{}, 1),
		interrupt: make(chan struct{}, 1),
		callback:  make(chan *Message, 1024),
	}
	q.msgPool = &sync.Pool{
		New: func() interface{} {
			return &Message{
				chReply: make(chan *Message, 1),
			}
		},
	}
	go func() {
		for {
			select {
			case <-q.done:
				qlog.Info("closing chain33 callback")
				return
			case msg := <-q.callback:
				if msg.callback != nil {
					msg.callback(msg)
				}
			}
		}
	}()
	return q
}
New new queue struct
package queue
import (
	"errors"
	"fmt"
	"os"
	"os/signal"
	"sync"
	"sync/atomic"
	"syscall"
	"time"
	"github.com/33cn/chain33/types"
	log "github.com/33cn/chain33/common/log/log15"
)
var qlog = log.New("module", "queue")
const (
	defaultChanBuffer    = 64
	defaultLowChanBuffer = 40960
)
var (
	ErrIsQueueClosed    = errors.New("ErrIsQueueClosed")
	ErrQueueTimeout     = errors.New("ErrQueueTimeout")
	ErrQueueChannelFull = errors.New("ErrQueueChannelFull")
)
func DisableLog() {
	qlog.SetHandler(log.DiscardHandler())
}
type chanSub struct {
	high    chan *Message
	low     chan *Message
	isClose int32
}
type Queue interface {
	Close()
	Start()
	Client() Client
	Name() string
	SetConfig(cfg *types.Chain33Config)
	GetConfig() *types.Chain33Config
}
type queue struct {
	chanSubs  map[string]*chanSub
	mu        sync.Mutex
	done      chan struct{}
	interrupt chan struct{}
	callback  chan *Message
	isClose   int32
	name      string
	cfg       *types.Chain33Config
	msgPool   *sync.Pool
}