Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-8272

Cannot delete queue <dur_sub_name> on binding MySubscriptionName3ForRATests - it has consumers

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Blocker
    • None
    • AMQ 7.10.2.GA
    • resource-adapter
    • False
    • None
    • False
    • Workaround Exists
    • Hide

      Setting enable-amq1-prefix: true on external pooled-connection-factory in messaging-activemq subsystem.

      Show
      Setting enable-amq1-prefix: true on external pooled-connection-factory in messaging-activemq subsystem.

    Description

      If EAP 8 is configured to connect to remote AMQ 7.11 broker then in case there is MDB listening on topic (with durable subscription) then following WARN occurs and server retries inbound connection:

      13:19:55,351 WARN  [org.apache.activemq.artemis.ra.ActiveMQRALogger] (default-threads - 1) AMQ152005: Failure in broker activation org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter@3168920 connectionFactoryLookup=jms/QueueConnectionFactory destination=MY_TOPIC destinationType=jakarta.jms.Topic ack=Auto-acknowledge durable=true clientID=null subscription=MySubscriptionName3ForRATests user=null maxSession=15): ActiveMQIllegalStateException[errorType=ILLEGAL_STATE message=AMQ229025: Cannot delete queue MySubscriptionName3ForRATests on binding MySubscriptionName3ForRATests - it has consumers = org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding]
      	at org.apache.activemq.artemis@2.21.0.redhat-00044//org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:554)
      	at org.apache.activemq.artemis@2.21.0.redhat-00044//org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:446)
      	at org.apache.activemq.artemis@2.21.0.redhat-00044//org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQSessionContext.deleteQueue(ActiveMQSessionContext.java:350)
      	at org.apache.activemq.artemis@2.21.0.redhat-00044//org.apache.activemq.artemis.core.client.impl.ClientSessionImpl.deleteQueue(ClientSessionImpl.java:766)
      	at org.apache.activemq.artemis.ra@2.21.0.redhat-00044//org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:153)
      	at org.apache.activemq.artemis.ra@2.21.0.redhat-00044//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:324)
      	at org.apache.activemq.artemis.ra@2.21.0.redhat-00044//org.apache.activemq.artemis.ra.inflow.ActiveMQActivation$SetupActivation.run(ActiveMQActivation.java:772)
      	at org.wildfly.extension.messaging-activemq//org.wildfly.extension.messaging.activemq.ActiveMQResourceAdapter$WorkWrapper.run(ActiveMQResourceAdapter.java:160)
      	at org.jboss.ironjacamar.impl@3.0.2.Final-redhat-00002//org.jboss.jca.core.workmanager.WorkWrapper.runWork(WorkWrapper.java:445)
      	at org.jboss.as.connector@8.0.0.GA-redhat-SNAPSHOT//org.jboss.as.connector.services.workmanager.WildflyWorkWrapper.runWork(WildflyWorkWrapper.java:64)
      

      Activation config properties on MDB are configured like:

      @MessageDriven(name = "ActivationConfigBean", activationConfig = {
          @ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "jms/QueueConnectionFactory"),
          @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "MY_TOPIC"),
          @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "jakarta.jms.Topic"),
          @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
          @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
          @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "MySubscriptionName3ForRATests") })
      
      @TransactionManagement(TransactionManagementType.BEAN)
      public class ActivationConfigBean extends ActivationConfigBeanBase
          implements MessageListener {
      ...
      

      By debugging the issue the problem is that queue for durable subscriptin is deleted for each created MDB session in:
      https://github.com/apache/activemq-artemis/blob/2.21.0/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java#L151
      which is called from for cycle in:
      https://github.com/apache/activemq-artemis/blob/main/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java#L314

       

      Customer impact

      It looks like that queue should be deleted/created just for the first session and skipped in setup of other sessions so if statement in https://github.com/apache/activemq-artemis/blob/2.21.0/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java#L149 should be updated like:

      if (sessionNr == 0 && (selectorChanged || topicChanged)) {
             ...
      

      By closer look the reason why this piece of code is called is that because address of the topic in AMQ 7 broker is MY_TOPIC so topicChanged=true. In case that resource adapter is connected to integrated Artemis then topic name is jms.topic.MY_TOPIC so topicChanged=false and if statement is false.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-jbertram Justin Bertram
              mnovak1@redhat.com Miroslav Novak
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: