Best practice for initiating Azure Function from another Azure Function

Viewed 8037

I have a scenario where I have 2 functions, let's say Function A and Function B.

Currently, Function A and Function B both have the same logic for logging failed activity where metadata is logged to Table Storage and JSON to Blob Storage.

Edit --> Function A and Function B are in two different Function Apps (intended). Function A is on a Consumption plan and Function B is on an App Service plan.

First question - would it make sense to create a Function C and take the failed activity logging logic from both A and B and put it in C?

This removes code duplication and the logic is in one place which is easier to manage.

Second question - what would be the best way to call Function C from A and B?

I have read here that it is best to use a Storage Queue or Service Bus for cross communication between Functions. The problem I have is - the JSON I need to store will in most cases exceed 256KB so I can't put it on a queue to trigger a Function.

So, could Function C be a HTTP trigger and I send a request containing all of my relevant information needed to log via HTTP from Function A and B?

Is there any reason not to do this?

Many thanks.

2 Answers
Related