Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for hooking in predefined methods to incoming bindings #1186

Closed
fashaikh opened this issue Jun 12, 2017 · 3 comments
Closed

Allow for hooking in predefined methods to incoming bindings #1186

fashaikh opened this issue Jun 12, 2017 · 3 comments
Labels
Milestone

Comments

@fashaikh
Copy link

#1041
#734
#980
#1167

Along the same lines as those above but with a few twists:

  1. predefined commonly used functions
  2. written in C# usable by others
  3. reduces function code
  4. Standardised and tested to run reliably on Appservice environment.

Description

One promise of serverless is to write only your business logic and we take care of the rest. Functions addresses a lot of the machinations related to running the user’s code. However the code is still not business logic. Common tasks like transforming between formats, compression/encryption are still handled by the users. There are also nuances related to these operations running on the azure functions sandbox that both users and our support folks can live without.

Enter functions filters 

The proposal is to have a standard set of functionality available as “filters” to users likely as an IBinder interface. Any function can include the filter and the based on the configuration set in function.json the filter would run the custom operation on the incoming Stream.
In short the incoming stream would get applied to another binder before/after the main binder is done with its job.

{
  "bindings": [
    {
      "name": "myBlob",
      "type": "blobTrigger",
      "direction": "in",
      "filters": "certdecrypt{param1,param2}",
      "path": "samples-workitems/{name}",
      "connection": "AzureWebJobsDashboard"
    },
    {
      "type": "blob",
      "name": "outputBlob",
      "path": "outcontainer/{rand-guid}",
      "filters": "certencrypt{param1,param2},zip",
      "connection": "AzureWebJobsDashboard",
      "direction": "out"
    },
    {
      "type": "blob",
      "name": "inputBlob",
      "path": "incontainer/{name}",
      "filters": "unzip",
      "connection": "AzureWebJobsDashboard",
      "direction": "in"
    },
    {
      "type": "http",
      "name": "res",
      "filters": "addcerttorequest{param1,param2}",
      "direction": "out"
    }
  ],
  "disabled": false
}

@mathewc
Copy link
Member

mathewc commented Aug 16, 2017

Going to close this because the Function Filters feature has been checked in (see #980). That feature allows you to apply custom pre/post logic to function parameters. I think that would enable your scenario.

@mathewc mathewc closed this as completed Aug 16, 2017
@fashaikh
Copy link
Author

Yes I looked at it. Thanks !
I think a metadata driven approach would be more standard across C# and Node.js

@mathewc
Copy link
Member

mathewc commented Aug 16, 2017

We will be allowing filters to be used in other languages soon, tracked by Azure/azure-functions-host#1761.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants