activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Mielke (Reopened) (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (AMQ-3404) Purge command does not accept message selectors
Date Wed, 14 Dec 2011 15:51:31 GMT

     [ https://issues.apache.org/jira/browse/AMQ-3404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Torsten Mielke reopened AMQ-3404:
---------------------------------


I need to reopen this bug.

The proposed fix has a problem. When multiple message selector criteria are specified using
a comma separated list, as in 
{code}
--msgsel "JMSMessageID='*:10',JMSPriority>5"
{code}

then the current fix maps the criteria using an OR logical operator as this code shows:

{code:title=PurgeCommand.java}
protected void runTask(List<String> tokens) throws Exception {
  ...
  for (String remove : queryAddObjects) {
	removed = proxy.removeMatchingMessages(remove);
	context.printInfo("Removed: " + removed
		+ " messages for msgsel" + remove);
  }
  ...
}
{code}
This code iterates through each message selector criteria and removes the messages that matches
each criteria individually.

Instead comma separated selector criteria should be treated as an AND operator. The usage
output for activem-admin purge -help and activemq-admin browse -help suggests this and its
also the way how activemq-admin browse behaves. 


Proposing a new fix including an updated TestPurgeCommand.java test.

This fix works with the ActiveMQ specific message selector syntax, e.g. 
{code}
   --msgsel "JMSMessageID='*:10',JMSPriority>5"
{code}
but also with an SQL92 syntax specified on command line, e.g. 
{code} 
   --msgsel "(JMSMessageID='*:10') AND (JMSPriority>5)"
{code}
                
> Purge command does not accept message selectors
> -----------------------------------------------
>
>                 Key: AMQ-3404
>                 URL: https://issues.apache.org/jira/browse/AMQ-3404
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.5.0
>            Reporter: Allen Reese
>            Assignee: Dejan Bosanac
>            Priority: Minor
>             Fix For: 5.6.0
>
>         Attachments: AMQ-3404.patch, PurgeCommand.patch
>
>
> The admin purge command does not work with a message selector.
> A patch is forth coming, there is some cleanup, and compliance to be vetted before I
can attach the patch.
> (1) Browse with no arguments:
> user@activemq-master:~/activemq$ activemq-admin browse --amqurl tcp://localhost:61616
 --view JMSTimestamp queue.FOO.BAR
> Java Runtime: Sun Microsystems Inc. 1.6.0_22
> /home/y/libexec/jdk1.6.0/jre
>    Heap sizes: current=60800k  free=58531k  max=902976k
>      JVM args: -Dactivemq.classpath="" 
>      -Djavax.net.ssl.trustStoreType=JKS
> ACTIVEMQ_HOME: /home/y/libexec/activemq
> ACTIVEMQ_BASE: /home/y/libexec/activemq
> JMS_HEADER_FIELD:JMSTimestamp = 1310608108263
> JMS_HEADER_FIELD:JMSTimestamp = 1310608108740
> JMS_HEADER_FIELD:JMSTimestamp = 1310608109283
> JMS_HEADER_FIELD:JMSTimestamp = 1310608109790
> JMS_HEADER_FIELD:JMSTimestamp = 1310608110324
> JMS_HEADER_FIELD:JMSTimestamp = 1310608110831
> JMS_HEADER_FIELD:JMSTimestamp = 1310608111374
> JMS_HEADER_FIELD:JMSTimestamp = 1310608111872
> JMS_HEADER_FIELD:JMSTimestamp = 1310608112415
> JMS_HEADER_FIELD:JMSTimestamp = 1310608113005
> (2) Browse with msgsel
> user@activemq-master:~/activemq$ activemq-admin browse --amqurl tcp://localhost:61616
 --view JMSTimestamp --msgsel 'JMSTimestamp<1310608110324' queue.FOO.BAR
> Java Runtime: Sun Microsystems Inc. 1.6.0_22
> /home/y/libexec/jdk1.6.0/jre
>    Heap sizes: current=60800k  free=58535k  max=902976k
>      JVM args: -Dactivemq.classpath=""
>      -Djavax.net.ssl.trustStoreType=JKS
> ACTIVEMQ_HOME: /home/y/libexec/activemq
> ACTIVEMQ_BASE: /home/y/libexec/activemq
> JMS_HEADER_FIELD:JMSTimestamp = 1310608108263
> JMS_HEADER_FIELD:JMSTimestamp = 1310608108740
> JMS_HEADER_FIELD:JMSTimestamp = 1310608109283
> JMS_HEADER_FIELD:JMSTimestamp = 1310608109790
> (3) Purge with msgsel: - Not Working -  (what I wanted here was to use only those
> matching my criteria)
> user@activemq-master:~/activemq$ activemq-admin purge --msgsel 'JMSTimestamp<1310608110324'
queue.FOO.BAR
> Java Runtime: Sun Microsystems Inc. 1.6.0_22
> /home/y/libexec/jdk1.6.0/jre
>    Heap sizes: current=60800k  free=58531k  max=902976k
>      JVM args: -Dactivemq.classpath="" 
>      -Djavax.net.ssl.trustStoreType=JKS
> ACTIVEMQ_HOME: /home/y/libexec/activemq
> ACTIVEMQ_BASE: /home/y/libexec/activemq
> Connecting to JMX URL:
> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:1
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:2
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:3
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:4
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:5
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:6
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:7
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:8
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:9
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:32:1:1:10
> from queue: queue.FOO.BAR
> (4) Purge with msgsel working with a patch:
> user@activemq-master:~/activemq$ activemq-admin browse --amqurl tcp://localhost:61616
 --view JMSTimestamp --msgsel 'JMSTimestamp<1310608391914' queue.FOO.BAR
> Java Runtime: Sun Microsystems Inc. 1.6.0_22
> /home/y/libexec/jdk1.6.0/jre
>    Heap sizes: current=60800k  free=58535k  max=902976k
>      JVM args: -Dactivemq.classpath="" 
>      -Djavax.net.ssl.trustStoreType=JKS
> ACTIVEMQ_HOME: /home/y/libexec/activemq
> ACTIVEMQ_BASE: /home/y/libexec/activemq
> JMS_HEADER_FIELD:JMSTimestamp = 1310608389116
> JMS_HEADER_FIELD:JMSTimestamp = 1310608389607
> JMS_HEADER_FIELD:JMSTimestamp = 1310608390266
> JMS_HEADER_FIELD:JMSTimestamp = 1310608390781
> JMS_HEADER_FIELD:JMSTimestamp = 1310608391390
> user@activemq-master:~/activemq$ ./activemq-admin purge  --msgsel 'JMSTimestamp<1310608391914'
 queue.FOO.BAR 
> Java Runtime: Sun Microsystems Inc. 1.6.0_22
> /home/y/libexec/jdk1.6.0/jre
>    Heap sizes: current=60800k  free=58575k  max=902976k
>      JVM args: -Dactivemq.classpath="" 
>      -Djavax.net.ssl.trustStoreType=JKS
> ACTIVEMQ_HOME: /home/y/libexec/activemq
> ACTIVEMQ_BASE: /home/y/libexec/activemq
> Connecting to JMX URL:
> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
> INFO: Addobjects is :[JMSTimestamp<1310608391914]
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:33:1:1:1
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:33:1:1:2
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:33:1:1:3
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:33:1:1:4
> from queue: queue.FOO.BAR
> INFO: Removing message:
> ID:activemq-master-55970-1309958858075-2:33:1:1:5
> from queue: queue.FOO.BAR

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message