GH-3188 Add Kafka Streams record interceptor#3197
Open
nikita-kibitkin wants to merge 1 commit into
Open
Conversation
Add a Kafka Streams-specific interceptor hook before event-type routing and user function processing. Signed-off-by: Nikita Kibitkin <nikita.n.kibitkin@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3188
Adds a Kafka Streams-specific
KafkaStreamsRecordInterceptorhook for inboundKStreamrecords, giving logging, metrics, tracing, and similar cross-cutting concerns a single place to observe records instead of repeating.peek()or.process()in every stream function.The interceptor runs as a side-effect Processor API node in
AbstractKafkaStreamsBinderProcessor.getKStream(), before event-type routing and before the user function receives the stream. It is observe-only: it does not mutate, filter, or deserialize records. Multiple interceptors are ordered via Spring's@Order, resolved throughgetBeanProvider(...).orderedStream(), so no separate composite type is needed.Scoped to the Kafka Streams binder only, and kept separate from the broader per-binding hook in #3137 per the issue discussion.
Changes:
KafkaStreamsRecordInterceptorandKafkaStreamsRecordInterceptorContextAbstractKafkaStreamsBinderProcessor.getKStream()