public static async Task <SimpleAsyncProcessingWorker <T> > CreateAndStartAsync(IQueueConsumer consumer,
                                                                                        Func <T, RabbitMQConsumerContext, CancellationToken, Task> callbackFunc, TimeSpan processingTimeout, CancellationToken cancellationToken, ILogger logger = null)
        {
            var instance = new SimpleAsyncProcessingWorker <T>(consumer, callbackFunc, processingTimeout, logger);

            await instance.StartAsync(cancellationToken).ConfigureAwait(false);

            return(instance);
        }
        public static async Task <SimpleAsyncProcessingWorker <T> > CreateAndStartAsync(IQueueConsumer consumer,
                                                                                        Func <IEnumerable <T>, CancellationToken, Task> batchCallbackFunc, ushort batchSize, TimeSpan processingTimeout,
                                                                                        CancellationToken cancellationToken, ILogger logger = null)
        {
            var instance = new SimpleAsyncProcessingWorker <T>(consumer, batchCallbackFunc, batchSize, processingTimeout, logger);

            await instance.StartAsync(cancellationToken).ConfigureAwait(false);

            return(instance);
        }
        public static async Task <SimpleAsyncProcessingWorker <T> > CreateAndStartAsync(IQueueClient queueClient,
                                                                                        string queueName,
                                                                                        Func <T, RabbitMQConsumerContext, CancellationToken, Task> callbackFunc, TimeSpan processingTimeout,
                                                                                        CancellationToken cancellationToken,
                                                                                        IConsumerCountManager consumerCountManager = null, IMessageRejectionHandler messageRejectionHandler = null,
                                                                                        ILogger logger = null, ushort prefetchCount = 1)
        {
            var instance = new SimpleAsyncProcessingWorker <T>(queueClient, queueName, callbackFunc,
                                                               processingTimeout, consumerCountManager, messageRejectionHandler, logger, prefetchCount);

            await instance.StartAsync(cancellationToken).ConfigureAwait(false);

            return(instance);
        }