Reputation: 141
I have 3 azure functions first is blob trigger, second is service bus queue trigger and third is service bus topic functions. The functions is running fine but now I have a requirement to have blob name in all the 3 functions which is helping to trigger the first functions. In blob trigger functions I can get blob name using path variable of input binding but I'm not able to find a way to pass this blob name variable to other two functions. Is it possible to pass this variable as a dynamic in bindings of other functions?
Upvotes: 1
Views: 604
Reputation: 14088
If you are talking about pass dynamic blob name with code, then it is not possible. This is because the blob name value of blob input binding or blob trigger is be designed as const.(So this must be setted before compile.)
The only way is to use the mechanism left at the beginning of the design.
You can do something like below:
__init__.py
import logging
import azure.functions as func
def main(msg: func.ServiceBusMessage, outputblob: func.Out[func.InputStream]):
logging.info('Python ServiceBus queue trigger processed message: %s',
msg.get_body().decode('utf-8'))
outputblob.set('111')
function.json
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "serviceBusTrigger",
"direction": "in",
"queueName": "myqueue",
"connection": "bowman1012_SERVICEBUS"
},
{
"name": "outputblob",
"type": "blob",
"path": "{mypath}/111.txt",
"connection": "MyStorageConnectionAppSetting",
"direction": "out"
}
]
}
You can send json format message to service bus:
{
"mypath":"bowman"
}
Then you can send the blob to dynamic path you want:
In short, it is impossible to use encoding. You can only achieve it through the things left at the beginning of the azure function design.
Upvotes: 2