package com.muyu.event.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;

/**
 * kafka监听
 * @author 刘武
 * @package：com.muyu.event.consumer
 * @name：KafkaConsumer
 * @date：2024/9/28 23:34
 */

public class KafkaConsumer {


    @KafkaListener(topics = "data")
    public void dataKafkaConsumer(ConsumerRecord<Object,Object> consumerRecord, Acknowledgment acknowledgment){
        Object key = consumerRecord.key();
        Object value = consumerRecord.value();

        //事件调用


        //消息确认消费
        acknowledgment.acknowledge();
    }


}
