2

I have a blob trigger function. I actually don't need the blob stream in this function ( i just get some meta properties off it to send a URL to twilio). I was thinking especially for some larger blob files, this would help performance if it knew not to send the stream to the trigger? I tried just removing the parameter hoping for some dynamic binding. This didn't work, it just serialized the blog into a string and put it into the next parameter - blob name string. Is there any other configuration available to make this work as desired?

Update: here is my method signature

 [FunctionName("OutboundFax")]
        public static void Run([BlobTrigger("faxdocuments/{name}", Connection = "faxdocumentsAppSetting")]Stream faxBlob, string name, ILogger log)
{}
2
  • 2
    public static async Task Run(CloudBlockBlob myBlob, string name, ILogger log) Commented Apr 9, 2020 at 16:35
  • Thank you Roman! Don't know why visual studio 2019 does not use that as the default template when adding the function from the GUI, way more efficient. My trigger function is running much quicker now. Commented Apr 9, 2020 at 17:34

1 Answer 1

2

For this problem, there is a description about usage of parameters: Usage.

You can use the following parameter types for the triggering blob:

  • Stream
  • TextReader
  • string
  • Byte[]
  • A POCO serializable as JSON
  • ICloudBlob
  • CloudBlockBlob
  • CloudPageBlob
  • CloudAppendBlob

So almostly CloudBlockBlob is the type you want, only thing you need to note is need install storage SDK tehn you will be able to use the blob SDK method.

About why azure function default type is Stream, firstly in this usage there is a description:

it is preferable to use a Stream or CloudBlockBlob type. For more information, see Concurrency and memory usage later in this article.

And another reason may be the Stream type is more applicable, cause it could be other blob type, and in default don't need to install the SDK.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you George! I still not enough points to give you a vote.
@R123, any process, if this could help you, you could accept it as the answer.
Note that if you are using .NET6.0, CloudBlockBlob is deprecated and will NOT work, you need to use BlockBlobClient instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.