OK this is actually what is missing from the purge command. Earlier I thought it was that the JMX selectors worked wrong, but really it's a matter of getting a QueueViewMbean, and using that to remove the messages or match the selector.
I'm going to fix the junk I call a test into a junit test, and make it exercise the PurgeCommand class, and then I'll have a patch to fix AMQ-3404. --Allen > -----Original Message----- > From: Timothy Bish [mailto:[email protected]] > Sent: Monday, July 18, 2011 2:23 PM > To: [email protected] > Subject: Re: AMQ-3404 & querying via JMX > > On Mon, 2011-07-18 at 14:15 -0700, Allen Reese wrote: > > I'm looking at the patch we have put together for AMQ-3404 (Fix the Purge > > command to use message > selectors), and I've run into something that just doesn't seem right. > > > > In order to create the list of messages to remove, an > > AmqMessagesQueryFilter is created, and this > requires a broker URL. However, the rest of the purge command is done using > JMX commands. > > > > The added code is something like this: > > // apply additive operations. > > List messages = AmqMessagesUtil.getMessages(getBrokerUrl(), dest, > > queryAddObjects); > > context.printInfo("Messages are: "+ messages.toString()); > > > > // apply subtraction operations > > if (querySubObjects.size() > 0) { > > List subMsgs = AmqMessagesUtil.getMessages(getBrokerUrl(), dest, > > querySubObjects); > > messages.removeAll(subMsgs); > > } > > > > purgeMessages(queueName, messages); > > > > Is there any way to do the query over JMX instead of creating a JMS > > connection to the broker? I'm > hesitant to send in a patch that adds what feels like an extreme hack. > > > > Allen Reese > > Core Platforms > > Yahoo! Inc. > > The QueueViewMBean has a method "removeMatchingMessages" that takes a > selector, doesn't that do what you want? If not what is the use case? > > Regards > Tim. > > > -- > Tim Bish > ------------ > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: tabish121 > Blog: http://timbish.blogspot.com/ > >
