public static async Task <IActionResult> NewEmployee( [HttpTrigger(AuthorizationLevel.Anonymous, "get")] NewEmployeeArgs args, [OrchestrationClient] DurableOrchestrationClient durableOrchestrationClient, ILogger log) { var orchestrationId = await durableOrchestrationClient.StartNewAsync(nameof(Orchestration), args); log.LogInformation("Started orchestration with ID = '{orchestrationId}'.", orchestrationId); var response = durableOrchestrationClient.CreateHttpManagementPayload(orchestrationId); return(new OkObjectResult(response)); }
public static async Task <Guid> CreateInDb( [ActivityTrigger] NewEmployeeArgs newEmployeeArgs, ILogger log) { var employee = new Employee(Guid.NewGuid(), newEmployeeArgs.FullName, newEmployeeArgs.Age); if (employee.Age > 100) { throw new Exception("Daar geloof ik niets van"); } log.LogInformation("Creating {name} in database", employee.FullName); await Task.Delay(TimeSpan.FromSeconds(employee.Age)); log.LogInformation("{name} created in database", employee.FullName); return(employee.Id); }