Azure / azure-functions-servicebus-extension

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

Question : how to get the message in dependency injection ? #115

Closed jonathanantoine closed 3 years ago

jonathanantoine commented 3 years ago

Hello,

I would like to initialize some transient services based on the content of the received message. Using an http trigger, I can do it using the IHttpContextAccessor. Is there some equivalent (or workaround) regarding service bus trigger ?

Thanks a lot !

alrod commented 3 years ago

There is not really an equivalent of IHttpContextAccessor for ServiceBus trigger. You can get metadata directly: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=csharp#message-metadata

What so you want to achieve with the "transient services"?

ghost commented 3 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.