microsoft / durabletask-java

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

Getting io.grpc.StatusRuntimeException: UNKNOWN: unimplemented #142

Closed Aymalla closed 1 year ago

Aymalla commented 1 year ago

We're integrating with v1.1.0 for durabletask-client to support the worflow component for Dapr. We did a successful integration with most of the management Api:

Except two apis returning io.grpc.StatusRuntimeException: UNKNOWN: unimplemented:

Even I can see that it is supported in the java-sdk repo and Ms doc

For queryInstances

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.dapr.examples.DaprMainApplication.main(DaprMainApplication.java:37)
        ... 8 more
Caused by: io.grpc.StatusRuntimeException: UNKNOWN: unimplemented
        ... 13 more

For purgeInstances:

at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.dapr.examples.DaprMainApplication.main(DaprMainApplication.java:37)
        ... 8 more
Caused by: io.grpc.StatusRuntimeException: UNKNOWN: multi-instance purge is not unimplemented
        at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
        at com.microsoft.durabletask.implementation.protobuf.TaskHubSidecarServiceGrpc$TaskHubSidecarServiceBlockingStub.purgeInstances(TaskHubSidecarServiceGrpc.java:1184)
        at com.microsoft.durabletask.DurableTaskGrpcClient.purgeInstances(DurableTaskGrpcClient.java:275)
        at io.dapr.workflows.client.DaprWorkflowClient.purgeInstances(DaprWorkflowClient.java:252)
        at io.dapr.examples.workflows.DemoWorkflowClient.main(DemoWorkflowClient.java:85)

Are these two APIs (queryInstances - purgeInstances) supported or not yet? Durabletask Version: 1.1.0 Java Version: openjdk 11.0.19 Maven Version: Apache Maven 3.8.8

cgillum commented 1 year ago

Hi @Aymalla. These two APIs are not supported by Dapr Workflow today. The issue that makes it hard to support is the fact that Dapr Workflow relies on the Dapr Actors state store component to store workflow state, and state store components in Dapr don't support querying.

On the other hand, these APIs work fine with Durable Functions because the underlying Azure Storage backend does support queries.

No ETA yet on when Dapr will be able to support this. It may require an architectural change in order for Dapr Workflow to support this, and it's something the Dapr working group is actively thinking about.

One workaround would be to implement your own query store that is managed by you and separate from the workflow state store. Workflow queries would go against your own app-specific store and would not use the queryInstances API. For purge, you would need to query against your store and then issue individual purge commands using purgeInstance (single instance) for each workflow instance that you want to purge.

Aymalla commented 1 year ago

Thanks @cgillum !

cgillum commented 1 year ago

I'll go ahead and close this for now since it's expected behavior.