private void QueueOrderProcessingAsync(HttpOrderRequestDto newOrderDto) { foreach (var orderItem in newOrderDto.OrderItems) { _taskQueue.QueueBackgroundWorkItem(async token => { var rnd = new Random(); var httpProxy = new HttpProxy(); // order is being processed... var secondsRequiredForProcessing = rnd.Next(5, 15); // between 5 and 15 seconds await Task.Delay(TimeSpan.FromSeconds(secondsRequiredForProcessing), token); await httpProxy.PatchAsync <string>(orderItem.CallbackEndpoint); }); } }