gpt4 book ai didi

c# - Azure 函数通过具有输入数据存储绑定(bind)的队列触发

转载 作者:行者123 更新时间:2023-12-02 08:04:54 24 4
gpt4 key购买 nike

我正在尝试为队列触发功能提供输入数据存储绑定(bind)。

VTRequest 是被推送到队列的对象,VTEntity 是保存在数据库中的对象。

this if 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)

我在相关数据库中有此记录:

enter image description here

我想在数据库中查询队列对象传递的哈希vtAPIRequest.hash

有办法吗?

最佳答案

差不多就完成了,只需将 rowKey 的绑定(bind)更改为

"rowKey": "{hash}",

关于c# - Azure 函数通过具有输入数据存储绑定(bind)的队列触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46646120/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com