Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1908 from Netflix/event_processor_extension
Browse files Browse the repository at this point in the history
Allow customization of handling transient failures
  • Loading branch information
aravindanr committed Oct 5, 2020
2 parents d6b5ca9 + 5fbaba7 commit d4c550f
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,24 @@ protected List<EventExecution> executeEvent(String event, Message msg) throws Ex
CompletableFuture<List<EventExecution>> future = executeActionsForEventHandler(eventHandler, msg);
future.whenComplete((result, error) -> result.forEach(eventExecution -> {
if (error != null || eventExecution.getStatus() == Status.IN_PROGRESS) {
executionService.removeEventExecution(eventExecution);
transientFailures.add(eventExecution);
} else {
executionService.updateEventExecution(eventExecution);
}
})).get();
}
return transientFailures;
return processTransientFailures(transientFailures);
}

/**
* Remove the event executions which failed temporarily.
*
* @param eventExecutions The event executions which failed with a transient error.
* @return The event executions which failed with a transient error.
*/
protected List<EventExecution> processTransientFailures(List<EventExecution> eventExecutions) {
eventExecutions.forEach(executionService::removeEventExecution);
return eventExecutions;
}

/**
Expand Down

0 comments on commit d4c550f

Please sign in to comment.