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.
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}'",



  • TomF
    TomF Member, Employee Posts: 408 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:

    header key number = 100
    header key fruit = apples
    header key type = food

    Now to select all apples I just subscribe to:

    To get all food when the number is between 110 and 119, I do:

    To get all pears between 200 and 299 and 358 and 369, use multiple subscriptions:

    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: 541 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!