[FunctionName(“RequestImageProcessing”)]
public static async Task RequestImageProcessing([HttpTrigger(WebHookType = “genericJson”)]
HttpRequestMessage req)
{
// return from this Azure Function immediately
using (var client = new HttpClient())
{
string anotherFunctionSecret = ConfigurationManager.AppSettings[“GenerateCard_secret”];
// change the RequestUri of the request to another Azure Function’s
// public URL, providing the secret code, stored in app settings
// with key ‘GenerateCard_secret’
req.RequestUri = new Uri(req.RequestUri.AbsoluteUri.Replace(
req.RequestUri.PathAndQuery, $"/api/GenerateCard?code={anotherFunctionSecret}"));
// don't 'await' here. Simply send.
client.SendAsync(req);
// wait a little bit to ensure the request is sent. It will not
// send the request at all without this line, because it would
// terminate this Azure Function immediately
await Task.Delay(500);
}
}
[FunctionName(“GenerateCard”)]
public static async Task GenerateCard([HttpTrigger(WebHookType = “genericJson”)]
HttpRequestMessage req)
{
// handle the request in a usual way
await Worker.DoWorkAsync(req);
}