Jep*_*ppe 1 c# azure azure-functions azure-durable-functions
我有一个 Azure 编排,其中触发编排的编排客户端引发了超时异常。
编排客户端功能只做两件事,启动两个编排,等待每个编排,正如大多数示例代码所建议的那样。
await orchestrationClient.StartNewAsync("TableOrchestrator", updates);
await orchestrationClient.StartNewAsync("ClientOrchestrator", clientExport);
Run Code Online (Sandbox Code Playgroud)
然而,据我了解,编排客户端并不是像编排功能那样的特殊功能,因此它最多只能运行10分钟。显然,我的两个编排的总运行时间很可能超过 10 分钟。
问题:
更新制作了我的代码功能和运行时的完整示例,如下所示。
看起来,如果之后编写了代码,则启动编排将等待它,但如果编排是最后一条语句,则不会!
更新的问题:
。
public static class testOrchestration
{
[FunctionName("Start")]
public static async Task Start([TimerTrigger("0 */30 * * * *", RunOnStartup = true, UseMonitor = false)]TimerInfo myStartTimer, [OrchestrationClient] DurableOrchestrationClient orchestrationClient, ILogger log)
{
var startTime = DateTime.Now;
log.LogInformation(new EventId(0, "Startup"), "Starting Orchestror 1 ***");
await orchestrationClient.StartNewAsync("Orchestrator", "ONE");
log.LogInformation($"Elapsed time, await ONE: {DateTime.Now - startTime}");
await Task.Delay(5000);
log.LogInformation($"Elapsed time, await Delay: {DateTime.Now - startTime}");
log.LogInformation(new EventId(0, "Startup"), "Starting Orchestror 2 ***");
await orchestrationClient.StartNewAsync("Orchestrator", "TWO");
log.LogInformation($"Elapsed time, await TWO: {DateTime.Now - startTime}");
}
[FunctionName("Orchestrator")]
public static async Task<string> TestOrchestrator([OrchestrationTrigger] DurableOrchestrationContextBase context, ILogger log)
{
var input = context.GetInput<string>();
log.LogInformation($"Running {input}");
await Task.Delay(5000);
return $"Done {input}";
}
}
Run Code Online (Sandbox Code Playgroud)
运行它会给出以下输出:
Starting Orchestror 1 ***
Elapsed time, await ONE: 00:00:08.5445755
Running ONE
Elapsed time, await Delay: 00:00:13.5541264
Starting Orchestror 2 ***
Elapsed time, await TWO: 00:00:13.6211995
Running TWO
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2678 次 |
| 最近记录: |