Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5252

Purge through webconsole fails if authorizationPlugin is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.10.0
    • 5.12.0
    • Web Console
    • None

    Description

      Upgrading from a 5.5.1 broker to 5.10.
      I've managed to work around the issue by making some changes to org.apache.activemq.web.LocalBrokerFacade, but unsure if this is the root issue or a band-aid fix.

      Set destinations = getManagedBroker().getQueueRegion().getDestinations(destination); 
      

      returns a AuthorizationDestinationFilter when the code is expecting a org.apache.activemq.broker.region.Queue - calling getNext() on the AuthorizationDestinationFilter returns the expected Queue.

      Old code:

       public void purgeQueue(ActiveMQDestination destination) throws Exception {	
              Set destinations = getManagedBroker().getQueueRegion().getDestinations(destination);
              for (Iterator i = destinations.iterator(); i.hasNext();) 
              {        	
                  Destination dest = (Destination) i.next();
                  if (dest instanceof Queue) {
                      Queue regionQueue = (Queue) dest;
                      regionQueue.purge();
                 }
              }
          }
      

      new:

       public void purgeQueue(ActiveMQDestination destination) throws Exception {	
              Set destinations = getManagedBroker().getQueueRegion().getDestinations(destination);
              for (Iterator i = destinations.iterator(); i.hasNext();) 
              {        	
                  Destination dest = (Destination) i.next();
                  if (dest instanceof Queue) {
                      Queue regionQueue = (Queue) dest;
                      regionQueue.purge();
                  }
                  else if(dest instanceof  AuthorizationDestinationFilter)
                  {
                  	AuthorizationDestinationFilter adf = (AuthorizationDestinationFilter)dest;
                  	if (adf.getNext() instanceof Queue) 
                  	{
                  		Queue regionQueue = (Queue)adf.getNext();
                          regionQueue.purge();  
                  	}
                  }
              }
          }
      

      Attached is the activemq.xml file we're using to test this - creating a message on the webconsole and then attempting to purge it will fail unless either the code change above is made, or the <plugins> section of activemq.xml is commented out.

      Attachments

        1. activemq.xml
          6 kB
          Richard Wagg

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rwagg Richard Wagg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: