コード例 #1
0
        public static async Task <HttpResponseMessage> HttpStart(
            [HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequestMessage req,
            [DurableClient] IDurableOrchestrationClient starter,
            ILogger log)
        {
            // Function input comes from the request content.
            // ProcessRequest requestData = await req.Content.ReadAsAsync<ProcessRequest>();
            ProcessRequest requestData = new ProcessRequest()
            {
                data = "andres"
            };
            // Starting a new orchestrator with request data
            string instanceId = await starter.StartNewAsync("HttpTrigger_Orchestrator", requestData);

            log.LogInformation($"Started orchestration with ID = '{instanceId}'.");

            var response = starter.CreateCheckStatusResponse(req, instanceId);

            // I specify a response interval so the Logic App doesn't check the status
            // until after 10 seconds has passed. If work will be longer you can change this
            // value as needed.
            response.Headers.RetryAfter = new RetryConditionHeaderValue(TimeSpan.FromSeconds(10));
            return(response);
        }
コード例 #2
0
 public static string DoWork([ActivityTrigger] ProcessRequest requestData, ILogger log)
 {
     log.LogInformation($"Doing work on data {requestData.data}.");
     Thread.Sleep(TimeSpan.FromSeconds(3));
     return("some response data");
 }