我一直试图在队列触发函数 URL 中返回表存储行,但未能成功。下面是我的代码。
public static async Task<List<PatchesList>> Run([QueueTrigger("send-patches-list", Connection =
"AzureWebJobsStorage")]string myQueueItem, [Table(tableName: "getpatcheslist", Connection =
"AzureWebJobsStorage")]CloudTable cloudTable, ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
TableQuery<PatchesList> projectionQuery = new TableQuery<PatchesList>().Select(
new string[] { "RowKey", "Name" });
var grouprows = await cloudTable.ExecuteQuerySegmentedAsync(projectionQuery, null);
List<PatchesList> groupslist = new List<PatchesList>();
log.LogInformation($"C# Queue trigger function processed: {grouprows}");
foreach (var c in grouprows.Results)
{
groupslist.Add(new PatchesList
{
RowKey = c.RowKey,
Name = c.Name
});
log.LogInformation($"C# Queue trigger function processed: {groupslist[0].Name}");
}
return groupslist;
}
public class PatchesList : TableEntity
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public string Name { get; set; }
}
我在发回数据时遇到问题,这种方法可行吗,队列触发器可以发回响应吗?