rebus-org / Rebus

:bus: Simple and lean service bus implementation for .NET
https://mookid.dk/category/rebus
Other
2.26k stars 353 forks source link

Can I have different messagetypes in same queue handled by different services? #1123

Closed tleclaire closed 6 months ago

tleclaire commented 6 months ago

I have a design question: I want to send different messages to the same queue and want to handle them from different services. So each service should only handle the messagetypes it needs and leave all other message in the queue. I'm using SQL Server transport for that. Is that doable or do I have to separate the messgetypes by queue?

mookid8000 commented 6 months ago

There's no way to "filter" messages from a queue, so all the messages can potentially end up being received by a Rebus instance consuming from a queue, regardless of the message type.

There's nothing that prevents you from "mixing" message types in a queue, though - the receiver just has to be able to handle all of them.

So, to sum it up: You'll need to send the messages into different queues depending on which Rebus instance is supposed to them.