You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tu...@apache.org on 2024/11/08 20:15:26 UTC

(nifi) branch main updated: NIFI-13991 Fix GetAwsTextractJobStatus so that a ProvisionedThroughputExceededException properly sends the flowfile to the "throttled" relationship.

This is an automated email from the ASF dual-hosted git repository.

turcsanyi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 8acb7047d4 NIFI-13991 Fix GetAwsTextractJobStatus so that a ProvisionedThroughputExceededException properly sends the flowfile to the "throttled" relationship.
8acb7047d4 is described below

commit 8acb7047d44e147e4a18b6b65e48c9a5d9f4f027
Author: tpalfy <tp...@apache.org>
AuthorDate: Fri Nov 8 16:01:35 2024 +0100

    NIFI-13991 Fix GetAwsTextractJobStatus so that a ProvisionedThroughputExceededException properly sends the flowfile to the "throttled" relationship.
    
    This closes #9505.
    
    Signed-off-by: Peter Turcsanyi <tu...@apache.org>
---
 .../nifi/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);