Microsoft Azure WebJobs SDK 0.4.0 Beta Preview Released

Microsoft Azure WebJobs SDK 0.4.0 beta preview has been released with Async support, ability ot handle poison messages in Azure queus, better polling logic for Azure queues, fast path notifications for queues, configuration options for queue polling in addition to several dashboard performance improvements and bug fixes.

With the help of Async support, you will be able to use async/wait in your functions to enable them to return task. Moreover, distinct functions within a single JobHost are executed in parallel. For example, if you have 2 functions listening on different Queues, then they would be executed in parallel.

class Program
 {
 static void Main()
 {
 JobHost host = new JobHost();
 host.RunAndBlock();
 }
 public async static Task HelloWorldFunctionAsync(
 [QueueTrigger("inputqueue")] string inputText,
 [Blob("output/output.txt")] TextWriter output)
 {
 await output.WriteAsync(inputText);
 }
 }

The latest release enable developers to automatically move the message to a poison queue by binding a function to QueueTrigger(“queuename-poison”).

class ProcessPoisonMessages
 {
 static void Main()
 {
 JobHost host = new JobHost();
 host.RunAndBlock();
 }
 public async static Task ProcessQueue(
 [QueueTrigger("inputqueue")] string inputText,
 [Blob("output/output.txt")] TextWriter output)
 {
 await output.WriteAsync(inputText);
 }
 public static void ProcessPosionQueue(
 [QueueTrigger("inputqueue-poison")] string inputText)
 {
 //Process the poison message and log it or send a notification
 }
 }

“Without the WebJobs SDK, connecting and running background task requires a lot of complex programming. The SDK provides a framework that lets you write a minimum amount of code to get common tasks done,” said Pranav Rastogi, Program Manager, Azure, WebJobs and ASP.NET.

The latest release include a new polling strategy as it implements a random exponential back-off algorithm to reduce the effect of idle queue polling on storage transaction costs. Moreover, the SDK has been rewritten to poll every ~8 seconds instead of ~2 seconds as introduced in previous (0.3.0) beta release.

READ  Microsoft Updated on Azure Storage Service Interruption

While MaxPollingInterval provides the longest period of time to wait before checking for a message to which defaults to 10 minutes, MaxDequeueCount defaults to 5 minutes when the queue message is moved to a poison queue.

static void Main()
 {
 JobHostConfiguration config = new JobHostConfiguration();
 config.Queues.MaxDequeueCount = 3;
 config.Queues.MaxPollingInterval = TimeSpan.FromMinutes(20);
 JobHost host = new JobHost(config);
 host.RunAndBlock();
 }

Following packages are renamed

Microsoft.Azure.Jobs -> Microsoft.Azure.WebJobs
Microsoft.Azure.Jobs.Core -> Microsoft.Azure.WebJobs.Core
Microsoft.Azure.Jobs.ServiceBus -> Microsoft.Azure.WebJobs.ServiceBus

Namespace Changes

Microsoft.Azure.Jobs -> Microsoft.Azure.WebJobs

ConnectionString Changes

AzureJobsStorage -> AzureWebJobsStorage
AzureJobsDashboard -> AzureWebJobsDashboard

New Improvements

  • Faster dashboard index processing
  • Dashboard data out of date warning
  • Display of dashboard indexing errors in the About page

Rastogi in his recent blog post also examined the features introduced in 0.3.0 beta such as triggers, bindings, hosting, WebJobs, functionexecution details, invoke & replay in addition to blobs search. He also provided a comprehensive coverage of all the known issues when migrating from 0.3.0-beta to 0.4.0-beta.

In order to work with WebJobs SDK, you need to download it from the NuGet gallery and install using the using the NuGet Package Manager Console as shown below

 Install-Package Microsoft.Azure.WebJobs -Pre

In order to work with Microsoft Azure Service Bus triggers, you need to provide the following command

 Install-Package Microsoft.Azure.WebJobs.ServiceBus -Pre

Leave a Reply

Your email address will not be published.