func (p *Producer) Shutdown() {
	close(p.Chan)
}
Shutdown stops the producer
package producer
import (
	"log"
	"sync"
)
type Producer struct {
	MQ           MQueue
	MQConfigFile string
	MQErrorCount *uint64
	Topic string
	Chan  chan []byte
	Logger *log.Logger
}
type MQueue interface {
	setup(string, *log.Logger) error
	inputMsg(string, chan []byte, *uint64)
}
func NewProducer(mqName string) *Producer {
	var mqRegistered = map[string]MQueue{
		"kafka":           new(KafkaSarama),
		"kafka.sarama":    new(KafkaSarama),
		"kafka.segmentio": new(KafkaSegmentio),
		"nsq":             new(NSQ),
		"nats":            new(NATS),
		"rawSocket":       new(RawSocket),
	}
	return &Producer{
		MQ: mqRegistered[mqName],
	}
}
func (p *Producer) Run() error {
	var (
		wg  sync.WaitGroup
		err error
	)
	err = p.MQ.setup(p.MQConfigFile, p.Logger)
	if err != nil {
		return err
	}
	wg.Add(1)
	go func() {
		defer wg.Done()
		topic := p.Topic
		p.MQ.inputMsg(topic, p.Chan, p.MQErrorCount)
	}()
	wg.Wait()
	return nil
}