func (p *WorkerPool) Submit(req Request) {
	p.reqChan <- req
}
Submit submits a request for processing
package bdd
import (
	"sync"
)
type Request interface {
	Invoke() (interface{}, error)
}
type Response struct {
	Request
	Resp interface{}
	Err  error
}
type WorkerPool struct {
	workers   []*worker
	reqChan   chan Request
	respChan  chan *Response
	wgResp    sync.WaitGroup
	wg        *sync.WaitGroup
	responses []*Response
}
func NewWorkerPool(num int) *WorkerPool {
	reqChan := make(chan Request)
	respChan := make(chan *Response)
	workers := make([]*worker, num)
	wg := &sync.WaitGroup{}
	for i := 0; i < num; i++ {
		workers[i] = newWorker(reqChan, respChan, wg)
	}
	return &WorkerPool{
		workers:  workers,
		reqChan:  reqChan,
		respChan: respChan,
		wg:       wg,
	}
}
func (p *WorkerPool) Start() {
	p.wgResp.Add(1)
	go p.listen()
	p.wg.Add(len(p.workers))
	for _, w := range p.workers {
		go w.start()
	}
}
func (p *WorkerPool) Stop() {
	close(p.reqChan)
	logger.Infof("Waiting %d for workers to finish...", len(p.workers))
	p.wg.Wait()
	logger.Infof("... all %d workers finished.", len(p.workers))
	close(p.respChan)
	logger.Infof("Waiting for listener to finish...")
	p.wgResp.Wait()
	logger.Infof("... listener finished.")
}