private void Publish(int attempt, TimeSpan?enqueueTime, IBasicProperties properties, byte[] requestBytes) { string queue; if (attempt >= _config.GetMaxAttempts()) { properties.Headers.TryGetValue("x-dead-queue-attempt", out var deadQueueAttempt); var attempts = deadQueueAttempt == null ? attempt : attempt + (int)properties.Headers["x-dead-queue-attempt"]; properties = GetBasicProperties(0, null); properties.Headers["x-dead-queue-attempt"] = attempts; queue = Descriptor.DeadLetterQueueName; } else if (enqueueTime.HasValue) { queue = Descriptor.DelayedQueueName; DeclareDelayedQueue(); } else { queue = Descriptor.QueueName; } _model.BasicPublish(string.Empty, queue, properties, requestBytes); }