虽然将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})
答案 0 :(得分:0)
使用以下代码:
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"
}
]
}