0

I have 2 subscriptions to a Azure service bus topic. Both subscriptions receive messages in parallel and I have 2 Service Bus input triggered azure functions to process the messages.

Azure service bus Topic

--Subscription 1 -> Azure function 1

--Subscription 2 -> Azure function 2

But I have a scenario where, it would be better if my Azure function 2 picks up the messages after Azure function 1 has finished processing the message. One solution is to send the messages from Azure function 1 to a new topic and let Azure function 2 receive from the new topic. Other than this, is there any other better solution to handle this ?

wickjon
  • 900
  • 5
  • 14
  • 40
  • The solution you are describing is what I have seen the most for your scenario, and I think it is the best approach, not adding this as answer yet, in case someone comes with something better – Jdresc Sep 30 '21 at 04:45

2 Answers2

0

What you mentioned is the easiest solution but you can also look into Durable functions. You will have to do more work but its meant for chaining functions which I think is your requirement.

https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-sequence?tabs=python

Bagira
  • 2,149
  • 4
  • 26
  • 55
0

Agree with your solution that the easier way is to publish to a new topic from Function 1. This will work as the payload required is same for Function1 and Function2.

We faced a similar situation where we wanted Function1 to be completed before Function2 is processed. The payloads were different. What we ended up doing is adding a condition in Function2 to check if Function1 has been completed and if not retry the message again after 5mins. Did this using the Lock-Expiry retry mechanism.

hybrid
  • 1,255
  • 2
  • 17
  • 42