Uploaded image for project: 'Spring AMQP'
  1. Spring AMQP
  2. AMQP-516

Setting autoDelete or exclusive to anything, including "true" in @Queue without a queue name results in them being disabled

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.5 M1
    • Fix Version/s: 1.5 RC1
    • Component/s: RabbitMQ
    • Labels:
    • Environment:
      This is present in 1.5.0.BUILD-SNAPSHOT fetched on 2015-08-06

      Description

      The following queue declaration will result in a queue being declared with auto delete and exclusive set to false:

      @RabbitListener(bindings = @QueueBinding(
          value = @Queue(autoDelete = "true", exclusive = "true"),
          exchange = @Exchange(value = "myFanout", type = ExchangeTypes.FANOUT, durable = "true")
      ))
      

      due to the following code in RabbitListenerAnnotationBeanProcessor:

      if (!StringUtils.hasText(queueName)) {
          queueName = UUID.randomUUID().toString();
          if (!StringUtils.hasText(bindingQueue.exclusive())) {
              exclusive = true;
          }
          if (!StringUtils.hasText(bindingQueue.autoDelete())) {
              autoDelete = true;
          }
      }
      else {
          exclusive = resolveExpressionAsBoolean(bindingQueue.exclusive());
          autoDelete = resolveExpressionAsBoolean(bindingQueue.autoDelete());
      }
      

      Making them exclusive and auto delete by default when using a random name seems like a good idea, but it should probably be changed to something like:

      String e = bindingQueue.exclusive();
      if (!StringUtils.hasText(e) || resolveExpressionAsBoolean(e)) {
          exclusive = true
      }
      

        Attachments

          Activity

            People

            Assignee:
            grussell Gary Russell
            Reporter:
            Raniz Daniel Raniz Raneland
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: