I have an orchestration function as follows:
[FunctionName(nameof(OrchestratorFunction))]
public async Task RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context)
{
_ = _loggingRepository.LogMessageAsync(new LogMessage { Message = $"{nameof(OrchestratorFunction)} function started" });
var syncJobs = await context.CallActivityAsync<List<SyncJob>>(nameof(SyncJobsReaderFunction), null);
if (syncJobs != null && syncJobs.Count > 0)
{
// Run multiple sync job processing flows in parallel
var processingTasks = new List<Task>();
foreach (var syncJob in syncJobs)
{
syncJob.RunId = _graphGroupRepository.RunId = Guid.NewGuid();
_loggingRepository.SyncJobProperties = syncJob.ToDictionary();
Task processTask = context.CallSubOrchestratorAsync(nameof(SubOrchestratorFunction), syncJob);
processingTasks.Add(processTask);
}
await Task.WhenAll(processingTasks);
}
_ = _loggingRepository.LogMessageAsync(new LogMessage { Message = $"{nameof(OrchestratorFunction)} function completed" });
}
Notice the following 2 lines:
syncJob.RunId = _graphGroupRepository.RunId = Guid.NewGuid();
_loggingRepository.SyncJobProperties = syncJob.ToDictionary();
I generate a new GUID that is associated with each syncJob and such that it is easier to see the logs associated with a syncJob using that GUID. On running this code, I see a warning:
warning DF0102: 'Guid.NewGuid' violates the orchestrator deterministic code constraint.
Why is that? How do I resolve that? Please suggest an example.