Class KafkaListeners

java.lang.Object
api.mpba.rastvdmy.config.utils.KafkaListeners

@Component public class KafkaListeners extends Object
This class is responsible for listening to Kafka messages. It uses the @KafkaListener annotation to subscribe to "messages" topics. The listener method logs the received message and any potential processing errors.
  • Constructor Details

    • KafkaListeners

      public KafkaListeners()
  • Method Details

    • listener

      @KafkaListener(topics="messages", groupId="messagesId") public void listener(String data, @Header("kafka_receivedMessageKey") String key)
      This method is a Kafka listener that gets triggered when a message arrives in the "messages" topic. It logs the received message and any potential processing errors.
      Parameters:
      data - The message data.
      key - The key of the message.