You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature related to a problem? Please describe.
Azure Service Bus allows entities to be organized in hierarchies on the same namespace. This can be handy to group for example tenant related queues and topics together.
So, for example, you can have a hierarchy like this
To achieve that, there are a number of "quirks" required on an endpoint configuration level.
The trick is to override the local queue address to contain the hierarchy and make sure the routing table contains the hierarchy too. For separate audit and error queues, you also need to make sure the audit and error queues are configured accordingly.
vartenantIdentifier= Environment.GetEnvironmentVariable("TenantIdentifier");varendpointConfiguration=new EndpointConfiguration($"Endpoint1");// Override the local address
endpointConfiguration.OverrideLocalAddress($"{tenantIdentifier}/Endpoint1");
endpointConfiguration.EnableInstallers();// Override the diagnostic path to have unique paths for endpoint for demo purposes
endpointConfiguration.SetDiagnosticsPath($".diagnostics/{tenantIdentifier}");// configure tenant specific error queue
endpointConfiguration.SendFailedMessagesTo($"{tenantIdentifier}/error");// configure tenant specific audit queue
endpointConfiguration.AuditProcessedMessagesTo($"{tenantIdentifier}/audit");// switch the topology to have a bundle per tenant// make sure the subscription doesn't contain illegal characters in the pathvartransport=new AzureServiceBusTransport(connectionString){Topology= TopicTopology.Single($"{tenantIdentifier}/bundle1"),SubscriptionNamingConvention=subscription => subscription.Replace($"{tenantIdentifier}/",string.Empty)};varrouting= endpointConfiguration.UseTransport(transport);// Carefully override each command routing to go to the right destination
routing.RouteToEndpoint(typeof(Command1),$"{tenantIdentifier}/Endpoint2");
There is currently one downside to this approach. You have to be careful to configure the tenant identifier on all the sends; otherwise you might send to some "central" queue.
SQS as the concept of QueueNamePrefix that is applied on a transport level, which makes "isolating" the same endpoints on the same SQS account a breeze and doesn't require changing the routing tables, error and audit queues.
Describe the requested feature
Add a possibility to leverage hierarchies to facilitate grouping of the same endpoints within a hierarchy.
Describe the feature.
Is your feature related to a problem? Please describe.
Azure Service Bus allows entities to be organized in hierarchies on the same namespace. This can be handy to group for example tenant related queues and topics together.
So, for example, you can have a hierarchy like this
tenanta/endpoint1
tenanta/endpoint2
tenantb/endpoint1
tenantb/endpoint2
To achieve that, there are a number of "quirks" required on an endpoint configuration level.
The trick is to override the local queue address to contain the hierarchy and make sure the routing table contains the hierarchy too. For separate audit and error queues, you also need to make sure the audit and error queues are configured accordingly.
There is currently one downside to this approach. You have to be careful to configure the tenant identifier on all the sends; otherwise you might send to some "central" queue.
SQS as the concept of QueueNamePrefix that is applied on a transport level, which makes "isolating" the same endpoints on the same SQS account a breeze and doesn't require changing the routing tables, error and audit queues.
Describe the requested feature
Add a possibility to leverage hierarchies to facilitate grouping of the same endpoints within a hierarchy.
Describe alternatives you've considered
None
Additional Context
Sample implementation
TenantsWithAsbUsingHierarchy.zip
The text was updated successfully, but these errors were encountered: