Skip to content

oaastest/azure-webjobs-sdk-extensions

 
 

Repository files navigation

Azure WebJobs SDK Extensions

This repo contains binding extensions to the Azure WebJobs SDK. See the Azure WebJobs SDK repo for more information. The binding extensions in this repo are available as the Microsoft.Azure.WebJobs.Extensions nuget package.

The wiki contains information on how to author your own binding extensions. See the Binding Extensions Overview for more details.

A sample project is also provided that demonstrates the bindings in action.

The extensions included in this repo include the following:

###TimerTrigger###

A fully featured Timer trigger that supports cron expressions, as well as other schedule expressions. A couple of examples:

public static void CronJob([TimerTrigger("0 */1 * * * *")] TimerInfo timer)
{
    Console.WriteLine("Cron job fired!");
}

public static void TimerJob([TimerTrigger("00:00:30")] TimerInfo timer)
{
    Console.WriteLine("Timer job fired!");
}

###FileTrigger###

A trigger that monitors for file additions/changes to a particular directory, and triggers a job function when they occur. Here's an example that monitors for any *.dat files added to a particular directory, uploads them to blob storage, and deletes the files automatically after successful processing. The FileTrigger also handles multi-instance scale out automatically - only a single instance will process a particular file event.

public static void ImportFile(
    [FileTrigger(@"import\{name}", "*.dat", autoDelete: true)] Stream file,
    [Blob(@"processed/{name}")] CloudBlockBlob output,
    string name)
{
    output.UploadFromStream(file);
    file.Close();

    log.WriteLine(string.Format("Processed input file '{0}'!", name));
}

About

Azure WebJobs SDK Extensions

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 90.3%
  • Smalltalk 9.6%
  • PowerShell 0.1%