microsoft / durabletask-java

Java SDK for Durable Functions and the Durable Task Framework
MIT License
13 stars 7 forks source link

Suspend and Resume client APIs #96

Closed cgillum closed 1 year ago

cgillum commented 1 year ago

Here is the feature documentation: https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-instance-management?tabs=csharp#suspend-and-resume-instances-preview

Here are the equivalent APIs for the .NET in-proc (WebJobs) model:

akshaykumars10 commented 1 year ago

Hi @cgillum What should be the ETA for this feature in the java SDK?

cgillum commented 1 year ago

Adding @kaibocai for visibility.

cgillum commented 1 year ago

Here's a PR which shows how we added these APIs in the .NET Isolated SDK: https://github.com/microsoft/durabletask-dotnet/pull/97.

One additional thing we'll need in the case of Java is to also add a suspend/resume implementation to TaskOrchestrationExecutor.java, specifically, the processEvent method. The basic steps are outlined in this PR: https://github.com/Azure/durabletask/pull/764. You'll want to focus mostly on the changes to TaskOrchestrationExecutor.cs (same class name as in Java) but also try to implement a similar integration test for validation.

kaibocai commented 1 year ago

Here's a PR which shows how we added these APIs in the .NET Isolated SDK: microsoft/durabletask-dotnet#97.

One additional thing we'll need in the case of Java is to also add a suspend/resume implementation to TaskOrchestrationExecutor.java, specifically, the processEvent method. The basic steps are outlined in this PR: Azure/durabletask#764. You'll want to focus mostly on the changes to TaskOrchestrationExecutor.cs (same class name as in Java) but also try to implement a similar integration test for validation.

Thanks @cgillum , I believe I will also add missing logics in https://github.com/microsoft/durabletask-sidecar right.

cgillum commented 1 year ago

No, we don’t use the sidecar project anymore for Functions. There’s no need to change anything there.

kaibocai commented 1 year ago

Hi @cgillum , so currently all java sdk integration tests are based on durable side car just similar as .NET sdk (seems .NET sdk also skip the test because of missing logics in sidecar https://github.com/microsoft/durabletask-dotnet/pull/97), if we don't use sidecar for the integration tests, are you expecting we spawn up function runtime (just as what we are doing here https://github.com/microsoft/durabletask-java/tree/main/samples-azure-functions) for the testing? Thanks.

cgillum commented 1 year ago

Oh, interesting. I didn’t realize that any changes to the sidecar were necessary. Maybe it needs to understood the new Suspended enum value? If that’s the case, I recommend we try to update the sidecar to support this because that will make testing easier. My hope is that it’s very little work.

cgillum commented 1 year ago

Actually, I just realized that I have local changes on my machine to support suspend/resume. I will create a PR for updating the sidecar.

cgillum commented 1 year ago

Here's the PR for suspend/resume support in the sidecar. I don't have a way to test it yet, unfortunately, so I recommend you clone this PR locally and run it locally (F5 in visual studio, debugging the Microsoft.DurableTask.Sidecar.App project should be good enough) for the testing of the Java work. If you run into issues, feel free to either let me know or investigate/make changes yourself.

https://github.com/microsoft/durabletask-sidecar/pull/18