1
votes

I was doing a simple "Hello world" type logic app in Azure. I got it working, now I want to stop it. I don't see any enable/disable button on the timer the triggers it to run. Do I have to delete the timer? No way to pause it?

enter image description here

Looks like it needs to be done at the function level. Open the "logic app", find the function, click on the elipses ... and select "Disable".

enter image description here

So this raises a question to me. Is the function the timer itself? What if I needed two timers on the same piece of code? Can I not have one C# function/program that has multiple triggers?

1
A deployed instance of Azure function can have multiple functions in it like multiple timer triggered, queued triggered e.t.c. See this for reference which has multiple functions of Http, queue and timer in same instance. Another way (apart from you already mentioned by UI) is by application configuration settings; add the AzureWebJobs.<<Your function name>>.Disabled setting with true valueuser1672994

1 Answers

1
votes

A little unclear on terminology.

Is it a Timer Trigger Function, or a Recurrence triggered Logic App that calls an Azure Function?

  • For Timer Triggered Function you already posted the answer, that's how you disable it. You could also click on the Function name, go to it's Overview page and see a Disable button if you want to waste some time.
  • For a Logic App you have a Disable button on Overview page of that app: enter image description here

Is the function the timer itself?

In this context yes.

What if I needed two timers on the same piece of code? Can I not have one C# function/program that has multiple triggers?

A Function can have following binding:

  • one trigger
  • many output
  • many input

See Both http and timer trigger in Azure Function for how to reuse code. But know that if you deploy following code to your Function App, when you look at Portal you'll see two Functions HttpTriggerFunc and TimerTriggerFunc. This matters more from a Scalability/Deployment etc pov than development.

    public class EhConsumerFunctions {
        private void processEvent(String request, final ExecutionContext context) {
         // process...
        }

        @FunctionName("HttpTriggerFunc")
        public void httpTriggerFunc(
           @HttpTrigger(name = "req", methods = {HttpMethod.GET}, authLevel = AuthorizationLevel.ANONYMOUS)
           HttpRequestMessage<Optional<String>> req,
           final ExecutionContext context) {
           processEvent(req.getBody().get(), context);
       }

       @FunctionName("TimerTriggerFunc")
       public void timerTriggerFunc(
        @TimerTrigger(name = "timerRequest", schedule = "0 */5 * * * *") String timerRequest,
        final ExecutionContext context) {
           processEvent(timerRequest, context);
       }

    }