func (queue *Queue) Chan() <-chan Message {
	if queue.used {
		panic("cannot get a second receive channel from a 1:1 queue")
	}
	queue.used = true
	return queue.c
}
Chan - channel to read from 1:1 queue
can only be called once
package messagebus
import (
	"container/list"
	"fmt"
	"reflect"
	"strconv"
	"sync"
	"golang.org/x/crypto/sha3"
)
const Default = -1
const (
	defaultQueueSize = 1000  
)
type Message struct {
	Command    string    
	Parameters [][]byte  
}
type Queue struct {
	c    chan Message
	size int
	used bool
}
type signature [32]byte
type BroadcastQueue struct {
	sync.RWMutex
	out         []chan Message
	defaultSize int
	cache       map[signature]struct{}
	index       list.List
}
type busses struct {
	Broadcast  *BroadcastQueue `size:"1000"`  
	Connector  *Queue          `size:"50"`    
	Announce   *Queue          `size:"50"`    
	Blockstore *Queue          `size:"50"`    
	TestQueue  *Queue          `size:"50"`    
}
var Bus busses
func init() {
	busType := reflect.TypeOf(Bus)
	busValue := reflect.ValueOf(&Bus).Elem()
	for i := 0; i < busType.NumField(); i += 1 {
		fieldInfo := busType.Field(i)
		sizeTag := fieldInfo.Tag.Get("size")
		queueSize := defaultQueueSize
		if len(sizeTag) > 0 {
			s, err := strconv.Atoi(sizeTag)
			if nil == err && s > 0 {
				queueSize = s
			} else {
				m := fmt.Sprintf("queue: %v  has invalid size: %q", fieldInfo, sizeTag)
				panic(m)
			}
		}
		switch qt := busValue.Field(i).Type(); qt {
		case reflect.TypeOf((*BroadcastQueue)(nil)):
			q := &BroadcastQueue{
				out:         make([]chan Message, 0, 10),
				defaultSize: queueSize,
				cache:       make(map[signature]struct{}),
			}
			newQueue := reflect.ValueOf(q)
			busValue.Field(i).Set(newQueue)
		case reflect.TypeOf((*Queue)(nil)):
			q := &Queue{
				c:    make(chan Message, queueSize),
				size: queueSize,
				used: false,
			}
			newQueue := reflect.ValueOf(q)
			busValue.Field(i).Set(newQueue)
		default:
			panic(fmt.Sprintf("queue type: %q is not handled", qt))
		}
	}
}
func (queue *Queue) Send(command string, parameters ...[]byte) {
	queue.c <- Message{
		Command:    command,
		Parameters: parameters,
	}
}