microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.03k stars 401 forks source link

Make it possible to return IAsyncEnumerable from SF services #1124

Open ljuba95 opened 3 years ago

ljuba95 commented 3 years ago

Service Fabric Runtime Version: 7.2.434.9590 Environment: Dev cluster

Description: Getting large amount of data from db or ReliableDictionary is really slow when you have to load all of it in memory. If we could return IAsyncEnumerable from a public method of the service, it would be much better, like in regular ASP .NET Core services. I tried doing that using Task but I still dont get expected results, and also couldnt find any solution online. If this is expected and I am mistaken, please point me to the right solution.

Observed behavior: Only Task and Task<> are supported return values.

Expected Behavior: Should be able to return IAsyncEnumerable for chunked http response and streaming data with an open connection. OS(Windows/Linux): Windows


Assignees: /cc @microsoft/service-fabric-triage

sachevl commented 3 years ago

Hi @ljuba95

What type of replica listener are you using? You can implement your own custom http listener that would support your scenario. Please check this doc for reference. https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication