Actually, you could write server processing methods in a Function. When a webjob running, it will traverses all the methods in your function.
You could refer to the following code to dynamic trigger multiple queues.
In Program:
static void Main()
{
var host = new JobHost(new JobHostConfiguration
{
NameResolver = new QueueNameResolver(),
});
host.RunAndBlock();
}
In Function:
public class Functions
{
public static void ProcessQueueMessage([QueueTrigger("%queuename1%")] string message, TextWriter log)
{
log.WriteLine(message);
Console.WriteLine("success");
}
public static void ProcessQueueMessage1([QueueTrigger("%queuename2%")] string message, TextWriter log)
{
log.WriteLine(message);
Console.WriteLine("success2");
}
}
In QueueNameResolver:
public class QueueNameResolver : INameResolver
{
public string Resolve(string name)
{
return ConfigurationManager.AppSettings[name].ToString();
}
}
In App.config:
<appSettings>
<add key="queuename1" value="queue"/>
<add key="queuename2" value="myqueue"/>
</appSettings>
No matter you add message to queue or myqueue, it will always listen to them.