/// <summary> /// Method that will be called everytime there is a network failure. /// </summary> internal override void SpecificRestart(IModel model) { Props = model.CreateBasicProperties(); MySettings.ConstructProperties(Props); if (MySettings.UseConfirms) { model.ConfirmSelect(); //requeue all messages that were on the wire. This might lead to duplicates. if (MySettings.RequeueMessageAfterFailure && _unacked != null) { var unacked = new List <Message>(_unacked.Count); foreach (var m in _unacked.Values) { unacked.Add(new Message { Failed = m.Failed + 1, RoutingKey = m.RoutingKey, Payload = m.Payload }); } OnNAckHandler(unacked); } _unacked = new ConcurrentDictionary <ulong, Message>(); model.BasicAcks += (_, args) => HandleAcknowledgement(false, args.DeliveryTag, args.Multiple); model.BasicNacks += (_, args) => HandleAcknowledgement(true, args.DeliveryTag, args.Multiple); } }