-
Since I don't know if this would be a valid feature request, I just wanted to ask if this would make sense and if anyone else has an opinion about that. So here is my problem: My company is using a custom solution for end-to-end logging, and my team was asked to use this in our APIs that are implemented as Durable Functions (at least most of them). To test this, we implemented an interface and a service class in one of our Function Apps, to see if things work as expected because we thought about creating a NuGet package from our solution, since we do not want to copy and paste the code to all our projects. The steps this logging service does to log to the solution my company uses are the following:
Since the logging application needs to keep track of what activity belongs to which process, it returns a So in our orchestrator function, we came up with the following solution (just a small example):
The problem we encountered is that (unlike the execution of activity functions) the result of the service invocation is never replayed. So my question is, would it be possible to replay the result returned by service classes? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You should be doing something like that instead:
That is: for replay behaviour, you have to use CallActivityAsync You can also hide that call to CallActivityAsync behing the logger if you really want to (it will need the context):
|
Beta Was this translation helpful? Give feedback.
I see. Can't you use the instance ID for your logger in that case?
Anyway, you can do your best to hide the CallActivityAsync method from the orchestration code, but if you want to rely on the replay behavior, it will have to be somewhere in the implementation.
Maybe you could use objects like proxies to hide this implementation detail and make the code look more like any other C# code. For that, you would need to hook the orchestration context instance in the DI container so you could pull it out in each proxy implementation as a scoped dependency (not sure it is possible currently).
However, since the coding constraints for Durable orchestration are so important, do your best to make ac…