protected void checkMismatchedQueues() { if (this.mismatchedQueuesFatal && this.amqpAdmin != null) { try { this.amqpAdmin.initialize(); } catch (AmqpConnectException e) { logger.info("Broker not available; cannot check queue declarations"); } catch (AmqpIOException e) { if (RabbitUtils.isMismatchedQueueArgs(e)) { throw new FatalListenerStartupException("Mismatched queues", e); } else { logger.info("Failed to get connection during start(): " + e); } } } else { try { Connection connection = getConnectionFactory().createConnection(); // NOSONAR if (connection != null) { connection.close(); } } catch (Exception e) { logger.info("Broker not available; cannot force queue declarations during start"); } } }
private CountDownLatch[] setUpChannelLatches(ApplicationContext context) { CachingConnectionFactory cf = context.getBean(CachingConnectionFactory.class); final CountDownLatch cancelLatch = new CountDownLatch(1); final CountDownLatch mismatchLatch = new CountDownLatch(1); final CountDownLatch preventContainerRedeclareQueueLatch = new CountDownLatch(1); cf.addChannelListener((ShutDownChannelListener) s -> { if (RabbitUtils.isNormalChannelClose(s)) { cancelLatch.countDown(); try { preventContainerRedeclareQueueLatch.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } else if (RabbitUtils.isMismatchedQueueArgs(s)) { mismatchLatch.countDown(); } }); return new CountDownLatch[] { cancelLatch, mismatchLatch, preventContainerRedeclareQueueLatch }; }
protected void checkMismatchedQueues() { if (this.mismatchedQueuesFatal && this.amqpAdmin != null) { try { this.amqpAdmin.initialize(); } catch (AmqpConnectException e) { logger.info("Broker not available; cannot check queue declarations"); } catch (AmqpIOException e) { if (RabbitUtils.isMismatchedQueueArgs(e)) { throw new FatalListenerStartupException("Mismatched queues", e); } else { logger.info("Failed to get connection during start(): " + e); } } } else { try { Connection connection = getConnectionFactory().createConnection(); // NOSONAR if (connection != null) { connection.close(); } } catch (Exception e) { logger.info("Broker not available; cannot force queue declarations during start"); } } }
if (RabbitUtils.isMismatchedQueueArgs(e)) { throw new FatalListenerStartupException("Mismatched queues", e);
if (RabbitUtils.isMismatchedQueueArgs(e)) { throw new FatalListenerStartupException("Mismatched queues", e);