NIFI-13991 Fix GetAwsTextractJobStatus so that a ProvisionedThroughputExceededException properly sends the flowfile to the "throttled" relationship.

This closes #9505.

Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
This commit is contained in:
tpalfy 2024-11-08 16:01:35 +01:00 committed by Peter Turcsanyi
parent 4554aaf5b6
commit 8acb7047d4
No known key found for this signature in database
GPG Key ID: 55A813F1C3E553DC
1 changed files with 3 additions and 1 deletions

View File

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