'Is there any way in Quarkus to control the @incomming message from Kafka
I'm new to quarkus, I would like to listen to a kafka topic but only in some environments.
@Incoming("my-topic")
public void consumeCreation(Record<String, MyClass> record) {
MyClass teste = record.value();
(more code...)
}
I will use this topic to do some mocking, and I don't want to listen to it in the production environment. Is there any way to not run the @Incoming based on a variable?
Thanks for help.
Solution 1:[1]
The @Incoming method must be in a class which is a CDI bean. You can annotate that class with @UnlessBuildProfile("prod"), which means that the bean will be ignored in the prod profile.
This should let you control when will the @Incoming method be used. (If not, that would be a bug.)
There's a couple more annotations that let you do similar things:
@IfBuildProfile@IfBuildProperty@UnlessBuildProperty
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ladicek |
