I am currently working on a solution where a webjob monitors a service bus queue. This works great but it needs to be easily adaptable to manage any number of queues just be changing a list of queues in the config.
Currently I can see that I can do this:
public static void ProcessQueueMessage1([ServiceBusTrigger("queue1")] BrokeredMessage message, TextWriter log)
{
}
And for another queue I would need to add another method:
public static void ProcessQueueMessage2([ServiceBusTrigger("queue2")] BrokeredMessage message, TextWriter log)
{
}
Obviously, I don't want to add a new method every time I need to watch a new queue.
How would I go about using a WebJob to monitor any queue who's name is in my config? I mean a list of queue names not just one in config.
For example, I know I can use a QueueNameResolver to do the following:
public static void ProcessQueueMessage([ServiceBusTrigger("%nameInCofig%")] BrokeredMessage message, TextWriter log)
{}
But I really want to process a list of queue names with only one WebJob ProcessQueueMessage method.
I have been searching for ages and am nearly at the point of using a WorkerRole instead.
Any help would be great.