mirror of
https://gitee.com/shikong-sk/springcloud-study
synced 2024-11-09 01:51:19 +08:00
多分片并发消费
This commit is contained in:
parent
346ffe3d23
commit
aa7f659b23
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Component
|
@Component
|
||||||
public class MQListener {
|
public class MQListener {
|
||||||
|
|
||||||
@KafkaListener(topics = {"test"},groupId = "test-group")
|
@KafkaListener(topics = {"test"},groupId = "test-group", concurrency = "3")
|
||||||
public void onMessage(ConsumerRecord<String, String> record, Acknowledgment ack) {
|
public void onMessage(ConsumerRecord<String, String> record, Acknowledgment ack) {
|
||||||
log.info("消费消息: 主题 {} 分片 {} ",record.topic(),record.partition());
|
log.info("消费消息: 主题 {} 分片 {} ",record.topic(),record.partition());
|
||||||
log.info("key {}, value {}",record.key(),record.value());
|
log.info("key {}, value {}",record.key(),record.value());
|
||||||
|
Loading…
Reference in New Issue
Block a user