C
C#2y ago
malkav

❔ Trying to return the result of Fan Out Fan In Azure Function

So I've been trying to build my Azure function with a Fan-Out Fan-In method. But when the function completed I keep returning the wrong results. Which I figured since it's creating a new instance, and turning that into an instanceId. I kind of want the result of my [OrchestrationTrigger] to be returned to the http_start section of my Azure Function. Here is a simplified version of my current structure:
[FunctionName("Fetching")]
public static async Task<List<string>> RunFetching([OrchestrationTrigger] IDurableOrchestrationContext ctx, ILogger log)
{
// Some Code
}

[FunctionName("Fetching_Secondary")]
public static async Task<string[]> Secondary([ActivityTrigger] string input, ILogger log)
{
// Some code that returns to "Fetching"
}

[FunctionName("Fetching_HttpStart")]
public static async Task<IActionResult> HttpStart([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestMessage req, [DurableClient] IDurableOrchestrationClient starter, Ilogger log)
{
string input = await req.Content.ReadAsStringAsync();
try
{
var inputData = JsonConvert.DeserializeObject<object>(input): // This has other types but I figure irrelevant for now
var instanceId = await starter.StartNewAsync("Fetching", null, inputData);

return new OkObjectResult(await starter.CreateCheckStatusResponse(req, instanceId).Content.ReadAsStringAsync());
} catch (Exception e)
{
log.LogDebug(e.Message);
}
}
[FunctionName("Fetching")]
public static async Task<List<string>> RunFetching([OrchestrationTrigger] IDurableOrchestrationContext ctx, ILogger log)
{
// Some Code
}

[FunctionName("Fetching_Secondary")]
public static async Task<string[]> Secondary([ActivityTrigger] string input, ILogger log)
{
// Some code that returns to "Fetching"
}

[FunctionName("Fetching_HttpStart")]
public static async Task<IActionResult> HttpStart([HttpTrigger(AuthorizationLevel.Anonymous, "post")] HttpRequestMessage req, [DurableClient] IDurableOrchestrationClient starter, Ilogger log)
{
string input = await req.Content.ReadAsStringAsync();
try
{
var inputData = JsonConvert.DeserializeObject<object>(input): // This has other types but I figure irrelevant for now
var instanceId = await starter.StartNewAsync("Fetching", null, inputData);

return new OkObjectResult(await starter.CreateCheckStatusResponse(req, instanceId).Content.ReadAsStringAsync());
} catch (Exception e)
{
log.LogDebug(e.Message);
}
}
Now the issue I am having is that my "Fetching" function should return a List<string> but in my "Fetching_HttpStart" I am returning just information about the instances. How can I turn this so that it returns whatever my "fetching" is returning?
2 Replies
malkav
malkav2y ago
Can someone help, I've edited so much now already that I'm absolutely lost, and the docs are not making things easier to understand... I've got the program so far now that it first returns a result (with "Output" set to null) and only then starts to do all the tasks, and I don't even know if it is fanning out, or just doing all of them in a row or somethin...
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.