Skip to content

Commit

Permalink
NIFI-13991 Fix GetAwsTextractJobStatus so that a ProvisionedThroughpu…
Browse files Browse the repository at this point in the history
…tExceededException properly sends the flowfile to the "throttled" relationship.

This closes #9505.

Signed-off-by: Peter Turcsanyi <[email protected]>
  • Loading branch information
tpalfy authored and turcsanyip committed Nov 8, 2024
1 parent 4554aaf commit 8acb704
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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;

Expand Down Expand Up @@ -111,8 +112,9 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
} 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);
Expand Down

0 comments on commit 8acb704

Please sign in to comment.