i see in Microsoft's example of fan-out that there is no concern for 'defending' against replay
but i definitely need if (!orchestrationContext.IsReplaying)
here:
[FunctionName(FUNC_NAME_ORCH)]
public static async Task<string> RunPlayerYouTubeOrchestration(
[OrchestrationTrigger] DurableOrchestrationContext orchestrationContext,
ILogger log)
{
log?.LogInformation($"{FUNC_NAME_ORCH}: {nameof(RunPlayerYouTubeOrchestration)} invoked...");
log?.LogInformation($"{FUNC_NAME_ORCH}: {nameof(DurableOrchestrationContextBase.InstanceId)} {orchestrationContex
log?.LogInformation($"{FUNC_NAME_ORCH}: calling {FUNC_NAME_ORCH_FUNC0}.c ..");
var jsonBlobs = await orchestrationContext
.CallActivityAsync<IEnumerable<string>>(FUNC_NAME_ORCH_FUNC0, null);
if ((jsonBlobs == null) || !jsonBlobs.Any())
{
var errorMessage = $"{FUNC_NAME_ORCH}: The expected JSON blobs from `{FUNC_NAME_ORCH_FUNC0}` are not here.";
log?.LogError(errorMessage);
throw new NullReferenceException(errorMessage);
}
if (!orchestrationContext.IsReplaying)
{
var tasks = jsonBlobs.Select(json =>
{
log?.LogInformation($"{FUNC_NAME_ORCH}: calling {FUNC_NAME_ORCH_FUNC1}...");
return orchestrationContext.CallActivityAsync(FUNC_NAME_ORCH_FUNC1, json);
});
log?.LogInformation($"{FUNC_NAME_ORCH}: fan-out starting...");
await Task.WhenAll(tasks);
}
log?.LogInformation($"{FUNC_NAME_ORCH}: fan-out complete.");
log?.LogInformation($"{FUNC_NAME_ORCH}: calling {FUNC_NAME_ORCH_FUNC2}...");
await orchestrationContext.CallActivityAsync(FUNC_NAME_ORCH_FUNC2, null);
return orchestrationContext.InstanceId;
}
without this if
gate, FUNC_NAME_ORCH_FUNC1
will be called endlessly
what am i doing wrong here? is there ever a 'right' time to use !orchestrationContext.IsReplaying
or is it a hack to use less-than deterministic code?