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.
The
@Incomingmethod 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 theprodprofile.This should let you control when will the
@Incomingmethod be used. (If not, that would be a bug.)There's a couple more annotations that let you do similar things:
@IfBuildProfile@IfBuildProperty@UnlessBuildProperty