Particular / NServiceBus.Transport.AzureServiceBus

Azure Service Bus transport
Other
22 stars 19 forks source link

Ability to provide the ServiceBusClient via Configuration #563

Open danielmarbach opened 2 years ago

danielmarbach commented 2 years ago

Similar to how we allow to specific the client in SQS or with CosmosDB I would appreciate it if the client could be specified from the outside when the transport is set up and optionally even with dependency injection.

Same applies for the ServiceBusAdministrationClient usage.

With that enabled, it would become super simple for people to use alternative ways to connect to Azure Service Bus. Of course there are some side effects of this approach because for example the transport transaction mode has implications on how the ServiceBusClient needs to be configured. Such a configuration model would need to validate the correct settings during startup time.

danielmarbach commented 2 years ago

Did some more light research around this. I think properly implementing this would be tricky. When using SendsWithAtomicReceive we require a ServiceBusClient per message receiver. Exposing the configuration of those clients might not be trivial because it would require having dedicated factory methods for "the default client" and "a number of pump clients" plus a lot of validation that the clients are properly configured.

Exposing such a configuration mechanism could quickly be overwhelming to any customers because it goes way beyond the default client configuration that assumes a "singleton" client. The admin client is definitely simpler because that is and will remain to be a singleton.