© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
2 replies
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]
[OrchestrationTrigger]
to be returned to the
http_start
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>
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Trying to trigger Azure Function with OpenApi
C#CC# / help
3y ago
trying to plan validating azure ad token and calling graph api in azure function
C#CC# / help
2y ago
❔ Trying to return
C#CC# / help
3y ago