0

I have the following durable function code:

    [FunctionName("OrchestratorFunction")]
    public async Task RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context)
    {
            var jobs = await context.CallActivityAsync<List<Job>>("JobsReaderFunction"), null);
            if (jobs != null && jobs .Count > 0)
            {
                var processingTasks = new List<Task>();
                foreach (var job in jobs)
                {                    
                    Task processTask = context.CallSubOrchestratorAsync("SubOrchestratorFunction"), job);
                    processingTasks.Add(processTask);
                }
                await Task.WhenAll(processingTasks);               
            }
    }

    [FunctionName("SubOrchestratorFunction")]
    public async Task RunSubOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context)        
    {
            var job = context.GetInput<Job>();
            var group = await context.CallActivityAsync<Group>("GroupReaderFunction"), job);
            await context.CallActivityAsync("EmailSenderFunction", group);
    }    


        [FunctionName("GroupReaderFunction")]
        public async Task<JobGroup> GetGroup([ActivityTrigger] Job job)
        {
            var group = new JobGroup();
            if (job != null)
            {
                var group = await _jobTopicService.GetGroupAsync(job.TargetOfficeGroupId);
                group = new JobGroup
                {
                    Job = job,
                    Name = name
                };
            }
            return group;
        }

While running this, I get the following exception:

Exception while executing function: GroupReaderFunction The request message was already sent. Cannot send the same request message multiple times.

What could be the issue? Any suggestions would be helpful.

user989988
  • 3,006
  • 7
  • 44
  • 91

0 Answers0