将Blob名称传递到Azure功能时,在向Queue添加消息时无法触发
不工作
#r "Newtonsoft.Json"
using System;
using Newtonsoft.Json;
public static void Run(string myQueueItem,
Stream outputBlob,
ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
dynamic data = JsonConvert.DeserializeObject(myQueueItem);
log.LogInformation($"We got a new Queue Request Type: {data.MessageType}");
if(data.MessageType == "Create Blob")
{
// outputBlob = data.Message;
}
// outputBlob = "";
string blobFileName = "tettet.script";
}
工作
我希望创建文件作为队列消息包含在正文部分。
还需要从队列对象中分配Blob文件名作为参数。(uploadedscript / {blobFileName})
使用以下代码:
using System;
public static void Run(string myQueueItem,out string outputBlob,ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
outputBlob=myQueueItem;
}
而function.json:
{
"bindings": [
{
"name": "myQueueItem",
"type": "queueTrigger",
"direction": "in",
"queueName": "queue",
"connection": "AzureWebJobsStorage"
},
{
"type": "blob",
"name": "outputBlob",
"path": "container/{queueTrigger}",
"connection": "AzureWebJobsStorage",
"direction": "out"
}
]
}