@WorkflowImpl(taskQueues = Workflows.TaskQueues.SAMPLE_SHELL)
public class SampleWorkflowImpl implements SampleWorkflow {
private final SampleActivity activity;
/**
* Default constructor for the SampleWorkflowImpl class.
*/
public SampleWorkflowImpl() {
// Define retry options with a maximum number of attempts, instead of hardcoding read from application.yaml
RetryOptions retryOptions = RetryOptions.newBuilder()
.setMaximumAttempts(1)
.build();
// Set activity options with a timeout of 2 minutes
ActivityOptions activityOptions = ActivityOptions.newBuilder()
.setStartToCloseTimeout(Duration.parse("PT2M")) // 2 minutes timeout
.setRetryOptions(retryOptions)
.build();
// Create an activity stub with the specified options
this.activity = Workflow.newActivityStub(SampleActivity.class, activityOptions);
}
}
Additionally, I would like to configure setMaximumAttempts
and setStartToCloseTimeout
values to be read from the Spring configuration in the application.yaml
file. I have also initiated workflows using the auto-discovery feature found at sdk-java/temporal-spring-boot-autoconfigure at master · temporalio/sdk-java · GitHub. Could you please assist me with this?