publish-subscribemessagebrokersolacebroker

How to publish once to a topic and route them to different queues based on the topic in the Solace broker?


I want to publish a sale of a product. I just wanted to publish once to a topic like sale/124 where each number represents an id of a store. Then each queue connected to that store only had to subscribe to a topic like sale/* 2 * for example for store with id 2. The thing this is not possible as solace only supports wildcards in topics for prefixes. So like 2* would match 234 or just 2, but in the topic * 2 * the first * at least would be considered the literal value.

A solution would be to have a level in the topic for each store: sale/id1/id2/id3 And only had to subscribe to sale//id2/ for store 2 The thing is only 250 can be used for topic name and only 128 topic levels.

A easy solution would be to use selectors, but they are not recommended by solace. Is this one of the situations where you should use them?

What do you think is the best path so I can achieve my goal?


Solution

  • Based on Solace topic taxonomy best practices, when you publish to a topic like sale/124, ideally "124" would be the id of the store. If you want to have this event applicable for multiple stores, then I would suggest a different topic taxonomy approach like a region identifier or some other common property which is shared amongst the stores 1,2 and 4.

    This will allow each store to subscribe to the specific events they are interested in via queues.

    Hope this helps.