I have a system that posts messages to an Azure Service Bus topic. The topic has multiple subscribers and I am writing a webJob to process the messages.
When I care a new WebJob project in Visual Studio, I get a class called 'Functions.cs', which has code to check a queue. I have updated the code to check a subscription within a topic:
public static void ProcessTopicMessage([ServiceBusTrigger("topic-name", "subscription-name")] string message, TextWriter log)
{
// Processing goes here
}
The topic has multiple subscriptions, which I need to monitor and then perform different actions for each message that is received. This will involve connecting to third-party services through API's, a different API for each subscription.
Example:
topic-name
subscription-1 // Perform action #1
subscription-2 // Perform action #2
subscription-3 // Perform action #3
...
My question is: Should I write a separate WebJob for each subscription or should I add additional methods into the 'Functions.cs' class?
I wonder if the performance will reduce if I have multiple methods in the same WebJob and if I need to make the methods asyncronous.