microsoft / durabletask-mssql

Microsoft SQL storage provider for Durable Functions and the Durable Task Framework
MIT License
87 stars 32 forks source link

Retrieve the total number of filtered instances by SqlOrchestrationQuery #72

Open hsnsalhi opened 2 years ago

hsnsalhi commented 2 years ago

Hello, The GetManyOrchestrationsAsync returns a list of orchestration states. We can set the paging parameters (pageNumber and pageSize) with the SqlOrchestrationQuery object. My problem is that this method cannot tell us how many instances match the defined query filter. Can we add a GetOrchestrationsCountAsync method that accepts the same SqlOrchestrationQuery object as input (without paging information) and returns that total number of matching instances. Thank you

usemam commented 2 years ago

@hsnsalhi As I understand it, GetManyOrchestrationsAsync is not a part of a contract for implementing a persistence provider for DurableTask - it's more like a backdoor for DurableTask.SqlServer.AzureFunctions.SqlDurabilityProvider. Could you please explain in more details why would you need such a change, so we can better understand a use case here? Thank you.

hsnsalhi commented 2 years ago

Hello and thank you for answering my question,

In relation to this issue in durabletask, the filtering feature using related interfaces was not yet available for mssql provider (now it is implemented, but the nuget package is not yet released).

Now that it's implemented, I still don't know how to get the total number of instances that match my filter. In Azure Durable Functions, I see that we use infinite scroll to get more results (using continuation-token), so the full count is not needed in this case. Is this the end goal even for DTF ?