Created
November 28, 2017 05:03
-
-
Save gled4er/d22827fb61baac64e96ce7e6b1924d1b to your computer and use it in GitHub Desktop.
Sync Response Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<object> ProvideOutput(OrchestrationClientResponse clientResponse, ExecutionDetails executionDetails, TraceWriter log) | |
{ | |
object result = null; | |
using (var httpClient = new HttpClient()) | |
{ | |
for (var i = 0; i < executionDetails.Iterations; i++) | |
{ | |
Thread.Sleep(executionDetails.IterationPeriod); | |
string statusCheck; | |
try | |
{ | |
statusCheck = await httpClient.GetStringAsync(clientResponse.StatusQueryGetUri); | |
} | |
catch (Exception e) | |
{ | |
// log the exception | |
log.Error(e.Message); | |
continue; | |
} | |
var status = JsonConvert.DeserializeObject<StatusResponse>(statusCheck); | |
if (status.RuntimeStatus != "Completed") { continue; } | |
result = status.Output; | |
break; | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment