Age-old scenario. Incoming API needs to be directed to several different end-points for processing.
For example this can come handy when re-writing old monolithic applications and transforming into new distributed solutions while still keeping old front API for backward compatibility with the existing clients.
Luckily (if asynchronous communication fits your use case) with Azure Service Bus topics this can be done in minutes. :)
Something like below:
If interested to try this scenario please see below.
Service Bus and Topic Setup
First create Azure Service Bus Namespace.
Now go to created Service Bus Namespace and create a topic
Then drill down into topic and create two subscribers
Create second subscriber the same as the first just name it trexsubscriber2.
Now topic should look like this.
Lets create Azure functions now
Select Azure Service Bus Topic as Azure Function trigger
Install Service Bus Topic Extension
After Service Bus Topic extension is installed configure Azure Function Trigger by selecting "New" then selecting Service Bus Names space you previously created and setting the name of topic and the subscriber.
Function creation has been completed. You can review and update your configuration by clicking the angle in the right side as shown below.
Now create second function and bind it to the second topic you have created.
Both functions should look like below.
You can use Visual Studio to Submit messages to Topic.
Note: if you have corporate firewall you may have an issue at this step - there any many workarounds - for example deploy your code that submits messages into topic into Azure (e.g. you can use Azure Bots for this - just for fun).
But simplest method is probably below
Now you can see that each submitted message is processed by both Azure functions.
Go to "Monitor" tab for each function. (Note: it takes some time for monitoring messaged to appear)
Subscriber 1 Function:
Subscriber 2 Function:
You are done!
If you want to add more complex processing into those Azure function just create a function project in Visual Studio and deploy into created functions.