public BackgroundMqWorker(string queueName, BlockingCollection <IMessage> queue, BackgroundMqClient mqClient,
                                  IMessageHandler handler)
        {
            QueueName     = queueName;
            this.queue    = queue;
            this.mqClient = mqClient;
            this.handler  = handler;

            cts    = new CancellationTokenSource();
            bgTask = Task.Factory.StartNew(Run, null, TaskCreationOptions.LongRunning);
        }
        public BackgroundMqCollection(BackgroundMqClient mqClient, IMessageHandlerFactory handlerFactory, int threadCount, int outQMaxSize)
        {
            MqClient       = mqClient;
            HandlerFactory = handlerFactory;
            ThreadCount    = threadCount;
            OutQMaxSize    = outQMaxSize;

            queueMap = new Dictionary <string, BlockingCollection <IMessage> > {
                { QueueNames <T> .In, new BlockingCollection <IMessage>() },
                { QueueNames <T> .Priority, new BlockingCollection <IMessage>() },
                { QueueNames <T> .Dlq, new BlockingCollection <IMessage>() },
                { QueueNames <T> .Out, new BlockingCollection <IMessage>() },
            };
        }
 public BackgroundMqMessageFactory(BackgroundMqClient mqClient) => this.mqClient = mqClient;