package com.elab.core.kafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

/**
 * @Module TODO
 * @Description TODO
 * @Author liukaixiong
 * @Date 2020/10/27 16:36
 */
@Component
public class ConsumerListener extends AbstractKafkaConsumer {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public String subscribeTopic() {
        return "test-mysql-dts";
    }

    @Override
    public void onMessage(ConsumerRecord<String, String> data, Acknowledgment acknowledgment) {
        logger.info("------->" + data);
        //int i = 1/0;
    }
    //    @KafkaListener(topics = {"uat-mysql-dts"})
//    public void listen(ConsumerRecord<?, ?> record, Acknowledgment ack) {
//        logger.info("kafka : " + record.topic());
//    }
}
