nifi-1509 catch recoverable service exceptions explicity

This commit is contained in:
mans2singh 2016-02-12 09:22:41 -08:00
parent cd05bedda8
commit 528c4bc591
1 changed files with 9 additions and 3 deletions

View File

@ -194,13 +194,19 @@ public class PutLambda extends AbstractAWSLambdaProcessor {
new Object[]{functionName, unrecoverableException, flowFile}); new Object[]{functionName, unrecoverableException, flowFile});
flowFile = populateExceptionAttributes(session, flowFile, unrecoverableException); flowFile = populateExceptionAttributes(session, flowFile, unrecoverableException);
session.transfer(flowFile, REL_FAILURE); session.transfer(flowFile, REL_FAILURE);
} catch (final ServiceException | TooManyRequestsException exception) { } catch (final TooManyRequestsException retryableServiceException) {
getLogger().error("Failed to invoke lambda {} with exception {} for flow file {}, therefore penalizing flowfile", getLogger().error("Failed to invoke lambda {} with exception {} for flow file {}, therefore penalizing flowfile",
new Object[]{functionName, exception, flowFile}); new Object[]{functionName, retryableServiceException, flowFile});
flowFile = populateExceptionAttributes(session, flowFile, exception); flowFile = populateExceptionAttributes(session, flowFile, retryableServiceException);
flowFile = session.penalize(flowFile); flowFile = session.penalize(flowFile);
session.transfer(flowFile, REL_FAILURE); session.transfer(flowFile, REL_FAILURE);
context.yield(); context.yield();
} catch (final AmazonServiceException unrecoverableServiceException) {
getLogger().error("Failed to invoke lambda {} with exception {} for flow file {} sending to fail",
new Object[]{functionName, unrecoverableServiceException, flowFile});
flowFile = populateExceptionAttributes(session, flowFile, unrecoverableServiceException);
session.transfer(flowFile, REL_FAILURE);
context.yield();
} catch (final Exception exception) { } catch (final Exception exception) {
getLogger().error("Failed to invoke lambda {} with exception {} for flow file {}", getLogger().error("Failed to invoke lambda {} with exception {} for flow file {}",
new Object[]{functionName, exception, flowFile}); new Object[]{functionName, exception, flowFile});