【发布时间】:2020-08-02 03:48:32
【问题描述】:
我正在寻找 java 中 cadence 的重试选项示例,例如我正在尝试下面的代码 sn-p 但似乎没有重试该活动
@ActivityMethod(scheduleToCloseTimeoutSeconds = 30)
@MethodRetry(maximumAttempts = 2, initialIntervalSeconds = 1, expirationSeconds = 30, maximumIntervalSeconds = 30)
String getGreetingContentOverTheWeb(URL url) throws IOException;
对于上述活动,我希望如果失败应该自动重试,下面是我的调用方式
@Override
public String getGreeting(String name) {
// This is a blocking call that returns only after the activity has completed.
try {
String content = activities.getGreetingContentOverTheWeb(new URL("http://localhost:3000/import-map/books"));
return activities.composeGreeting(content, name);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return activities.composeGreeting("Hello", name);
}
如果我在这里做错了什么,请告诉我,
下面是前端截图
【问题讨论】:
-
工作流执行历史中ActivityTaskScheduled事件的attempt字段的值是多少?
-
嗨@MaximFateev,为您的查询添加了工作流执行的屏幕截图
标签: java cadence-workflow