Is it possible to get the queue name in a service bus triggered Azure Function?
I know it is possible if the QueueName or TopicName+SubscriberName are hard coded. In that case I can make a const string and use it inside the function. However my service bus trigger gets the name from the settings using "%ServiceBusSettings:QueueName%"
, "%ServiceBusSettings:TopicName%"
and "%ServiceBusSettings:SubscriberName%"
.
How to get the Queue or Topic+Subscriber name in this configurable case?
[FunctionName("topic-and-subscriber-function")]
public async Task Run(
[ServiceBusTrigger("%ServiceBusSettings:TopicName%", "%ServiceBusSettings:SubscriptionName%", Connection = "ServiceBusSettings:ServiceBusConnection")] Message message,
ILogger log, MessageReceiver messageReceiver)
{
// Get TopicName and SubscriberName
}
[FunctionName("queue-function")]
public async Task Run(
[ServiceBusTrigger("%ServiceBusSettings:QueueName%", Connection = "ServiceBusSettings:ServiceBusConnection")] Message message,
ILogger log, MessageReceiver messageReceiver)
{
// Get QueueName
}