7
votes

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?

1

1 Answers

13
votes

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.