Azure / azure-functions-servicebus-extension

Service Bus extension for Azure Functions
MIT License
65 stars 35 forks source link

Question: create listener at runtime? #219

Open peterbergman opened 1 year ago

peterbergman commented 1 year ago

Hi, I've been using the Microsoft.Azure.WebJobs.Extensions.ServiceBus-package to setup methods that act as triggers for ServiceBus subscriptions and it works great. However, the current setup only seem to allow for defining your triggers using the ServiceBusTrigger-attribute where queue/topic name are defined using compile time constants. I saw that you can also implement your own name resolver to get some more flexibility. But I wonder, is it possible to also register triggers through the DI somehow to avoid befing forced to use the attribute?

For example, it would be nice if I could do something like this (assuming that ITrigger is an interface from the package)

services.AddSingleton<ITrigger, MyCustomTrigger>();