-
Notifications
You must be signed in to change notification settings - Fork 54
Description
https://docs.aws.amazon.com/amazonswf/latest/awsflowguide/features-retry.html
After following above document for ExponentialRetry, our activities are not retrying automatically as mentioned in the document.
Is there any other thing needed apart from adding @ExponentialRetry on the Activity method.
Below is my Sample code-----
@activities
@ActivityRegistrationOptions(defaultTaskScheduleToStartTimeoutSeconds = 30, defaultTaskStartToCloseTimeoutSeconds = 30)
public interface IMyActivities {
@Activity(name = "PrintHello", version = "24.0")
@ExponentialRetry(
initialRetryIntervalSeconds = 1,
exceptionsToRetry = IllegalStateException.class,
maximumAttempts = 5)
String printHello();
@Activity(name = "PrintBye", version = "18.0")
void printBye(String x);
}
@workflow
@WorkflowRegistrationOptions(defaultExecutionStartToCloseTimeoutSeconds = 60, defaultTaskStartToCloseTimeoutSeconds = 30)
public interface IWorkflow {
@Execute(name = "DemoWorkflow", version = "11.0")
void start();
@GetState
String getState();
}
@component
@Setter
public class WorkflowServiceImpl implements IWorkflow {
private String state = "Started";
IMyActivitiesClientImpl client = new IMyActivitiesClientImpl();
@Override
public void start() {
System.out.println("before calling");
this.handleActivity();
System.out.println("after calling");
}
@Override
public String getState() {
System.out.println("state-----" +state);
return state;
}
private void handleActivity(){
Promise<String> result = client.printHello();
client.printBye(result);
}
}
public class MyActivitiesImpl implements IMyActivities {
private boolean check = true;
@Override
public String printHello() {
System.out.println("In activity 1111");
if (check) {
check = false;
System.out.println("121212121");
throw new IllegalStateException("showing this for the first time from this activity");
}
return "Hello World";
}
@Override
public void printBye(String name) {
System.out.println("In activity 2222 " + name);
}
}