Skip to content

GH-3542: Adds the ability to add record interceptors instead of override them #3937

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

Merged
merged 15 commits into from
Jun 16, 2025
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,11 @@ public void setKafkaAdmin(KafkaAdmin kafkaAdmin) {
this.kafkaAdmin = kafkaAdmin;
}

protected @Nullable RecordInterceptor<K, V> getRecordInterceptor() {
/**
* Get the {@link RecordInterceptor} for modification, if configured.
* @return the {@link RecordInterceptor}, or {@code null} if not configured
*/
public @Nullable RecordInterceptor<K, V> getRecordInterceptor() {
return this.recordInterceptor;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*
* @author Artem Bilan
* @author Gary Russell
* @author Sanghyeok An
* @since 2.3
*
*/
Expand Down Expand Up @@ -92,4 +93,13 @@ public void afterRecord(ConsumerRecord<K, V> record, Consumer<K, V> consumer) {
this.delegates.forEach(del -> del.afterRecord(record, consumer));
}

/**
* Add an {@link RecordInterceptor} to delegates.
* @param recordInterceptor the interceptor.
* @since 4.0
*/
public void addRecordInterceptor(RecordInterceptor<K, V> recordInterceptor) {
this.delegates.add(recordInterceptor);
}

}