I have a Python script that gets data from Azure Event Hub and saves in into an Azure Cosmos DB database. I currently run this script on a local machine but I'd like to run the script in my companies Azure account. What Azure service could / should I use to run this script permanently?
By 'permanently' I mean that I don't want to use any kind of triggers or other options provided by the Azure Function App because I want it to run non-stop.
CodePudding user response:
Usually Azure functions can run continuously until the messages are stopped.
Else as you mentioned apart from functions, We can run a script non stop with help of webjob in Azure App service. Here we will be having two types of webjob:
Triggered: This will run the script based on a trigger.
Continuous: This will run until the job is completed.
Continuous WebJob runs on all instances that the web app runs on. You can optionally restrict the WebJob to a single instance.
Also our code will be deployed under \site\wwwroot\app_data\Jobs\Continuous
.
Find the below screenshot for its differences:
Below are the steps about the creation:
Azure Portal -> App Service Web App.
In the left pane we will find WebJobs.
Add a new WebJob and attach the script under File Upload.
Check for the rest of the configurations from MS Docs.