I Have the following code, i want to provide the "topicName" as paramater or read it dynamically from a property, is the possible
@KafkaListener(offsetReset = OffsetReset.EARLIEST)
public class KafkaConsumer {
private final String topicName;
public KafkaConsumer(String topicName) {
this.topicName = topicName;
}
@Topic("topicName")
public void receive(@KafkaKey String day, String message) {
System.out.println("Got Message for the - " + day + " and Message is " + message);
}
}
You can do: