You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Gary Tully <ga...@gmail.com> on 2012/04/10 12:47:19 UTC

Re: How does the Active MQ perform search in the messages for the given MESSAGE_SELECTOR?

selectors work on any message property.

have a peek at the tests:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/selector/SelectorTest.java?view=markup

and
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsTopicSelectorTest.java?view=markup

to see examples of the the syntax.

selectors work in the same manner for browsers.

The only thing to note is that selectors are run in memory, so you may
need to configure a large maxPageSize via a destination policy entry
if you have sparse selectors as the maxPageSize determines how many
messages are retained in memory pending dispatch,

An alternative to selectors is to use virtual destinations such that
selected messages are redirected to their own destination.



On 10 April 2012 11:13, sreekar <tr...@gmail.com> wrote:
> Hi Guys,
>
> I need to get the messages from one ActiveMQ Queue.
> Going throught the documentation, found that Message_Selectors might be
> helpful.
>
> But i did not see any doc explaining the mechanism of filtering the
> messages.
>
> My doubt is how do i query for a specific message with some correlationID
> (say :1789)
>
> consumer = session->createConsumer (MY_QUEUE, "1789");
> or
> consumer = session->createConsumer (MY_QUEUE, "correlationId=1789");
>
> How does the filtering happen ?
>
> Will it (message-selector) search only in the content (i.e body of the
> message) or will it also search in the properties set by the user (set using
> setStringProperty(), setIntProperty()...etc) ?
>
>
> Are there any examples showing the usage of ActiveMQQueueBrowser ?
>
> Any help would be appreciable.
>
> Thanks & Regards,
> Sreekar
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-does-the-Active-MQ-perform-search-in-the-messages-for-the-given-MESSAGE-SELECTOR-tp4545137p4545137.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com

Re: How does the Active MQ perform search in the messages for the given MESSAGE_SELECTOR?

Posted by sreekar <tr...@gmail.com>.
Hi Team,

I have tried to use the message_selector using the C++ client.
But am unable to filter the messages.

Without selector, i am able to recieve all the messages.
(It can be assured that connection, session, destination, consumer, producer
are created correctly)

Things which i tried:
~~~~~~~~~~~~~~
  PRODUCER - END:

                producer = session->createProducer (MY_QUEUE);
       //
       // In actual case i am doing the following thing in a loop,
       // correlationID is set using a counter variable.
       //
                TextMessage* textMessage = session->createTextMessage (
                                               amqMessageToSend.getMessage()
);

                // set the unique-identifiers for the message
                textMessage->setCMSCorrelationID ( "23781729" );
                
                producer->send ( textMessage, PERSISTENT);

  CONSUMER - END:
          
                std::string filter = "JMSCorrelationID = '23781729'";
                session->createConsumer (MY_QUEUE, filter);

I am sending around 5000 messages from PRODUCER-END and am recieving them
successfully at CONSUMER-END when i created consumer without any selector
("JMSCorrelationID = '23781729'");

I tried with  "JMSCorrelationID = '23781729'" and "CMSCorrelationID =
'23781729'", but i could not recieve any messages from CONSUMER-END.

Is there anything wrong with the syntax ?

http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/selector/SelectorTest.java?view=markup

The syntax mentioned above (for message-id) is like :
"JMSMessageID = 'id:test:1:1:1:1'"

In similar lines, i tried to filter with correlation-ID (which is also a JMS
property that can be set by user).


Any suggestions would be appreciable.

Thanks & Regards,
Sreekar

--
View this message in context: http://activemq.2283324.n4.nabble.com/How-does-the-Active-MQ-perform-search-in-the-messages-for-the-given-MESSAGE-SELECTOR-tp4545137p4578210.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How does the Active MQ perform search in the messages for the given MESSAGE_SELECTOR?

Posted by sreekar <tr...@gmail.com>.
Hi Gtully,

Thank you very much for the flying-answer.

I am amazed to see the response in no time.

Thanks for pointing out the examples.

Will look at the possibility of using Virtual Destinations in my current
work.

At first glance, it seems there is no direct C++ API for dealing with
Virtual Destinations.

Thank you once again for your instant response.


Thanks & Regards,
Sreekar

--
View this message in context: http://activemq.2283324.n4.nabble.com/How-does-the-Active-MQ-perform-search-in-the-messages-for-the-given-MESSAGE-SELECTOR-tp4545137p4545278.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.