Skip to Content
Hands-On Azure for Developers
book

Hands-On Azure for Developers

by Kamil Mrzygłód
November 2018
Intermediate to advanced
606 pages
15h 7m
English
Packt Publishing
Content preview from Hands-On Azure for Developers

Calling a job manually

If you would like to trigger a job manually, you can use the [NoAutomaticTrigger] attribute to tell a host that this particular function is not triggered automatically. Here, you have an example of the one I created and named Manual.cs:

using System.IO;using Microsoft.Azure.WebJobs;namespace MyFirstWebJobWebJobsSDK{    public class Manual    {        [NoAutomaticTrigger]        public static void ManualFunction(            TextWriter logger,            string value)        {            logger.WriteLine($"Received message: {value}");        }    }}

Now let's see what happens if you call it from the main point of your program:

using Microsoft.Azure.WebJobs;namespace MyFirstWebJobWebJobsSDK{    class Program    {        static void Main()        {            var config = new JobHostConfiguration(); var host = new JobHost(config); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementing Azure: Putting Modern DevOps to Use

Implementing Azure: Putting Modern DevOps to Use

Florian Klaffenbach, Oliver Michalski, Markus Klein, Mohamed Wali

Publisher Resources

ISBN: 9781789340624Supplemental Content