Skip to content

Investigate passing a parameter through a binding  #1080

@liliankasem

Description

@liliankasem

In the current SDK binding implementation for in-proc, users can use a trigger binding to bind to a POCO, then that to pass a parameter to the next binding.

For example in the code snippet below, we are using a BlobTrigger and binding to a Book, this book has an ID property. In the input binding, we are able to use {id} to extract the ID value from the Book provided by the trigger. This is then parsed by the input binding so that we can get the content of the blob named "{id}.txt". So if the blob we upload to the book-trigger container has the ID value set to "1". Then the input binding will grab the contents of the "1.txt" file from the book-input container.

public static class BlobBookFunction
{
    [Function(nameof(BlobBookFunction))]
    public static async Task Run(
        [BlobTrigger("book-trigger", Connection = "AzureWebJobsStorage")] Book book,
        [BlobInput("book-input/{id}.txt", Connection = "AzureWebJobsStorage")] string myBlob,
        FunctionContext context)
    {
        var logger = context.GetLogger(nameof(BlobBookFunction));
        logger.LogInformation("Blob content: {content}", myBlob);
    }
}

public class Book
{
    public string Name { get; set; }
    public string Id { get; set; }
}

Actions

  • Investigate if it is possible to make this work with out-of-proc SDK bindings
  • Create an issue to track the work required to enable this feature

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions