-
Notifications
You must be signed in to change notification settings - Fork 1.7k
GH-3276: Support async retry with @RetryableTopic #3523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
eee3515
fdc59f0
87ac522
723cc18
ac110b4
e30319d
6399b81
4a4a1ee
08e7721
c0fea39
e74072c
645d7ce
0c89c92
3f6b447
01de80e
97f05be
d219037
e8378da
967a7c4
f2c67c7
56e6fd3
5e70c76
1d9f7b9
e418b10
002aaf4
3b79d59
82ecac7
0afae4e
796397f
4e89d53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright 2016-2024 the original author or authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /** | ||
| * ... | ||
| * @author Sanghyeok An | ||
| * | ||
| * @since 3.3 | ||
| */ | ||
|
|
||
| package org.springframework.kafka.core; | ||
|
|
||
| import org.apache.kafka.clients.consumer.ConsumerRecord; | ||
|
|
||
| public record FailedRecordTuple<K, V>( | ||
| ConsumerRecord<K, V> record, | ||
| RuntimeException ex) { | ||
|
|
||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright 2015-2019 the original author or authors. | ||
| * Copyright 2015-2024 the original author or authors. | ||
|
||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
|
|
@@ -16,8 +16,12 @@ | |
|
|
||
| package org.springframework.kafka.listener; | ||
|
|
||
| import java.util.function.Consumer; | ||
|
|
||
| import org.apache.kafka.clients.consumer.ConsumerRecord; | ||
|
|
||
| import org.springframework.kafka.core.FailedRecordTuple; | ||
|
|
||
| /** | ||
| * Listener for handling individual incoming Kafka messages. | ||
| * | ||
|
|
@@ -26,8 +30,12 @@ | |
| * | ||
| * @author Marius Bogoevici | ||
| * @author Gary Russell | ||
| * @author Sanghyeok An | ||
| */ | ||
| @FunctionalInterface | ||
| public interface MessageListener<K, V> extends GenericMessageListener<ConsumerRecord<K, V>> { | ||
|
|
||
| default void setCallbackForAsyncFailureQueue(Consumer<FailedRecordTuple<K, V>> asyncRetryCallback) { | ||
artembilan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright 2018-2023 the original author or authors. | ||
| * Copyright 2018-2024 the original author or authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
|
|
@@ -25,6 +25,7 @@ | |
| import org.apache.kafka.clients.consumer.ConsumerRecord; | ||
| import org.apache.kafka.common.TopicPartition; | ||
|
|
||
| import org.springframework.kafka.core.FailedRecordTuple; | ||
| import org.springframework.kafka.listener.AcknowledgingConsumerAwareMessageListener; | ||
| import org.springframework.kafka.listener.KafkaBackoffException; | ||
| import org.springframework.kafka.listener.KafkaConsumerBackoffManager; | ||
|
|
@@ -43,6 +44,7 @@ | |
| * @param <K> the record key type. | ||
| * @param <V> the record value type. | ||
| * @author Tomaz Fernandes | ||
| * @author Sanghyeok An | ||
| * @since 2.7 | ||
| * | ||
| */ | ||
|
|
@@ -143,4 +145,9 @@ public void onMessage(ConsumerRecord<K, V> data, Acknowledgment acknowledgment) | |
| public void onMessage(ConsumerRecord<K, V> data, Consumer<?, ?> consumer) { | ||
| onMessage(data, null, consumer); | ||
| } | ||
|
|
||
|
||
| @Override | ||
| public void setCallbackForAsyncFailureQueue(java.util.function.Consumer<FailedRecordTuple<K, V>> callbackForAsyncFailureQueue) { | ||
| this.delegate.setCallbackForAsyncFailureQueue(callbackForAsyncFailureQueue); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.