I'm just getting started with NService bus and I want to know how to filter message when I send them so that they only go to particular subscribers.
For example, lets say I have a database with products that are categorized. My publisher will check the database every N seconds and will send messages when a new product is added to the database.
But each subscriber is only interested in a particular category and assuming that I can get the subscriber to send the category they are interested in, I then would like to only publish messages about products in a particular category to subscribers that are interested in them.
The categories are dynamic, so I can't create different messages for the different categories. So for that reason I assume that all the subscribers have to subscribe to the same published IMessage
.
EDIT: To clear up some confusion, here's another example that's closer to the real thing.
My publisher's job is to notify subscribers about new posts on stackoverflow based on tags. But I don't want the publisher to be querying stackoverflow for tags that no-one is interested in... not to mention to overhead of doing something like that.
So when a subscriber subscribes, they register their interest along with some metadata telling the publisher what posts they are interested in - e.g. posts tagged NServiceBus
.
Now the publisher knows that they have to monitor stackoverflow for new posts tagged NServiceBus
and can start doing just that.
So when there is a new post tagged with NServiceBus
and my publisher goes to notify it's subscribers, I want it to only notify the subscribers that are interested in that tag... and not subscribers that are interested in different tags.
Make more sense?
I'm just getting started on this project, so if I'm going down the wrong road I'd appreciate a heads up and suggestions to use a different set of tools.