1

I want to call another (not timer triggered) azure function from my timer triggered azure function. It compiles but during runtime I get the error:

System.ArgumentException: 'The function 'HelloWorld' doesn't exist, is disabled, or is not an orchestrator function. Additional info: No orchestrator functions are currently registered!'

I reduced it to this tiny code snippet.

    [FunctionName("HelloWorld")]
    public static string HelloWorld([ActivityTrigger] string name, ILogger log)
    {
        return $"Hello {name}!";
    }

    [FunctionName("DownloadLiveList")]
    public async void DownloadLiveList([DurableClient] IDurableOrchestrationClient client, [TimerTrigger("0 0 0 * * *", RunOnStartup = true)]TimerInfo myTimer, ILogger log)
    {
        await client.StartNewAsync<string>("HelloWorld", "Magdeburg");
    }

As I took the idea from the official Microsoft example for that kind of azure function cascading, I've no clue, why the function "HelloWorld" is not registered. After uploading into azure, the function is visible in the azure portal as all other functions from the class.

1 Answer 1

3

Your time trigger function needs to invoke the start function written with Durable Function Framework. Here's a sample:

[FunctionName("Function1")]
public async Task Run([TimerTrigger("0 */1 * * * *")] TimerInfo myTimer, ILogger log)
{
    log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

    var url = "http://localhost:7071/api/Durable_Starter";
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    request.AutomaticDecompression = DecompressionMethods.GZip;

    using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
    using (Stream stream = response.GetResponseStream())
    using (StreamReader reader = new StreamReader(stream))
    {
        var html = reader.ReadToEnd();
        log.LogInformation(html);
    }
}

[FunctionName("Durable_Starter")]
public async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequest req, [DurableClient] IDurableClient starter, ILogger log)
{
    log.LogInformation("C# HTTP trigger function processed a request.");

    string instanceId = await starter.StartNewAsync("Durable_Orchestrator");

    log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

    var checkStatusResponse = starter.CreateCheckStatusResponse(req, instanceId);

    return checkStatusResponse;
}


[FunctionName("Durable_Orchestrator")]
public async Task RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)
{
    var message = await context.CallActivityAsync<string>("HelloWorld", "Thiago");
    log.LogInformation(message);
}

[FunctionName("HelloWorld")]
public string HelloWorldActivity([ActivityTrigger] string name)
{
    return $"Hello {name}!";
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. But the Http-Stuff isn't needed, is it? Durable_Starter can start timer triggered, calls Durable_Orchestrator which calls HelloWorld.
I understood you wanted the opposite. Time Trigger calling Durable Orchestrator

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.