jmsListener selector mechanism for new solace bee's :)

while consuming solace messages with selector functionality from message header property, do not include any special characters in header key..
if in case if you are adding key with special character you may able to successfully send messages but while retrieving from queue/topic using jmsListener you may end-up with 400-Unresolved selector error.
eg:-
will not work because of '_' char:
selector = "custom_routing_header='${solace.jms.singletonconsumerservice.message.custom.header.value}'",

instead use
selector = "customroutingheader='${solace.jms.singletonconsumerservice.message.custom.header.value}'",

Tagged:

Comments

  • TomF
    TomF Member, Employee Posts: 405 Solace Employee

    Hey @maniv, thanks for that tip!

    To get the best performance out of PubSub+, it's best not to use selectors. They are an (effectively) unbounded compute problem. We have found that in the vast majority of cases, PubSub+'s dynamic, hierarchical topic structure can achieve the same filtering, simply put the header key in the topic:

    message/topic/100/apples/food
    header key number = 100
    header key fruit = apples
    header key type = food

    Now to select all apples I just subscribe to:
    message/topic//apples/

    To get all food when the number is between 110 and 119, I do:
    message/topic/11//food.

    To get all pears between 200 and 299 and 358 and 369, use multiple subscriptions:
    message/topic/2/pears/
    mesage/topic/358/pears/*
    mesage/topic/358/pears/*
    mesage/topic/36/pears/

    This means I can have multiple keys (up to 125!).

    This only really breaks down when you need a complicated range

  • maniv
    maniv Member Posts: 10

    @TomF thanks lot. let me have a try :)

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 497 admin

    Hi @maniv . I know this is an old post, but I stumbled on it, and was wondering about it. You said that if you used the underscore _ character in the Selector identifier name, you received errors? I just tried that now using JCSMP and (Solace) JMS and it seemed to work fine. Can you confirm? Thanks!