这是代码:
[return: Table("AnalysisDataTable", Connection = "TableStorageConnection")]
public static async Task<OrchestrationManagerAnalysisData> InputQueueTriggerHandler(
[QueueTrigger("DtOrchestrnRequestQueueName",
Connection = "StorageQueueConnection")] string queueMsg,
[OrchestrationClient] DurableOrchestrationClient client, ILogger logger)
{
logger.LogInformation($"***DtOrchestrationRequestQueueTriggerHandler(): queueMsg = {queueMsg}");
await ProcessInputMessage(queueMsg, client, logger);
// Below is where the code goes to format the TableStorage Entity called analysisData.
// This return causes the above output binding to be executed, saving analysis data to
// Table Storage.
return analysisData;
}
上面的代码工作正常,并将分析数据保存到表存储。
但是,当我将输出绑定属性放在ProcessInputMessage()上时,这是以编程方式调用而不是作为触发器调用的,一切正常,除非没有数据输出到表存储。
[return: Table("AnalysisDataTable", Connection = "TableStorageConnectionName")]
public static async Task<OrchestrationManagerAnalysisData>
ProcessInputMessage(string queueMsg, DurableOrchestrationClient client, ILogger logger)
{
// Do the processing of the input message.
// Below is where the code goes to format the TableStorage Entity called analysisData.
// This return causes the above output binding to be executed, saving analysis data to
// Table Storage.
return analysisData;
}
当从WebJob中的另一个函数以编程方式调用时,问题有一种方法可以使输出绑定“触发”吗?
我喜欢输出绑定的省力特性,并且希望尽可能地利用它们,同时还要有很好的代码,即每种方法的紧密内聚。
谢谢,乔治
当从WebJob中的另一个函数以编程方式调用时,有没有办法使输出绑定“触发”?
简而言之,没有。
您使用return value of the function发送数据,return
在函数中应用输出绑定属性。因此,如果要调用另一个函数并将数据写入表存储。
如果你想实现你想要的想法,你需要覆盖TableOperation
方法。但是,它是一个包集成方法,因此我建议您可以使用将客户实体插入表存储的TableOperation insertOperation = TableOperation.Insert(customer1);
// Execute the insert operation.
table.Execute(insertOperation);
对象。
article
有关更多详细信息,请参阅此qazxswpoi。