Skip to content

Commit

Permalink
Add method
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenchickenlove committed Oct 6, 2024
1 parent 723cc18 commit ac110b4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,19 @@ protected void asyncFailure(Object request, @Nullable Acknowledgment acknowledgm
catch (Throwable ex) {
this.logger.error(t, () -> "Future, Mono, or suspend function was completed with an exception for " + source);
acknowledge(acknowledgment);
if (request instanceof ConsumerRecord &&
ex instanceof RuntimeException) {
if (canAsyncRetry(request, ex)) {
ConsumerRecord<K, V> record = (ConsumerRecord<K, V>) request;
FailedRecordTuple failedRecordTuple = new FailedRecordTuple(record, (RuntimeException) ex);
this.callbackForAsyncFailureQueue.accept(failedRecordTuple);
}
}
}

private boolean canAsyncRetry(Object request, Throwable exception) {
// The async retry with @RetryableTopic only support in case of SingleRecord Listener.
return request instanceof ConsumerRecord && exception instanceof RuntimeException;
}

protected void handleException(Object records, @Nullable Acknowledgment acknowledgment, Consumer<?, ?> consumer,
Message<?> message, ListenerExecutionFailedException e) {

Expand Down

0 comments on commit ac110b4

Please sign in to comment.