0

I want my orchestrator function to return an object representing what happened in my workflow, basically some stats about what my workflow has done: users retrieved from an API, users inserted in a database, ...

What I was doing until now was to return these information from my activies functions and aggregating them in my orchestrator before returning them :

return new
{
    UserInsterted = myActivity1.InsertedUsersNumber,
    UsersRetrievedFromApi = myActivity2.RetrievedUserNumber
};

However I am have now activities that run in parallel (thanks to a Task.WhenAll(myActivity1, myActivity2) so I can't return a result with a different type.

That's why I was wondering if using a Durable Entity in my code to store everything I want to return at the end in my orchestrator was a good solution.

TechWatching
  • 1,363
  • 1
  • 11
  • 23

1 Answers1

2

I don’t think you need Durable Entities to store the results of your workflows. The syntax you’re using will still work even if your activity functions return values of different types.

That said, Durable Entities might be a good option if you want to save the results of activities outside of your orchestration. Then they could be queried independently and don’t even require your orchestration to be complete.

Chris Gillum
  • 14,526
  • 5
  • 48
  • 61