1

I am using Multiple TimerTrigger Functions as below

[FunctionName("Fun1")]
public async Task RunAsync([TimerTrigger("%ScheduleExpression%")] TimerInfo myTimer, ILogger log)
{
      log.LogInformation($"Fun1 Timer trigger function executed at: {DateTime.Now}");
}

[FunctionName("Fun2")]
public async Task RunAsync([TimerTrigger("%ScheduleExpression%")] TimerInfo myTimer, ILogger log)
{
      log.LogInformation($"Fun2 Timer trigger function executed at: {DateTime.Now}");
}

Likewise, I have a total of 5 functions. I want to run these in a sequence one after another. Because each function will save some data into individual tables and every next function will use the data stored by the previous function.

Is there any way to achieve this?

Unknown Coder
  • 1,510
  • 2
  • 28
  • 56
  • 1
    Not sure why you want anything except the first function to run on a timer since the first one triggers the second and so on. I think you probably want to look at Azure Logic Apps though, that will let you build a workflow. – DavidG Jun 21 '22 at 17:35
  • @DavidG Sorry, I didn't get that. Do you mean to say a Schedule is required only for 1st App? – Unknown Coder Jun 21 '22 at 17:38
  • 2
    If you want all your functions to run in sequence, only the first function need a timertrigger. then you can call the other function. You could also chain function by putting messages in queue. Durable function could work as well. – Thomas Jun 21 '22 at 21:05

1 Answers1

0

I would suggest you use Azure Durable Functions with the Function chaining pattern and in this way, you can execute your functions sequentially. You trigger the durable function and then the chain will execute.

See documentation here: https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview?tabs=csharp#chaining

cITsecure
  • 147
  • 6