You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Dejan Bosanac (JIRA)" <ji...@apache.org> on 2014/05/26 12:31:02 UTC

[jira] [Assigned] (AMQ-5170) Selectors in AMQ through REST does not work properly

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

Dejan Bosanac reassigned AMQ-5170:
----------------------------------

    Assignee: Dejan Bosanac

> Selectors in AMQ through REST does not work properly
> ----------------------------------------------------
>
>                 Key: AMQ-5170
>                 URL: https://issues.apache.org/jira/browse/AMQ-5170
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.8.0
>         Environment: Tested with the following client utilities:
> wget (GNU Wget 1.11.4)
> Advanced REST client 3.1.7 (Google Chrome extension)
> RestClient 2.0.3 (Firefox extension)
>            Reporter: Joe Luo
>            Assignee: Dejan Bosanac
>
> ActiveMQ seems to ignore the selector query specified and works on initial get but will not deliver messages on subsequent requests.
> Steps to Reproduce
> 1. Create a queue in ActiveMQ called “test”.
> 2. Modify shipped ProducerTool.java with following change on the method "sendLoop":
> {code}
> protected void sendLoop(Session session, MessageProducer producer) throws Exception {
>         for (int i = 0; i < messageCount || messageCount == 0; i++) {
>             TextMessage message = session.createTextMessage(createMessageText(i));
>             if (i%2 == 0) {
>                 message.setIntProperty("prop", 1);
>             } else {
>                 message.setIntProperty("prop", 2);
>             }
>             if (verbose) {
>                 String msg = message.getText();
>                 if (msg.length() > 50) {
>                     msg = msg.substring(0, 50) + "...";
>                 }
>                 System.out.println("[" + this.getName() + "] Sending message: '" + msg + "'");
>             }
>             producer.send(message);
>             if (transacted) {
>                 System.out.println("[" + this.getName() + "] Committing " + messageCount + " message
> s");
>                 session.commit();
>             }
>             Thread.sleep(sleepTime);
>         }
>     }
> {code} 
> 3. send 5 messages to broker with following command:
> {code}
> ant producer -Dsubject=test -Dtopic=false -Ddurable=true -Dmax=5 -DmessageSize=50 -Duser=admin -Dpassword=admin
> {code}
> 4. Using any REST client, specify the URL with selector: 
> {code}
> http://localhost:8161/api/message/test?type=queue&prop=2
> {code}
> and execute the consumer REST request to download the message from the event queue.
> 5. The first message will always get downloaded regardless of selector query whether it matches or not. Since above rest URL with the selector should not get the first message as the first message has Int Property "prop=1" which does not match the selector.
> 6. Then try with following rest URL from another REST client:
> {code}
> http://localhost:8161/api/message/test?type=queue&prop=1
> {code}
> Regardless of selector query or even without a selector, this client will not be able to download any message and all messages will remain in the queue.
> Expected Behavior
> The ActiveMQ broker should respect the message selector query when specified by the consumer application using the REST interface.  Using the steps outlined above with the openwire protocol (tcp/ip) works i.e. creating the MessageConsumer as:
> {code}
> MessageConsumer consumer = session.createConsumer(destination, "prop=1");
> {code}



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