package com.lianjia.live.service.kafka.consumer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.annotation.TopicPartition;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class TestConsumer {
// 不指定分区partition
// @KafkaListener(topics = {"${spring.kafka.topic.test-sinan}"}, containerFactory = "testFactory")
//指定分区partition
@KafkaListener(topicPartitions = @TopicPartition(topic = "${spring.kafka.topic.test-sinan}",partitions = {"0","1","2"}),
containerFactory = "testFactory")
public void testConsume(String message) {
log.info("yf test message:{}", message);
}
}