Try PubSub+
If you haven't already, check out our new Developer Portal! You'll find useful information about Solace PubSub+ as well as handy resources to get you started.

jmsListener selector mechanism for new solace bee's :)

manivmaniv Member Posts: 10

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

Comments

  • TomFTomF Member, Employee Posts: 62 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

  • manivmaniv Member Posts: 10

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

Sign In or Register to comment.