I'm exploring my options when introducing Azure Service Bus with MassTransit in a multi-tenant system.
Basically the system consists of several services which some of them are tenant specific whilst some are shared.
- Services keep data internally (tenant data is isolated).
- Each tenant runs the same set of services, just their own instances of them.
- Tenant should never consume each others data.
So far, creating a separate Azure Service Bus Namespace for each tenant seems like the safest option, although it complicates consuming in shared services.
I have considered using the GreenPipe filters but since those operate on the cosnumer level, from what I understand, there would be a considerable number of messages that just reaches the queue and gets discarded. I think however I would like to use a tenant filter nevertheless for extra safety.
I read about the topic filters concept in Azure Service Bus. From what I understand, it operate on the subscription level and the message would not be copied to the queue unless it passes that filter.
Currently, I setup my consumers like this:
cfg.ReceiveEndpoint(host, "customer_update_queue", e =>
{
e.Consumer(() => new YourConsumer());
}
Is there a way to specify a topic subscription filter here?
(I'm also happy to know if I overlook some other option)