Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically set blob name to store in Blob storage in azure function nodejs?

I have a activity function that should store message in Blob storage.I can overwrite a file in blob storage but i need to store data in different name.how to do that? Azure function doesn't support dynamic binding in nodejs.

function.json

like image 300
Nafis Islam Avatar asked Dec 20 '25 00:12

Nafis Islam


1 Answers

Find one workaround, see whether it's useful.

Along with blob output binding, there's an activity trigger to receive message msg, we can put self-defined blob name in msg for blob binding path to consume.

In your orchestrator function which calls Activity function

yield context.df.callActivity("YourActivity", {'body':'messagecontent','blobName':'myblob'});

Then Activity function code should be modified

context.bindings.myOutputBlob = context.bindings.msg.body;

And its function.json can use blobName as expected

{
  "bindings": [
    {
      "name": "msg",
      "type": "activityTrigger",
      "direction": "in"
    },
    {
      "name":"myOutputBlob",
      "direction": "out",
      "type": "blob",
      "connection": "AzureWebJobsStorage",
      "path": "azureblob/{blobName}"
    }
  ],
  "disabled": false
}
like image 105
Jerry Liu Avatar answered Dec 22 '25 15:12

Jerry Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!