1

I am looking for retry option example for cadence in java, for example I am trying below code snippet but it seems the activity is not re-tried

@ActivityMethod(scheduleToCloseTimeoutSeconds = 30)
@MethodRetry(maximumAttempts = 2, initialIntervalSeconds = 1, expirationSeconds = 30, maximumIntervalSeconds = 30)
String getGreetingContentOverTheWeb(URL url) throws IOException;

for the above activity I am expecting that if it fails should be re-tried automatically, below is how I am calling it

@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);
    
}

Please let me know if I am doing anything incorrect here,

Below is the snapshot from the frontend

enter image description here

4

1 回答 1

1

从事件历史来看,该活动似乎已重试。我是通过观察ActivityTaskStarted.attempt场地确定的。那里的次数等于重试次数。因此,活动按照指定的重试策略准确执行了两次。

我知道这个名字非常令人困惑,因为尝试应该从 1 而不是从 0 开始。我们已经在我的团队维护的temporal.io Cadence 分支中修复了这个问题。

于 2020-08-01T18:47:22.413 回答