diff --git a/sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskFailureDetails.java b/sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskFailureDetails.java index a6e4158a9..db4c0c506 100644 --- a/sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskFailureDetails.java +++ b/sdk-workflows/src/main/java/io/dapr/workflows/WorkflowTaskFailureDetails.java @@ -17,6 +17,7 @@ public class WorkflowTaskFailureDetails { private final String errorType; private final String errorMessage; private final String stackTrace; + private final boolean isNonRetriable; /** * Constructor for WorkflowTaskFailureDetails. @@ -24,14 +25,17 @@ public class WorkflowTaskFailureDetails { * @param errorType The type of error * @param errorMessage The error message * @param stackTrace The stacktrace of the error + * @param isNonRetriable Whether the failure is retriable or not */ public WorkflowTaskFailureDetails( String errorType, String errorMessage, - String stackTrace) { + String stackTrace, + boolean isNonRetriable) { this.errorType = errorType; this.errorMessage = errorMessage; this.stackTrace = stackTrace; + this.isNonRetriable = isNonRetriable; } /** @@ -64,6 +68,14 @@ public class WorkflowTaskFailureDetails { return this.stackTrace; } + /** + * Returns {@code true} if the failure doesn't permit retries, otherwise {@code false}. + * @return {@code true} if the failure doesn't permit retries, otherwise {@code false}. + */ + public boolean isNonRetriable() { + return this.isNonRetriable; + } + /** * Returns {@code true} if the task failure was provided by the specified exception type, otherwise {@code false}. * diff --git a/sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java b/sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java index 099fc3732..6ac072442 100644 --- a/sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java +++ b/sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowContext.java @@ -273,7 +273,8 @@ public class DefaultWorkflowContext implements WorkflowContext { WorkflowTaskFailureDetails workflowFailureDetails = new WorkflowTaskFailureDetails( failureDetails.getErrorType(), failureDetails.getErrorMessage(), - failureDetails.getStackTrace() + failureDetails.getStackTrace(), + failureDetails.isNonRetriable() ); WorkflowTaskRetryContext workflowRetryContext = new WorkflowTaskRetryContext( this,