Reputation: 2329
I have an azure function that reads messages from a service bus queue and sends a request to an API with the message. This works fine.
Sometimes the API may be unreachable due to factors not in our control. Is there a way to stop the Azure function from recieving updates from the queue or stop execution altogether till it is restarted ideally via an api call or via an environment variable ?
Upvotes: 2
Views: 2080
Reputation: 13568
Yes, you can use an environment variable. For example, if you have an environment variable named TIMER_DISABLED
, you can reference that setting in the disabled
function property like so:
{
"disabled": "TIMER_DISABLED",
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "*/5 * * * * *"
}
]
}
The function will then only be enabled if the app setting value is truthy, e.g. equal to 1 or "true".
Upvotes: 6