Skip to content

@ExponentialRetry is not working #45

@agghimanshu

Description

@agghimanshu

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

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions