private async Task WaitForAcknowledgements(List <Tracking> sent)
        {
            if (sent.Count == 0)
            {
                return;
            }

            Console.Error.WriteLine($"DEBUG Waiting for {sent.Count} acknowledgements");

            foreach (var item in sent)
            {
                try
                {
                    await Sender.WaitForDeliveryAsync(item);

                    _batchQueue.Lookup(Properties.LookupId, item.LookupId, timeout: TimeSpan.Zero, transaction: QueueTransaction.Single);
                }
                catch (AcknowledgmentException ex)
                {
                    Console.Error.WriteLine("WARNING " + ex);
                    using (var txn = new QueueTransaction())
                    {
                        _batchQueue.MarkRejected(item.LookupId); // send a acknowledgement that the message has been rejected
                        Queues.MoveMessage(_batchQueue, _posionQueue, item.LookupId, txn);
                        txn.Commit();
                    }
                }
                catch (AggregateException ex)
                {
                    //TODO: handle sent error to multi-element format name
                    Console.Error.WriteLine($"WARNING multi-elements format names are not yet supported");
                    throw;
                }
            }
        }
 public Message Lookup(Properties properties, long lookupId, QueueTransaction transaction, LookupAction action = LookupAction.ReceiveCurrent, TimeSpan?timeout = null)
 {
     Contract.Requires(transaction != null);
     return(_high.Lookup(properties, lookupId, action, timeout, transaction) ?? _low.Lookup(properties, lookupId, action, timeout, transaction));
 }