Orchestration not resuming after exception thrown
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 335
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 6
Description
Apologies if I'm missing something obvious but I've been stuck for a little while playing around with the DTF. I have an orchestration setup which triggers a sub-orchestration. The sub orchestration schedules the GetUser activity 5 times. For testing purposes, if that activity receives an input of "throw" it will throw an exception. What I want to happen once an exception is from is for this orchestration to carry on after the point of failure. For example in the code below an exception will be thrown on the 3rd scheduled activity, when this exception is caught and logged I want it to then schedule the 4th task and so on... but instead the orchestration finishes once the first exception is thrown and doesn't schedule the remaining 2 activities which can be seen in the sequence diagram below. Please can someone point me in the right direction?
`public class TestOrch: TaskOrchestration
{
private string status = "";
private bool hasError = false;
private int errorCount = 0;
public OrchestrationContext Context { get; set; }
public override async Task RunTask(OrchestrationContext context, string input)
{
status = "running";
string UPN = "test.test@test.com";
try
{
await context.ScheduleTask(typeof(GetUser), UPN);
await context.ScheduleTask(typeof(GetUser), UPN);
await context.ScheduleTask(typeof(GetUser), "throw");
await context.ScheduleTask(typeof(GetUser), UPN);
await context.ScheduleTask(typeof(GetUser), "throw");
}
catch(Exception e)
{
logEvent(context, e.StackTrace, e.Message);
}
return true;
}
private void logEvent(OrchestrationContext context, string eventName, string eventMessage)
{
errorCount++;
hasError = true;
if (errorCount > 1)
{
status = $"{errorCount} activities have failed";
}
else
{
status = $"{errorCount} activity has failed";
}
//context.SendEvent(context.OrchestrationInstance, eventName, eventMessage);
}
public override string OnGetStatus()
{
return status;
}
}`

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.