Skip to content

Binding Attributes

Mathew Charles edited this page Sep 10, 2015 · 6 revisions

The WebJobs SDK uses an declarative model for describing job function bindings. Consider the following job function:

    public static void ProcessOrders(
        [QueueTrigger("order")] Order order, 
        [Blob("orders/{OrderId}")] out string orderBlob)
    {
        ...
    }

This function uses the QueueTrigger and Blob bindings, to trigger when a new message arrives in the order queue, and binds to an output blob container to archive the order.

The QueueTriggerAttribute and BlobAttribute types define the programming model for the bindings. One of the first steps in designing a new binding is to define this programming model for your domain.

  • What does the user need to provide/configure for the binding?
  • What parameter types should the binding support (e.g. the above sample shows how QueueTrigger supports binding a message to a POCO object)? Good bindings support a variety of parameter types making them flexible. See the WebJobs SDK Quick Reference for examples of the types supported by the built in bindings.

The goal is to address customer requirements as simply and concisely as possible, following the WebJobs SDK easy to use declarative attribute model.

The Attributes are just the declarative part of a binding. The real work is in writing the binding provider that supports your attribute at runtime. Other pages in this wiki describe how to write binding providers.