public CompletionPendingMessageState(int packetId, IQos2MessageDeliveryState deliveryState,
     PreciseTimeSpan startTimestamp, MessageFeedbackChannel feedbackChannel)
 {
     this.PacketId = packetId;
     this.DeliveryState = deliveryState;
     this.StartTimestamp = startTimestamp;
     this.FeedbackChannel = feedbackChannel;
     this.SentTime = DateTime.UtcNow;
 }
        public void ResetMessage(IMessage message, MessageFeedbackChannel feedbackChannel)
        {
            if (message.SequenceNumber != this.SequenceNumber)
            {
                throw new InvalidOperationException($"Expected to receive message with id of {this.SequenceNumber.ToString()} but saw a message " +
                    $"with id of {message.SequenceNumber.ToString()}. Protocol Gateway only supports exclusive connection to IoT Hub.");
            }

            this.FeedbackChannel = feedbackChannel;
        }