microsoft / microsoft/durabletask-java

Wrap gRPC StatusRuntimeException across all client and worker gRPC calls

未关闭
#274 0 条评论 1 个 reaction 已指派 2 人 在 GitHub 查看

@bachuv 已经在做这个了。

开始于 2026年4月7日。

  • #278 来自 @copilot-swe-agent —— 已关闭,未合并
Enhancement
主要语言
Java
星标
29
派生
18
平均合并
1 天 10 小时
30 天内合并 PR
2

描述

Summary

Most gRPC calls in the Java SDK let raw io.grpc.StatusRuntimeException escape to callers. The .NET SDK wraps RpcException (at minimum StatusCode.CancelledOperationCanceledException) for all entity client methods. The Java SDK should provide consistent domain-level exception wrapping so callers don't need to depend on gRPC types and so we can have .NET feature parity.

Current Behavior

The majority of gRPC methods across DurableTaskGrpcClient, GrpcDurableEntityClient, and DurableTaskGrpcWorker let StatusRuntimeException propagate unwrapped:

DurableTaskGrpcClient — no wrapping:

  • suspendInstance()
  • resumeInstance()
  • terminate()
  • raiseEvent()
  • createInstanceWithRaise()
  • getInstanceMetadata()

DurableTaskGrpcClient — wraps specific codes only:

  • waitForInstanceStart()DEADLINE_EXCEEDEDTimeoutException
  • waitForInstanceCompletion()DEADLINE_EXCEEDEDTimeoutException
  • purgeInstances()DEADLINE_EXCEEDEDTimeoutException
  • rewindInstance()NOT_FOUNDIllegalArgumentException, FAILED_PRECONDITIONIllegalStateException

GrpcDurableEntityClient — no wrapping:

  • signalEntity()
  • getEntityMetadata()
  • queryEntities()
  • cleanEntityStorage()

DurableTaskGrpcWorker — no wrapping:

  • completeActivityTask()
  • completeOrchestratorTask()
  • completeEntityTask()

Expected Behavior

gRPC transport exceptions should be translated into SDK-level exceptions. At minimum:

  • CANCELLEDCancellationException (closest Java equivalent to .NET's OperationCanceledException)
  • NOT_FOUNDIllegalArgumentException or a dedicated not-found exception
  • DEADLINE_EXCEEDEDTimeoutException (already done for some methods)

.NET SDK Reference

The .NET GrpcDurableEntityClient wraps RpcException for every entity method:

catch (RpcException e) when (e.StatusCode == StatusCode.Cancelled)
{
    throw new OperationCanceledException(
        $"The {nameof(this.SignalEntityAsync)} operation was canceled.", e, cancellation);
}

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。