kafka消费者添加监听ID

This commit is contained in:
wanggeng 2021-12-27 16:09:45 +08:00
parent 87c43ee40b
commit 8fcdfa6d87

View File

@ -64,7 +64,7 @@ public class KafKaPublishConsumer implements ApplicationEventPublisherAware {
public KafKaPublishConsumer() { public KafKaPublishConsumer() {
} }
@KafkaListener(topics = {"C0021"}) @KafkaListener(id="UserCenter1", topics = "C0021")
public void gridRelation(ConsumerRecord<?, ?> record) { public void gridRelation(ConsumerRecord<?, ?> record) {
String recordValue = record.value().toString(); String recordValue = record.value().toString();
LOG.debug("Grid Relation(C0021) recordValue: {}", recordValue); LOG.debug("Grid Relation(C0021) recordValue: {}", recordValue);
@ -94,7 +94,7 @@ public class KafKaPublishConsumer implements ApplicationEventPublisherAware {
} }
} }
@KafkaListener(topics = {"C0022"}) @KafkaListener(id="UserCenter1", topics = "C0022")
public void mapGrid(ConsumerRecord<?, ?> record) { public void mapGrid(ConsumerRecord<?, ?> record) {
String recordValue = record.value().toString(); String recordValue = record.value().toString();
LOG.debug("Grid(C0022) recordValue: {}", recordValue); LOG.debug("Grid(C0022) recordValue: {}", recordValue);
@ -133,7 +133,7 @@ public class KafKaPublishConsumer implements ApplicationEventPublisherAware {
} }
} }
@KafkaListener(topics = {"C0023"}) @KafkaListener(id="UserCenter1", topics = "C0023")
public void mapGridPoint(ConsumerRecord<?, ?> record) { public void mapGridPoint(ConsumerRecord<?, ?> record) {
String recordValue = record.value().toString(); String recordValue = record.value().toString();
LOG.debug("Grid Point(C0023) recordValue: {}", recordValue); LOG.debug("Grid Point(C0023) recordValue: {}", recordValue);