// Path: conduit/src/main/java/io/rtr/conduit/amqp/AMQPConsumerCallback.java
// public interface AMQPConsumerCallback {
//     ActionResponse handle(AMQPMessageBundle messageBundle);
//     void notifyOfActionFailure(Exception e);
//     void notifyOfShutdown(String consumerTag, ShutdownSignalException sig);
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/AMQPMessageBundle.java
// public class AMQPMessageBundle implements TransportMessageBundle {
//     private String consumerTag;
//     private Envelope envelope;
//     private AMQP.BasicProperties basicProperties;
//     private byte[] body;
// 
//     private static AMQP.BasicProperties initialProperties() {
//         return initialProperties(null);
//     }
// 
//     private static AMQP.BasicProperties initialProperties(Map<String, Object> additionalHeaders) {
//         Map<String, Object> headers = new HashMap<String, Object>();
// 
//         if (additionalHeaders != null) {
//             headers.putAll(additionalHeaders);
//         }
// 
//         headers.put("conduit-retry-count", 0);
// 
//         return new AMQP.BasicProperties()
//                 .builder()
//                 .deliveryMode(2 /*persistent*/)
//                 .priority(0)
//                 .headers(headers)
//                 .contentType("text/plain")
//                 .build();
//     }
// 
//     public AMQPMessageBundle(String consumerTag, Envelope envelope, AMQP.BasicProperties basicProperties, byte[] body) {
//         this.consumerTag = consumerTag;
//         this.envelope = envelope;
//         this.basicProperties = basicProperties;
//         this.body = body;
//     }
// 
//     public AMQPMessageBundle(String message) {
//         this(null, null, initialProperties(), message.getBytes());
//     }
// 
//     public AMQPMessageBundle(String message, Map<String, Object> headers) {
//         this(null, null, initialProperties(headers), message.getBytes());
//     }
// 
//     public String getConsumerTag() {
//         return consumerTag;
//     }
// 
//     public Envelope getEnvelope() {
//         return envelope;
//     }
// 
//     public AMQP.BasicProperties getBasicProperties() {
//         return basicProperties;
//     }
// 
//     public byte[] getBody() {
//         return body;
//     }
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/AbstractAMQPTransport.java
// public abstract class AbstractAMQPTransport extends Transport{
//     protected abstract AMQPQueueConsumer getConsumer(Object callback, AMQPCommonListenProperties commonListenProperties, String poisonPrefix);
//     protected abstract AMQPCommonListenProperties getCommonListenProperties(TransportListenProperties properties);
//     protected abstract Object getConsumerCallback(TransportListenProperties properties);
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportConnectionProperties.java
// public interface TransportConnectionProperties {
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportListenProperties.java
// public interface TransportListenProperties {
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportMessageBundle.java
// public interface TransportMessageBundle {
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportPublishProperties.java
// public interface TransportPublishProperties {
// }


import com.rabbitmq.client.AlreadyClosedException;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.MetricsCollector;
import com.rabbitmq.client.ShutdownListener;
import com.rabbitmq.client.ShutdownSignalException;
import io.rtr.conduit.amqp.AMQPConsumerCallback;
import io.rtr.conduit.amqp.AMQPMessageBundle;
import io.rtr.conduit.amqp.AbstractAMQPTransport;
import io.rtr.conduit.amqp.transport.TransportConnectionProperties;
import io.rtr.conduit.amqp.transport.TransportListenProperties;
import io.rtr.conduit.amqp.transport.TransportMessageBundle;
import io.rtr.conduit.amqp.transport.TransportPublishProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.time.Duration;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
package io.rtr.conduit.amqp.impl;



public class AMQPTransport extends AbstractAMQPTransport {

    class DynamicQueueCleanupShutdownListener implements ShutdownListener {
        //@VisibleForTesting
        CompletableFuture<Void> queueCleanupJob;

// Path: conduit/src/main/java/io/rtr/conduit/amqp/AMQPConsumerCallback.java
// public interface AMQPConsumerCallback {
//     ActionResponse handle(AMQPMessageBundle messageBundle);
//     void notifyOfActionFailure(Exception e);
//     void notifyOfShutdown(String consumerTag, ShutdownSignalException sig);
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/AMQPMessageBundle.java
// public class AMQPMessageBundle implements TransportMessageBundle {
//     private String consumerTag;
//     private Envelope envelope;
//     private AMQP.BasicProperties basicProperties;
//     private byte[] body;
// 
//     private static AMQP.BasicProperties initialProperties() {
//         return initialProperties(null);
//     }
// 
//     private static AMQP.BasicProperties initialProperties(Map<String, Object> additionalHeaders) {
//         Map<String, Object> headers = new HashMap<String, Object>();
// 
//         if (additionalHeaders != null) {
//             headers.putAll(additionalHeaders);
//         }
// 
//         headers.put("conduit-retry-count", 0);
// 
//         return new AMQP.BasicProperties()
//                 .builder()
//                 .deliveryMode(2 /*persistent*/)
//                 .priority(0)
//                 .headers(headers)
//                 .contentType("text/plain")
//                 .build();
//     }
// 
//     public AMQPMessageBundle(String consumerTag, Envelope envelope, AMQP.BasicProperties basicProperties, byte[] body) {
//         this.consumerTag = consumerTag;
//         this.envelope = envelope;
//         this.basicProperties = basicProperties;
//         this.body = body;
//     }
// 
//     public AMQPMessageBundle(String message) {
//         this(null, null, initialProperties(), message.getBytes());
//     }
// 
//     public AMQPMessageBundle(String message, Map<String, Object> headers) {
//         this(null, null, initialProperties(headers), message.getBytes());
//     }
// 
//     public String getConsumerTag() {
//         return consumerTag;
//     }
// 
//     public Envelope getEnvelope() {
//         return envelope;
//     }
// 
//     public AMQP.BasicProperties getBasicProperties() {
//         return basicProperties;
//     }
// 
//     public byte[] getBody() {
//         return body;
//     }
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/AbstractAMQPTransport.java
// public abstract class AbstractAMQPTransport extends Transport{
//     protected abstract AMQPQueueConsumer getConsumer(Object callback, AMQPCommonListenProperties commonListenProperties, String poisonPrefix);
//     protected abstract AMQPCommonListenProperties getCommonListenProperties(TransportListenProperties properties);
//     protected abstract Object getConsumerCallback(TransportListenProperties properties);
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportConnectionProperties.java
// public interface TransportConnectionProperties {
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportListenProperties.java
// public interface TransportListenProperties {
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportMessageBundle.java
// public interface TransportMessageBundle {
// }
// 
// Path: conduit/src/main/java/io/rtr/conduit/amqp/transport/TransportPublishProperties.java
// public interface TransportPublishProperties {
// }


// Path: conduit/src/main/java/io/rtr/conduit/amqp/impl/AMQPTransport.java
import com.rabbitmq.client.AlreadyClosedException;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.MetricsCollector;
import com.rabbitmq.client.ShutdownListener;
import com.rabbitmq.client.ShutdownSignalException;
import io.rtr.conduit.amqp.AMQPConsumerCallback;
import io.rtr.conduit.amqp.AMQPMessageBundle;
import io.rtr.conduit.amqp.AbstractAMQPTransport;
import io.rtr.conduit.amqp.transport.TransportConnectionProperties;
import io.rtr.conduit.amqp.transport.TransportListenProperties;
import io.rtr.conduit.amqp.transport.TransportMessageBundle;
import io.rtr.conduit.amqp.transport.TransportPublishProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.time.Duration;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;

package io.rtr.conduit.amqp.impl;



public class AMQPTransport extends AbstractAMQPTransport {

    class DynamicQueueCleanupShutdownListener implements ShutdownListener {
        //@VisibleForTesting
        CompletableFuture<Void> queueCleanupJob;

        @Override