Skip to content
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

Kafka - Intercept incoming messages #2063

Closed
LeonardoFloriano opened this issue Jan 30, 2023 · 2 comments
Closed

Kafka - Intercept incoming messages #2063

LeonardoFloriano opened this issue Jan 30, 2023 · 2 comments
Labels

Comments

@LeonardoFloriano
Copy link

Is there any way to intercept incoming messages and extract the headers before being consumed ?
Similar to using a consumer interceptor in spring boot.

We need to change tenants before persisting any data.

@ozangunalp
Copy link
Collaborator

ozangunalp commented Jan 31, 2023

You can use the standard Kafka client interceptor ConsumerInterceptor

You can configure your implementation class using mp.messaging.incoming.$channel.interceptor.classes. It'll be instantiated by the Kafka client.

If that doesn't suit you, you can provide a decorator, in which you can modify the reactive stream per channel :
PublisherDecorator

More info on decorators: http://smallrye.io/smallrye-reactive-messaging/3.22.1/concepts/decorators/

@ozangunalp
Copy link
Collaborator

Closed fully by the IncomingInterceptors in #2244

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants