func (p Processor) Start() {
	for _, worker := range p.workerlist {
		worker.Start()
	}
}
Start message processor
package decoder
import (
	"time"
)
type Message interface{}
type MessageDecoded interface{}
type DecoderFunc func(Message interface{}) error
type DoneCallback func(string, int, time.Time, time.Time)
type ErrorCallback func(string, int, time.Time, time.Time, error)
type Worker struct {
	Id            int
	DecoderParams DecoderParams
	WorkerPool    chan chan Message
	Name          string
	InMsg         chan Message
	Quit          chan bool
}
func CreateWorker(workerPool chan chan Message, decoderParams DecoderParams, id int, name string) Worker {
	return Worker{
		Id:            id,
		DecoderParams: decoderParams,
		WorkerPool:    workerPool,
		Name:          name,
		InMsg:         make(chan Message),
		Quit:          make(chan bool),
	}
}
func (w Worker) Start() {
	go func() {
		for {
			select {
			case <-w.Quit:
				break
			case w.WorkerPool <- w.InMsg:
				msg := <-w.InMsg
				timeTrackStart := time.Now()
				err := w.DecoderParams.DecoderFunc(msg)
				timeTrackStop := time.Now()
				if err != nil && w.DecoderParams.ErrorCallback != nil {
					w.DecoderParams.ErrorCallback(w.Name, w.Id, timeTrackStart, timeTrackStop, err)
				} else if err == nil && w.DecoderParams.DoneCallback != nil {
					w.DecoderParams.DoneCallback(w.Name, w.Id, timeTrackStart, timeTrackStop)
				}
			}
		}
	}()
}
func (w Worker) Stop() {
	w.Quit <- true
}
type Processor struct {
	workerpool    chan chan Message
	workerlist    []Worker
	DecoderParams DecoderParams
	Name          string
}
type DecoderParams struct {
	DecoderFunc   DecoderFunc
	DoneCallback  DoneCallback
	ErrorCallback ErrorCallback
}
func CreateProcessor(numWorkers int, decoderParams DecoderParams, name string) Processor {
	processor := Processor{
		workerpool:    make(chan chan Message),
		workerlist:    make([]Worker, numWorkers),
		DecoderParams: decoderParams,
		Name:          name,
	}
	for i := 0; i < numWorkers; i++ {
		worker := CreateWorker(processor.workerpool, decoderParams, i, name)
		processor.workerlist[i] = worker
	}
	return processor
}