WebJobs QueueTrigger not working?

I’ve just spent quite some time trying to figure this out, you read many good things about WebJobs, and as luck would have it, you’re in the market for some nifty backend processing whenever something is added to a queue, so now seems a good time to take a proper look.

So, right click on my web app, and select ‘Add, New Web Jobs’ and create a new WebJob project.

image

Then start adding my code:

class Program
{
    static void Main()
    {
        var host = new JobHost();
        host.RunAndBlock();
    }

    public static void ProcessQueueMessage([QueueTrigger("myqueue") string msg, TextWriter log)
    {
        log.WriteLine("Got msg {0}!", msg);
    }
}

This is the file that opens up and is initially visible.

So far so looking good.

Run and it says:

image

Yay.

So I add a message to queue.

Nothing. The message stays there the webjob stays quiet.

The clue is in the console:

image

Functions???

Turns out there is another class called ‘Functions’ in the project (in it’s own Functions.cs) that there is no mention of, which is where the code should be. Specifically, Functions is a public class, I can make Program a public class and it’ll pick up my proper ProcessQueueMessage, but otherwise it stays hidden.

Print | posted @ Thursday, January 29, 2015 4:45 PM

Comments on this entry:

Gravatar # re: WebJobs QueueTrigger not working?
by Athena at 1/30/2015 7:24 AM

Nice, thx for information.
Obat Tradisional Darah Rendah Ampuh
Gravatar # re: WebJobs QueueTrigger not working?
by Greg at 2/16/2016 4:43 PM

Thank you for posting this - spent quite a bit of time pulling my hair out on this exact issue.
Gravatar # re: WebJobs QueueTrigger not working?
by Michael Harper at 8/15/2016 9:59 AM

Thanks, this was hurting me!
Post A Comment
Title:
Name:
Email:
Comment:
Verification: