[英]Azure function trigger by queue with input data storage binding
我正在嘗試為隊列觸發功能提供輸入數據存儲綁定。
VTRequest是被推送到隊列的對象,而VTEntity是被保存在數據庫中的對象。
如果function.json
{
"bindings": [
{
"name": "vtAPIRequest",
"type": "queueTrigger",
"direction": "in",
"queueName": "vtqueue",
"connection": "vt_STORAGE"
},
{
"type": "table",
"name": "outVTAPIDataTable",
"tableName": "data",
"connection": "vt_STORAGE",
"direction": "out"
},
{
"type": "table",
"name": "vtDataRow",
"tableName": "VTData",
"partitionKey": "VT",
"rowKey": "{queueTrigger}.{hash}",
"take": 1,
"connection": "vt_STORAGE",
"direction": "in"
}
],
"disabled": false
}
using System;
public class VTEntity {
public string PartitionKey { get; set; }
public String RowKey { get; set; }
public string hash { get; set; }
public string userID { get; set; }
}
public class VTRequest {
public string hash { get; set; }
public string userID { get; set; }
}
public static void Run(VTRequest vtAPIRequest, VTEntity vtDataRow,
TraceWriter log, IAsyncCollector<VTEntity> outVTAPIDataTable) {
if(null != vtDataRow) {
.....
}
}
這是我得到的錯誤日志:
2017-10-09T12:06:07.840 Exception while executing function: Functions.VTAPIQueue. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'vtDataRow'. Microsoft.Azure.WebJobs.Host: '{
"hash": "asdasdasd",
"userID": "123456789",
"$AzureWebJobsParentId": "1f31be54-ec0d-4f0d-a4aa-45513d038f7e"
}.asdasdasd' is not a valid value for a partition key or row key.
2017-10-09T12:06:07.887 Function completed (Failure, Id=29268e32-0545-49c9-9f15-268d90de54cc, Duration=115ms)
我確實在相關的數據庫中有此記錄:
我想查詢隊列對象vtAPIRequest.hash
傳遞的哈希的數據庫
有辦法嗎?
您rowKey
了,只需將rowKey
的綁定rowKey
為
"rowKey": "{hash}",
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.