Examples of FatalListenerStartupException


Examples of org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException

    try {
      this.resourceHolder = ConnectionFactoryUtils.getTransactionalResourceHolder(connectionFactory, transactional);
      this.channel = resourceHolder.getChannel();
    }
    catch (AmqpAuthenticationException e) {
      throw new FatalListenerStartupException("Authentication failure", e);
    }
    this.consumer = new InternalConsumer(channel);
    this.deliveryTags.clear();
    this.activeObjectCounter.add(this);

    // mirrored queue might be being moved
    int passiveDeclareTries = 3;
    do {
      try {
        attemptPassiveDeclarations();
        if (passiveDeclareTries < 3 && logger.isInfoEnabled()) {
          logger.info("Queue declaration succeeded after retrying");
        }
        passiveDeclareTries = 0;
      }
      catch (DeclarationException e) {
        if (passiveDeclareTries > 0 && channel.isOpen()) {
          if (logger.isWarnEnabled()) {
            logger.warn("Queue declaration failed; retries left=" + (passiveDeclareTries-1), e);
            try {
              Thread.sleep(5000);
            }
            catch (InterruptedException e1) {
              Thread.currentThread().interrupt();
            }
          }
        }
        else if (e.getFailedQueues().size() < this.queues.length) {
          if (logger.isWarnEnabled()) {
            logger.warn("Not all queues are available; only listening on those that are - configured: "
                + Arrays.asList(this.queues) + "; not available: " + e.getFailedQueues());
          }
          this.missingQueues.addAll(e.getFailedQueues());
          this.lastRetryDeclaration = System.currentTimeMillis();
        }
        else {
          this.activeObjectCounter.release(this);
          throw new QueuesNotAvailableException("Cannot prepare queue for listener. "
              + "Either the queue doesn't exist or the broker will not allow us to use it.", e);
        }
      }
    }
    while (passiveDeclareTries-- > 0);

    if (!acknowledgeMode.isAutoAck()) {
      // Set basicQos before calling basicConsume (otherwise if we are not acking the broker
      // will send blocks of 100 messages)
      try {
        channel.basicQos(prefetchCount);
      }
      catch (IOException e) {
        this.activeObjectCounter.release(this);
        throw new FatalListenerStartupException("Cannot set basicQos.", e);
      }
    }


    try {
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException

        AsyncMessageProcessingConsumer processor = new AsyncMessageProcessingConsumer(consumer);
        processors.add(processor);
        this.taskExecutor.execute(processor);
      }
      for (AsyncMessageProcessingConsumer processor : processors) {
        FatalListenerStartupException startupException = processor.getStartupException();
        if (startupException != null) {
          throw new AmqpIllegalStateException("Fatal exception on listener startup", startupException);
        }
      }
    }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.exception.FatalListenerStartupException

          if (logger.isDebugEnabled()) {
            logger.debug("Starting a new consumer: " + consumer);
          }
          this.taskExecutor.execute(processor);
          try {
            FatalListenerStartupException startupException = processor.getStartupException();
            if (startupException != null) {
              this.consumers.remove(consumer);
              throw new AmqpIllegalStateException("Fatal exception on listener startup", startupException);
            }
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.