Skip to content

Instantly share code, notes, and snippets.

@jongio
Created March 19, 2016 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jongio/dbdb2e6c62c0b5287449 to your computer and use it in GitHub Desktop.
Save jongio/dbdb2e6c62c0b5287449 to your computer and use it in GitHub Desktop.
public class GreetingsOrchestration2 : TaskOrchestration<string,int>
{
public override async Task<string> RunTask(OrchestrationContext context, int secondsToWait)
{
var user = context.ScheduleTask<string>("DurableTaskSamples.Greetings.GetUserTask", string.Empty);
var timer = context.CreateTimer<string>(context.CurrentUtcDateTime.AddSeconds(secondsToWait), "TimedOut");
var u = await Task.WhenAny(user, timer);
string greeting = await context.ScheduleTask<string>("DurableTaskSamples.Greetings.SendGreetingTask", string.Empty, u.Result);
return greeting;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment