package com.xueyi.nlt.nlt.kafka;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class KafkaMessageConsumer {

    @KafkaListener(groupId = "simpleGroup", topics = "es_info_log")
    public void coumuser(@Payload String record, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) throws InterruptedException, IOException, IllegalAccessException {
        System.out.println(record);
        System.out.println(topic);
        return;
    }
}
