Azure WebJobs - No functions found - How do I make a trigger-less job?

Ray picture Ray · Sep 30, 2014 · Viewed 8.4k times · Source

I'm new to Azure WebJobs, I've run a sample where a user uploads an image to blob storage and inserts a record into the Queue, then the job retrieves that from the queue as a signal to do something like resizing the uploaded image. Basically in the code the job uses QueueTrigger attribute on a public static method to do all that.

Now I need a job that just does something like inserting a record into a database table every hour, it does not have any type of trigger, it just runs itself. How do I do this?

I tried to have a static method and in it I do the insert to db, the job did start but I got a message saying:

No functions found. Try making job classes public and methods public static.

What am I missing?

Edit After Victor's answer I tried the following,

static void Main()
{
    JobHost host = new JobHost();
    host.Call(typeof(Program).GetMethod("ManualTrigger"));
}

[NoAutomaticTrigger]
public static void ManualTrigger()
{
    // insert records to db
}

but this time I got InvalidOperationException,

'Void ManualTrigger()' can't be invoked from Azure WebJobs SDK. Is it missing Azure WebJobs SDK attributes?

Answer

Victor Hurdugaci picture Victor Hurdugaci · Sep 30, 2014

If you don't use any input/output attributes from the WebJobs SDK (QueueTrigger, Blob, Table, etc), you have to decorate the job with the NoAutomaticTrigger Attribute to be recognized by the SDK.