From 8acb7047d44e147e4a18b6b65e48c9a5d9f4f027 Mon Sep 17 00:00:00 2001 From: tpalfy Date: Fri, 8 Nov 2024 16:01:35 +0100 Subject: [PATCH] NIFI-13991 Fix GetAwsTextractJobStatus so that a ProvisionedThroughputExceededException properly sends the flowfile to the "throttled" relationship. This closes #9505. Signed-off-by: Peter Turcsanyi --- .../processors/aws/ml/textract/GetAwsTextractJobStatus.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/ml/textract/GetAwsTextractJobStatus.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/ml/textract/GetAwsTextractJobStatus.java index 2687735217..8cd5bd8ca5 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/ml/textract/GetAwsTextractJobStatus.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/ml/textract/GetAwsTextractJobStatus.java @@ -36,6 +36,7 @@ import software.amazon.awssdk.services.textract.model.GetDocumentAnalysisRequest import software.amazon.awssdk.services.textract.model.GetDocumentTextDetectionRequest; import software.amazon.awssdk.services.textract.model.GetExpenseAnalysisRequest; import software.amazon.awssdk.services.textract.model.JobStatus; +import software.amazon.awssdk.services.textract.model.ProvisionedThroughputExceededException; import software.amazon.awssdk.services.textract.model.TextractResponse; import software.amazon.awssdk.services.textract.model.ThrottlingException; @@ -111,8 +112,9 @@ public class GetAwsTextractJobStatus extends AbstractAwsMachineLearningJobStatus } else { throw new IllegalStateException("Unrecognized job status"); } - } catch (final ThrottlingException e) { + } catch (final ThrottlingException | ProvisionedThroughputExceededException e) { getLogger().info("Request Rate Limit exceeded", e); + context.yield(); session.transfer(flowFile, REL_THROTTLED); } catch (final Exception e) { getLogger().warn("Failed to get Textract Job status", e);