0

My function in my azure webjobs (console app) is doing its job correct and grabbing messages from my queue, but I need a way to control the "time visible" option or the ability to delete the message from the queue once it gets picked up.

Function:

public class Functions
{
    public static void MultipleOutput([QueueTrigger("messages")] MessageQueueItem message, TextWriter log)
    {
        Console.WriteLine("Item Found [{0}]! Process starting", message.VideoId);

        ResolverAgent agent = new ResolverAgent(message);
        agent.Process();
    }
}

I know that when you access a queue programmatically, it's a parameter you pass in. However I'm not accessing it that way. What is the correct way of doing this using the azure sdk in a webjobs application?

Edit:

The visiblity option is the time from when a job picks up a message from the queue and the time the message reappears back on the queue (because the process hasn't finished yet and assumes it failed). In my case, the default 30 seconds is not enough time for the process to run all the way through.

Reference (section: How to: Leverage additional options for de-queuing messages): http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues/

Sherman Szeto
  • 2,325
  • 4
  • 18
  • 26

1 Answers1

1

Is your function is still processing the message, the webjobs SDK will update the lease so another function doesn't pick it up.

Victor Hurdugaci
  • 28,177
  • 5
  • 87
  • 103
  • So theres no need to set the visbilitytimeout then correct? – Sherman Szeto Mar 08 '15 at 21:02
  • I don't think Victor is correct. I tested this case and the message will be visible again and a new function will pick it up. You have to update the message visible time by yourself. And also: "This saves the state of work associated with the message, and gives the client another minute to continue working on the message. " from this link: https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues/ – Alex Yang Nov 13 '15 at 22:30
  • @AlexYang I think the article you linked to only discusses using queues the "traditional" (if there is such a thing in Azure) way. Using WebJobs, you are not required to implement that code yourself. The article below does a good job of describing the basics as well as providing code samples that show how additional control over the queue can be achieved: https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-webjobs-sdk-storage-queues-how-to/ – SvenAelterman Feb 24 '16 at 05:43