As I understand it, the clientId parameter isn't a selector; rather, it
ensures that your consumer gets messages consistent with what has already
been delivered to it even if the session has expired, but it is not meant
to specify that you only consume messages produced by yourself. So the
delivery of all messages to your consumer in the first example sounds
entirely expected.

In your second example, I don't see anywhere that you're setting the "test"
header property to "2" when you publish, so I'd expect that none of them
would be returned to your client. You could try attaching a JMX viewer such
as JConsole to the broker immediately after your consumer connects, and
navigating the MBeans to find the consumer to check whether the broker
believes the test=2 selector is in effect.  Maybe something's going wrong
and the selector's not making it all the way to the broker...

Tim

On Mon, May 8, 2017 at 2:37 PM, kovacro <robert.ko...@loto-quebec.com>
wrote:

> Hello,
>
> I am using:
> curl-7.48.0-win32-mingw
> apache-activemq-5.14.5-bin (locally)
>
> I can add messages like this:
> curl -u admin:admin -d "hello world 1" -H "Content-Type: text/plain" -XPOST
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac&&clientId=KovacIP1"
>
> curl -u admin:admin -d "hello world 1" -H "Content-Type: text/plain" -XPOST
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac&&clientId=KovacIP2"
>
> I can retrieve both messages with:
> curl -u admin:admin -X GET
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac?type=queue&clientId=KovacIP1"
>
> 1- How come my clientid parameter doesn't filter wich messages I retrieve?
> "When using this approach, you don't need to keep sessions alive between
> requests, you just need to use the same clientId every time."
>
> ---------------------------------------------
>
> Afterwards, I try using selectors, but they don't seem to work either
>
> I insert this:
> curl -u admin:admin -d "hello world 1" -H "Content-Type: text/plain" -XPOST
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac&&clientId=KovacIP1"
>
> curl -u admin:admin -d "test selector" -H "Content-Type: text/plain" -XPOST
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac&&clientId=KovacIP2&test=2"
>
> curl -u admin:admin -d "hello world 3" -H "Content-Type: text/plain" -XPOST
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac&&clientId=KovacIP3"
>
> When I try to retrieve test=2 with this command
>
> curl -u admin:admin -H "selector: test=2" -X GET
> "http://localhost:8161/api/message?destination=queue://
> Test_Kovac?type=queue&clientId=KovacIP2"
>
> I have access to all the message. I retreive them all (all 3 of them) 1 by
> 1.
>
> Why is that?
>
> How does the selector work?
>
> Thanks for your help
>
>
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/ActiveMQ-REST-Api-with-HTTP-tp4725797.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to