I'm in the process of migrating a couple of Jobs that were previously scheduled and run through Quartz.Net to Azure Webjobs.
Using Quartz.Net allowed me to have all the (very compact) Job Classes in the same project as the console program entry point initializing the scheduler.
Now I would like to retain that structure without having to create a discrete console application project for each and every web job.
Is there currently any way to configure a command line argument for continuous web-job that would allow to branch internally to the correct job depending on the command line argument?
To pass parameters to the WebJob you need to go to the scheduled job (in the management portal) and update the url that is used to invoke the triggered WebJob. Basically you just need to add ? arguments={your arguments} to the end of the url. These arguments are passed as command line arguments to your executable.
Azure WebJobs are deprecated, but still in use. They are being phased out in favor of Azure Functions. Azure Functions is a more up-to-date and feature rich service which offers a greater degree of flexibility and control.
Summary. Azure Functions offers more developer productivity than Azure App Service WebJobs does. It also offers more options for programming languages, development environments, Azure service integration, and pricing. For most scenarios, it's the best choice.
In Azure WebJobs one way to do this is to create a script file for each WebJob with the command line arguments: MyApplication.exe arg1 arg2
.
Another would be to select the method to run by the current WebJob name which you can get from the environment variable WEBJOBS_NAME.
For triggered WebJobs there is support for command line arguments (per run) in the API but it is still unsupported by the Azure portal: https://github.com/projectkudu/kudu/wiki/WebJobs-API#invoke-a-triggered-job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With