/** * Invoke this during the constructor! */ protected void init() { if (this.closed) return; try { // initialise the connection and channel this.channel = broker.connect(); // log recovery events ((Recoverable) this.channel).addRecoveryListener((r) -> { logger.warn("Lost connection to RabbitMQ lost, auto-recovery complete"); }); // setup this thing this.setup(); } catch (IOException e) { logger.warn("Failed to connect to RabbitMQ", e); throw new QueueException("Failed to connect to RabbitMQ, is it up?", e); } }