I am constantly on the look out for places where F# is a good fit, and I believe that I found one, Azure WebJobs programmed in F#.
Azure WebJobs can be built as console jobs that are scheduled by the Azure WebSite runtime to either run on a predefined schedule or run continuesly. The continuesly running jobs integrates easily with Azure Queues or Blob storage and are designed for doing heavy workloads that you don’t want running in your website. Heavy workload, console jobs all things that F# is really great at.
Here is an example of an Azure WebJob written in F# that listens for messages from a Azure queue named test, and writes it to the output, not exactly a heavy workload but it shows the concept.
To install the nuget package that gives you all the webjob goodness write the following in the package manager console
install-package Microsoft.Azure.WebJobs -prerelease
let ProcessMessage ([<QueueTriggerAttribute(queueName = "test")>] message : string) =
printf "%A" message
let main argv =
printfn "%A" argv
use jobHost = new JobHost()
0 // return an integer exit code
If you need a little more background on Azure WebJobs then check this older version of mine.
Leave a Reply