In Cadence, I am using the activity inside Async.func. In an activity, i am throwing exception when i am not getting the desired result so that it should retry. Inside the workflow, I have defined my activity as
private final Activity1 activity1 = Workflow.newActivityStub(Activity1.class, new ActivityOptions.Builder()
.setScheduleToCloseTimeout(Duration.ofMinutes(30))
.setRetryOptions(
new RetryOptions.Builder()
.setMaximumAttempts(3)
.setInitialInterval(Duration.ofSeconds(10))
.setMaximumInterval(Duration.ofSeconds(15))
.setExpiration(Duration.ofSeconds(60))
.build()).build());
And my activity code is :
@Override
public Boolean methodB(Config config){
try{
return clientA.method(config);
}catch(Exception e){
log.error("Failed with exception!");
throw e;
}
}
Inside the workflow, i am calling this activity method in Async like:
List<Promise<Boolean>> promises = new ArrayList<>();
for (Config config : Configs) {
Promise<Boolean> promise = Async.function(
() -> activity1.methodB(config)
);
promises.add(promise);
}
Workflow.await(() -> promises.stream().allMatch(Promise::isCompleted));
In cadence web, it is showing in pending state,
But retry is not working. I am not getting why this is happening
I also wants that if all the retry attempt failed then it should return false.