Richard Wagg created AMQ-5252:
---------------------------------

             Summary: Purge through webconsole fails if authorizationPlugin is 
used
                 Key: AMQ-5252
                 URL: https://issues.apache.org/jira/browse/AMQ-5252
             Project: ActiveMQ
          Issue Type: Bug
          Components: webconsole
    Affects Versions: 5.10.0
            Reporter: Richard Wagg
            Priority: Minor


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. 

{code}
Set destinations = 
getManagedBroker().getQueueRegion().getDestinations(destination); 
{code}

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:
{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();
           }
        }
    }
{code}
new:

{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();
            }
            else if(dest instanceof  AuthorizationDestinationFilter)
            {
                AuthorizationDestinationFilter adf = 
(AuthorizationDestinationFilter)dest;
                if (adf.getNext() instanceof Queue) 
                {
                        Queue regionQueue = (Queue)adf.getNext();
                    regionQueue.purge();  
                }
            }
        }
    }
{code}


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. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to