public MessageTracker(List <T> payloads)
        {
            _statesByDeliveryTag = new ConcurrentDictionary <ulong, MessageState <T> >();
            _statesByMessageId   = new ConcurrentDictionary <string, MessageState <T> >();
            _statesMaster        = new List <MessageState <T> >();

            foreach (var payload in payloads)
            {
                var outgoingMessage = new MessageState <T>(payload);
                _statesByMessageId.TryAdd(outgoingMessage.MessageId, outgoingMessage);
                _statesMaster.Add(outgoingMessage);
            }
        }
 private void SetSendStatus(MessageState <T> messageState, SendStatus status, string description)
 {
     if (status == SendStatus.NoExchangeFound)
     {
         foreach (var state in _statesMaster)
         {
             state.Status       = status;
             state.Acknowledged = true;
         }
     }
     // unroutable messages get a BasicReturn followed by a BasicAck, so we want to ignore that ack
     else if (messageState.Status != SendStatus.Unroutable)
     {
         messageState.Status       = status;
         messageState.Description  = description;
         messageState.Acknowledged = true;
     }
 }
 public void SetDeliveryTag(ulong deliveryTag, MessageState <T> outgoingMessage)
 {
     outgoingMessage.SequenceNumber = deliveryTag;
     _statesByDeliveryTag.TryAdd(deliveryTag, outgoingMessage);
 }