GitHub user SubOptimal opened a pull request:

    https://github.com/apache/activemq/pull/108

    "--msgsel" for the purge command not working as described

    The help of "activemq purge" states
    
        Main purge --msgsel \"JMSMessageID='*:10',JMSPriority>5\" FOO.*
                - Delete all the messages in the destinations that matches 
FOO.* and has a JMSMessageID in
                  the header field that matches the wildcard *:10, and has a 
JMSPriority field > 5 in the
                  queue FOO.BAR.
                  SLQ92 syntax is also supported.
    
    But passing `JMSMessageID='*:10'` as selector for the purge command doesn't 
purge a message  even the message exsist. The pull request provide a code fix 
and a related unit test.
    
    The message selector in the browse command works as described.
    
        activemq browse --amqurl tcp://localhost:61616 --msgsel 
"JMSMessageID='*:10'" TEST
    
        JMS_BODY_FIELD:JMSText = test message: 9
        JMS_HEADER_FIELD:JMSExpiration = 0
        JMS_HEADER_FIELD:JMSMessageID = ID:HIDDEN-63485-1433505789304-1:1:1:1:10
        JMS_HEADER_FIELD:JMSPriority = 4
        JMS_HEADER_FIELD:JMSDestination = TEST
        JMS_HEADER_FIELD:JMSTimestamp = 1433505789534
        JMS_HEADER_FIELD:JMSRedelivered = false
        JMS_HEADER_FIELD:JMSDeliveryMode = persistent
    
    Using the same selector for the purge command does not work.
    
        activemq purge --msgsel "JMSMessageID='*:10'" TEST
        INFO: Removed: 0 messages for message selector JMSMessageID='*:10'
    
        activemq purge --msgsel "JMSMessageID='*:10',JMSPriority=4" TEST
        INFO: Removed: 0 messages for message selector (JMSMessageID='%:10') 
AND (JMSPriority=4)
    
    Passing the whole message ID purge the selected message.
    
        activemq purge --msgsel 
"JMSMessageID='ID:HIDDEN-63485-1433505789304-1:1:1:1:10'" TEST
    
        INFO: Removed: 1 messages for message selector 
JMSMessageID='ID:HIDDEN-63485-1433505789304-1:1:1:1:10'

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/SubOptimal/activemq msgsel

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq/pull/108.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #108
    
----
commit 72fbce1c549bd50d8ed6480859ef4574fc52c82a
Author: Frank Dietrich <[email protected]>
Date:   2015-06-05T12:24:40Z

    fix for wildcards in the purge message selector

commit fe8a2d919b4ac6b7aaee4506590136e469537313
Author: Frank Dietrich <[email protected]>
Date:   2015-06-05T12:24:52Z

    unit test for wildcards in the purge message selector

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to