I've encountered a couple of different techniques for dealing with service bus messaging (queues and topics) and I'm just looking for some input on best practices.
I've encountered a couple of different techniques for consuming messages off of a topic, for instance:
The first technique is that a subscriptions is made per message type that might appear on that topic (using filters or routing keys) and then the consumer service listens on each of those subscriptions separately and dispatches accordingly.
The other technique is to have a single subscription per consumer (like an identity) and then the consumer will inspect the message to see what the message type is and then dispatch it to its handler.
I feel like the first one could potentially offer some benefits such as making it easier to separate the messages and get them to their respective handlers, or depending on your tooling, maybe make it easier to maintain. For example, in the Azure service bus, you can use explorer to see your subscriptions' "queues" and get directly to the message types you're looking for. But I also feel like there's going to be a performance impact on this technique because you're creating a lot of subscription objects, and you're potentially creating one connection to the bus per message type, or at least a thread for each. Also now you have to ensure your subscriptions account for consumers in a different context so that you're not inadvertently creating a competing consumer model. At scale, I can see this being problematic in terms of performance and ultimately cost.
As for the second technique, it seems that depending on your chosen platform (i.e. RabbitMQ, AzureServiceBus, Kafka, etc.), you should still be able to enable parallelism by grabbing more than one message at a time, but you could have significantly fewer subscriptions, no competing consumer model issue, and the only scaling issue would be normal (i.e. how long does it take a single instance of the consumer to clear a queue vs. your SLO/SLA).The downside is that you don't have the message separation in your debugging tools, so you'd have to sift through them all to find what you're looking for.
What are you guys seeing out there? What have you done, what have you run into? Is this a matter of "there's no truly right answer just do it case by case and pray?"