async Task ClientContext.BasicConsume(ReceiveSettings receiveSettings, IBasicConsumer consumer) { var queueInfo = await _queueCache.GetByName(receiveSettings.EntityName).ConfigureAwait(false); await Task.Factory.StartNew(async() => { while (!CancellationToken.IsCancellationRequested) { List <Message> messages = await PollMessages(queueInfo.Url, receiveSettings).ConfigureAwait(false); await Task.WhenAll(messages.Select(consumer.HandleMessage)).ConfigureAwait(false); } }, CancellationToken, TaskCreationOptions.None, _taskScheduler).ConfigureAwait(false); }
async Task ClientContext.SendMessage(string queueName, SendMessageBatchRequestEntry request, CancellationToken cancellationToken) { var queueInfo = await _queueCache.GetByName(queueName).ConfigureAwait(false); await queueInfo.Send(request, cancellationToken).ConfigureAwait(false); }