Uploaded image for project: 'JBoss A-MQ'
  1. JBoss A-MQ
  2. ENTMQ-1195

[Selectors] Special escape characters in selectors do not work as expected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • JBoss A-MQ 6.3
    • JBoss A-MQ 6.2
    • broker
    • None
    • Documentation (Ref Guide, User Guide, etc.), Compatibility/Configuration
    • Hide

      1) Send a few similar messages to the queue

      /var/dtests/node_data/clients/aac0_sender  --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{  sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=XD7xlJIQn_"
      /var/dtests/node_data/clients/aac0_sender  --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{  sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=YD7xlJIQn_"
      /var/dtests/node_data/clients/aac0_sender  --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{  sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=ZD7xlJIQnz"
      /var/dtests/node_data/clients/aac0_sender  --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{  sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=ZD7xlJIQn%"
      

      2) Receive some of the messages using selector

      /var/dtests/node_data/clients/aac0_receiver  --timeout 2 --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{  sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true';{'link': {'selector': \"a LIKE '_D7xlJIQn__' ESCAPE '_'\"}}" --count 0
      

      3) Observe that no messages are returned. All four messages should be received.
      Same behaviour is using different escape character in same selector.
      As escape character use "_", "$" in the following (same) selector does not work. Selector works correctly with "\", "%" as escape characters.

      nok >> SELECTOR :: a LIKE '_D7xlJIQn__' ESCAPE '_'
      nok >> SELECTOR :: a LIKE '%D7xlJIQn%%' ESCAPE '%'
      nok >> SELECTOR :: a LIKE '_D7xlJIQn$_' ESCAPE '$'
      ok  >> SELECTOR :: a LIKE '_D7xlJIQn\_' ESCAPE '\'
      ok  >> SELECTOR :: a LIKE '_D7xlJIQn%_' ESCAPE '%'
      

      also following selector does not work in the first case, only in second

      nok >> SELECTOR :: a LIKE '_D7xlJIQn_%' ESCAPE '_'
      ok  >> SELECTOR :: a LIKE '_D7xlJIQn$%' ESCAPE '$'
      
      Show
      1) Send a few similar messages to the queue /var/dtests/node_data/clients/aac0_sender --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{ sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=XD7xlJIQn_" /var/dtests/node_data/clients/aac0_sender --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{ sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=YD7xlJIQn_" /var/dtests/node_data/clients/aac0_sender --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{ sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=ZD7xlJIQnz" /var/dtests/node_data/clients/aac0_sender --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{ sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true'" --count 1 --msg-property "a=ZD7xlJIQn%" 2) Receive some of the messages using selector /var/dtests/node_data/clients/aac0_receiver --timeout 2 --log-msgs dict --broker admin:admin@localhost:5672 --connection-options "{ sasl_mechanisms : 'PLAIN', protocol : 'amqp1.0' }" --address "'test_like_escape_syntax_true';{'link': {'selector': \"a LIKE '_D7xlJIQn__' ESCAPE '_'\"}}" --count 0 3) Observe that no messages are returned. All four messages should be received. Same behaviour is using different escape character in same selector. As escape character use "_", "$" in the following (same) selector does not work. Selector works correctly with "\", "%" as escape characters. nok >> SELECTOR :: a LIKE '_D7xlJIQn__' ESCAPE '_' nok >> SELECTOR :: a LIKE '%D7xlJIQn%%' ESCAPE '%' nok >> SELECTOR :: a LIKE '_D7xlJIQn$_' ESCAPE '$' ok >> SELECTOR :: a LIKE '_D7xlJIQn\_' ESCAPE '\' ok >> SELECTOR :: a LIKE '_D7xlJIQn%_' ESCAPE '%' also following selector does not work in the first case, only in second nok >> SELECTOR :: a LIKE '_D7xlJIQn_%' ESCAPE '_' ok >> SELECTOR :: a LIKE '_D7xlJIQn$%' ESCAPE '$'

    Description

      When sending a few similar messages with properties containing special characters,
      which has to be escaped in message selectors, there is an undocumented behaviour.
      In some escape characters the behaviour is correct, in other not correct.
      In both JMS 1.1 specification (3.8.1.1 Message Selector Syntax)
      and ActiveMQ (A-MQ) documentation, I have not found any information about this special cases.
      So this might end up purely to be just a documentation bug.

      Attachments

        Activity

          People

            gtully@redhat.com Gary Tully
            mtoth@redhat.com Michal Toth
            Michal Toth Michal Toth
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: