After writing my earlier post on creating a simple WebJob to upload the Failed Request Tracing logs automatically to Windows Azure Blob Storage account, I was discussing this with the awesome development team of the WebJob SDK, Amit Apple, and Mike Stall. And, the outcome is, getting my sample modified to use the awesome WebJobs SDK that eases a lot of tasks. And there is more to it – cool Azure Jobs Dashboard with your Windows Azure Web sites giving you a cool dashboard of your WebJobs messages getting processed.

With the WebJobs SDK, there is automatic way of calling certain functions. You can check Scott’s blog where he have used a function that just monitors his Azure Blob Storage account for an new blob to be created, and process that image, and push it to his Azure Blob Storage account itself. The code he has written is very less, just one function, and wrapping that inside an application with the WebJobs SDK. If you notice his function, he used attributes [BlobInput], and [BlobOutput]. However, in my case, for the example that I was trying – to push the files from file system to the Azure Blob storage, I need some thing like [FileInput] which isn’t available, but WebJobs SDK seems to give custom ways to hook in functions to help with the interaction with the Azure Blob Storage account. I’ve modified my function that uploads the file as below. I also call this Upload function from another function.

If you notice, from the UploadFileToBlob() which I’m calling from my FileSystemWatcher callback, I’m not doing any single bit of code to upload the blob to the Azure Blob Storage, I just call another function via the _host (of type Jobhost), and pass the parameter name, path, and the boolean, WebJobs SDK function automatically fills in the Stream output there which would be created as a blob under the “freblogs” container, with the same name that I pass into this function, “name”. You just need to configure the connection string with name “AzureJobsData” for the application in it’s app.config file. Pretty awesome, isn’t it? This WebJobs SDK is in alpha I’m told, so I’m really waiting to see what are the new features in the final version. Sure, the team has set a high bar for themselves

If this isn’t enough, you have an awesome site extension for your Azure Websites that shows all these WebJobs operations with the Azure Blob Storage. I was trying to understand how this works, what WebJobs SDK does is, create another container called “azure-jobs-invoke-log” in your Blob storage account, and stores the logs inside, which then are fetched by the AzureJobs site extension, and shown to you. Here is what my Storage Account shows the containers, the “freblogs” that contain all the FREB files, and the “azure-jobs-invoke-log” showing the container that holds all the log messages of WebJobs SDK.

And, to enable the Site Extension, you need to make sure you first configure the connection string named “AzureJobsRuntime” having the same connection string to the Blob Container.

After saving this connecting string, then you have to go to the URL https://<yoursitename>.scm.azurewebsites.net/AzureJobs URL. This page shows you details about your WebJobs configured on the Blob Storage account that you have configured, and it’s full details. You can click on each invocation to see it’s details. Remember, in my case it is a custom function that I’m invoking, so it will show you all the details about the parameters that were passed in, and the result of that call. Also, it has a link to the file that we just uploaded – you can download that file by just clicking on the output hyperlink in the 2nd screenshot below.

Pretty awesome! Don’t wait. Add more power, and background processing to your Azure Websites using the new WebJobs SDK.