1

When i migrated spring-cloud-starter-stream-kafka to the version 3.2.5 i had many annotations that are duplicated, that i'm correcting

old consumer:

@StreamListener(value = KafkaStreams.INPUT_CATALOG, condition = "headers['catalog-code'] == 'CATPREST'")
public void receiveBenefitCategories(Message<ChangeNotification> changeNotification) {
    log.info("- - - - - - - - - - - - - - - - - - - Nature Of Change : {} - - - - - - - - - - - - - - - - -", changeNotification.getPayload().getNatureOfChange());
    log.info("- - - - - - - - - - - - - - - - - - - - - - PAYLOAD : {} - - - - - - - - - - - - - - - - -", changeNotification.getPayload());
}

new consumer:

@Bean
public Consumer<ChangeNotification> handleCatalogEvent() {
    return event -> {
        log.info("- - - - - - - - - - - - - - - - - - - Nature Of Change : {} - - - - - - - - - - - - - - - - -", event.getNatureOfChange());
        log.info("- - - - - - - - - - - - - - - - - - - - - - PAYLOAD : {} - - - - - - - - - - - - - - - - -", event.getItem());
    };
}

How can i add a conditionin the new consumer this the old condition = "headers['catalog-code'] == 'CATPREST'"

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Aymen Kanzari
  • 1,765
  • 7
  • 41
  • 73

0 Answers0