Reputation: 5694
I'm trying to have an input data storage binding for queue triggering function.
VTRequest is an object that been pushed to the queue and the VTEntity is an object that been saved in the db.
this if the 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) {
.....
}
}
This is the error logs that i'm getting:
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)
and I do have this record in the related db:
I would like to query the DB for the hash that is been passed by the queue object vtAPIRequest.hash
is there a way to do so?
Upvotes: 1
Views: 765
Reputation: 35154
You are almost there, just change the binding of rowKey
to
"rowKey": "{hash}",
Upvotes: 3