public void start() throws AmqpException { if (logger.isDebugEnabled()) { logger.debug("Starting consumer " + this); } this.thread = Thread.currentThread(); try { this.resourceHolder = ConnectionFactoryUtils.getTransactionalResourceHolder(this.connectionFactory, this.transactional); this.channel = this.resourceHolder.getChannel(); ClosingRecoveryListener.addRecoveryListenerIfNecessary(this.channel); // NOSONAR never null here } catch (AmqpAuthenticationException e) { throw new FatalListenerStartupException("Authentication failure", e); } this.deliveryTags.clear(); this.activeObjectCounter.add(this); passiveDeclarations(); setQosAndreateConsumers(); }
Throwable possibleAuthException = ex.getCause().getCause(); if (!(possibleAuthException instanceof PossibleAuthenticationFailureException)) { throw ex;
Throwable possibleAuthException = ex.getCause().getCause(); if (!(possibleAuthException instanceof PossibleAuthenticationFailureException)) { throw ex;
public void start() throws AmqpException { if (logger.isDebugEnabled()) { logger.debug("Starting consumer " + this); } this.thread = Thread.currentThread(); try { this.resourceHolder = ConnectionFactoryUtils.getTransactionalResourceHolder(this.connectionFactory, this.transactional); this.channel = this.resourceHolder.getChannel(); ClosingRecoveryListener.addRecoveryListenerIfNecessary(this.channel); // NOSONAR never null here } catch (AmqpAuthenticationException e) { throw new FatalListenerStartupException("Authentication failure", e); } this.deliveryTags.clear(); this.activeObjectCounter.add(this); passiveDeclarations(); setQosAndreateConsumers(); }
@Test public void testAvoidHangAMQP_508() { CachingConnectionFactory connectionFactory = new CachingConnectionFactory("localhost"); String longName = new String(new byte[300]).replace('\u0000', 'x'); BlockingQueueConsumer blockingQueueConsumer = new BlockingQueueConsumer(connectionFactory, new DefaultMessagePropertiesConverter(), new ActiveObjectCounter<BlockingQueueConsumer>(), AcknowledgeMode.AUTO, true, 1, longName, "foobar"); try { blockingQueueConsumer.start(); fail("expected exception"); } catch (FatalListenerStartupException e) { assertThat(e.getCause(), instanceOf(IllegalArgumentException.class)); } connectionFactory.destroy(); }
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"); } } }
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"); } } }
throw new FatalListenerStartupException("Mismatched queues", e);
throw new FatalListenerStartupException("Mismatched queues", e);
throw new FatalListenerStartupException("Illegal Argument on Queue Declaration", e);
throw new FatalListenerStartupException("Illegal Argument on Queue Declaration", e);
if (isPossibleAuthenticationFailureFatal()) { this.startupException = new FatalListenerStartupException("Authentication failure", new AmqpAuthenticationException(ex));
if (isPossibleAuthenticationFailureFatal()) { this.startupException = new FatalListenerStartupException("Authentication failure", new AmqpAuthenticationException(ex));