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:
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);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…