The Windows Azure Web Jobs SDK is a framework that simplifies the task of adding background processing to web sites. You can get more details about it by reading the Getting Started guide or Scott Hanselman’s introduction. Scott describes the Web Jobs SDK very well: “minimal ceremony for maximum results”. The Windows Azure Web Jobs SDK (codename SimpleBatch) is a very simple framework but provides some powerful binding capabilities.

The most simple advanced binding is the blob name placeholder. It allows you to express the intent of listening to blobs in a specific container that match a specific pattern. For example, you are only interested in blobs that end with “.jpeg”, or only blobs that are prefixed with “input-” and have the extension “.txt”, or you just want the name of the blob and you do not want to bind to an Azure SDK type.

The function above will only be triggered by blobs in the “images” container that have the extension “.jpeg”. The value of {name} placeholder from the input will replace the {name} placeholder in the output. For example, if the input blob is “images/img123.jpeg” then {name} is “img123″ and the output image is “thumbnails/img123.jpg”.

The name placeholders can be also be used to read and write to and from the same container without triggering an infinite loop (the output retriggers the function).

The function above reads from the “images” container and writes back in the same container. However, it is only triggered by blobs suffixed with “_full.jpeg” and writes blobs that end with “_thumb.jpeg”. For example, if the input blob is “images/full_img123.jpeg”, then {name} is “img123″ and the output image is “images/thumb_img123.jpeg”.

The placeholder binding is not limited to blob output only. If you need the value of {name} in the code, you can get it by adding a parameter named “name” to your function.

When a new order arrives, we are going to get the Order message from a queue and create a blob (an invoice) with the name equal to the order id. One approach is to use the IBinder interface to bind the output blob and specify the name that equals the order id. The better and simpler approach (SimpleBatch) is to bind the blob name placeholder to the queue message properties:

The {OrderId} placeholder from the blob name gets its value from the OrderId property of the newOrder object. For example, newOrder is (JSON): {"CustomerName":"Victor","OrderId":"abc42"} then the output blob name is “invoices/abc42″. The placeholder is case-sensitive.

Yes I’ve figured that out :). But the question was actually how would I implement let’s say a continuous while loop? So far I’ve only seen samples with a trigger pattern.

Thx

Victor

Hi Lucian,

Unfortunately, the WebJobs SDK does not support sqldb. For now, you can only bind to Azure Storage entities.

Lucian

Hi, A side question. :) In a cloud service worker I can create a simple while loop which does something on a regular basis — in my case some sqldb processing. How can I simply achieve the same with WebJobs SDK?