Just an implementation of @Baywet's answer which I found here by @dprothero.
In your Program.cs
file's Main
Method, while registering Microsoft.Azure.WebJobs.JobHostConfiguration
provide an implementation of INameResolver
to NameResolver property like
static void Main()
{
var config = new JobHostConfiguration
{
NameResolver = new QueueNameResolver()
};
//other configurations
}
and the QueueNameResolver
class is like
public class QueueNameResolver : INameResolver
{
public string Resolve(string name)
{
return ConfigurationManager.AppSettings[name].ToString();
}
}
Now add a key in <appSettings>
section of App.config
file like
<appSettings>
<add key="QueueName" value="myqueue" />
</appSettings>
and use it like
public async Task ProcessQueueMessage([ServiceBusTrigger("%QueueName%")] BrokeredMessage receivedMessage)