How to set up the MessageSelector in activeMq

134 views Asked by At

I have a process that runs and polls for a message in an ActiveMQ. Now I have problems with setting up the message selector. The Queue is connected and pulls messages from the Queue, without selector.

If I add an selector, it just breaks with a exception that only contains the selector string.

As much as I read the thin documentation I don't really get the problem, I played with masking the string and played with the format, but no luck.

The Message in the Queue has the following property/value pair as one of its properties, as I can see the message in the webpanel in the queue:

F_IMGKOMP.PIMG_SOURCE_FILENAME = EURDE_500.jpeg

The reduced code looks like this:

var selector = "F_IMGKOMP.PIMG_SOURCE_FILENAME = 'EURDE_500.jpeg'";

using (IMessageConsumer myCons = mySession.CreateConsumer(myDest, selector ))
{
    var tmp = myCons.Receive(new TimeSpan(0, 0, 10));

    if (tmp != null)
        System.Diagnostics.Debug.WriteLine("eureka");
}
1

There are 1 answers

0
Tim Bish On

Your selector string is invalid which is why you get the error about the selector. The selector syntax is SQL 92.

The identifier must obey the following rule:

An identifier is an unlimited length sequence of Java letters and Java digits, the first of which must be a Java letter. A letter is any character for which the method Character.isJavaLetter returns true. This includes _ and $. A letter or digit is any character for which the method Character.isJavaLetterOrDigit returns true.

This implies that the use of the '.' in your selector property identifier is the culprit.