Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
193 views
in Technique[技术] by (71.8m points)

Pause/Disable a timer on an Azure Logic App function - difference between the trigger and the function?

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?

question from:https://stackoverflow.com/questions/65906855/pause-disable-a-timer-on-an-azure-logic-app-function-difference-between-the-tr

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...