8

We have created an Azure function which is set as timer triggered . We want to schedule invoke the same function 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

1
  • 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. Commented Jan 17, 2018 at 11:35

3 Answers 3

7

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Mike, how to do this? I couldn't find guide anywhere for this. Can you please help?
6

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");

    }

Comments

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.

1 Comment

Do you have any further details as to how to do this exactly?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.