7

We have created an azure function which is set as timer triggered . We want to schedule invoke the same func012.tion in different time intervals. i.e

1) Every Week Friday with certain set of input parameters 2) Every Month Last day with certain set of input parameters

Thanks

user3527063
  • 479
  • 1
  • 5
  • 17
  • Can you give some code examples of the different input parameters? It sounds like you might need two different functions if you want to invoke them at different times with different inputs. – Chris Jan 17 '18 at 11:35

3 Answers3

6

The timer trigger can only take a single cron schedule.
Do this as a union of schedules. Have multiple timer triggers - each with a part of the schedule (Friday vs. Monday) and then each can call to a common function passing the respective parameters.

Mike S
  • 3,058
  • 1
  • 22
  • 12
4

Here is a sample

    public async Task FunctionLogicOnTimer(string parameter)
    {
       // ...
       // ...
       
    }

    [FunctionName(nameof(MyFunc1))]
    public async Task MyFunc1(
        [TimerTrigger("%MyTimerIntervalFromSettings1%")] TimerInfo timer, ILogger log)
    {
       // ...
       // ...
       FunctionLogicOnTimer("I am triggered from MyFunc1");
    }
    
    [FunctionName(nameof(MyFunc2))]
    public async Task MyFunc2(
        [TimerTrigger("%MyTimerIntervalFromSettings2%")] TimerInfo timer ILogger log)
    {
       // ...
       // ...
       FunctionLogicOnTimer("I am triggered from MyFunc2");

    }
Athadu
  • 854
  • 7
  • 13
1

Functions take a single scheduling configuration. Therefore you can create Scheduler/Logic app on different days to trigger your function.

Alternatively, create two functions (FuncitonA_FridayJob,FunctionA_MondayJob) with a specific scheduling.

BumbleBee
  • 129
  • 9