Read request payload inside timer-trigger azure durable function

508 views Asked by At

I have implemented an Azure durable function which can be triggered using a timer trigger. Also this same azure durable function needs to trigger manually as well. I was able to trigger the timer trigger manually as explained in the official documentation here.

My azure durable function looks like below.

[FunctionName("Weekly_HttpStart")]
    public static async Task HttpStart(
        [TimerTrigger("0 0 10 * * 3")] TimerInfo timerInfo,
        [DurableClient] IDurableOrchestrationClient starter,
        ILogger log)
    {             
        string instanceId = await starter.StartNewAsync("ProcessWeeklyBatch", null);
        log.LogInformation($"Started 'ProcessWeeklyBatch' orchestration with ID = '{instanceId}'.");            
    }

The issue I’m having now is I need to pass parameters to this timer triggering azure durable function when I triggering it manually.

According to the official documentation here, we can add body parameters to the request. (as below image), But I don’t see any way to read them inside the azure function.

enter image description here Has anybody come across how to read request payload inside timer triggering azure durable functions?

1

There are 1 answers

0
Grekkq On

I'm not sure why would you pass something to a timer job but a workaround would be to create separate functions one HTTP-triggered and one Timer-triggered that just share underlaying logic like in this example.