Skip to content

Commit bad17d7

Browse files
committed
动态修改topics
1 parent cdc45d3 commit bad17d7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,3 +625,5 @@
625625
/springboot-mybatis-autoId/springboot-mybatis-autoId.iml
626626
/springboot-chaincontext/target/classes/com/github/lybgeek/chaincontext/
627627
/springboot-chaincontext/springboot-chaincontext.iml
628+
/springboot-chaincontext/target/classes/META-INF/
629+
/springboot-mq-idempotent-consume/target/classes/

springboot-mq-idempotent-consume/src/main/java/com/github/lybgeek/kafka/producer/interceptor/KafkaProducerInterceptor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.github.lybgeek.kafka.producer.interceptor;
22

3-
import com.alibaba.fastjson.JSON;
43
import com.github.lybgeek.kafka.dto.MessageDTO;
54
import lombok.extern.slf4j.Slf4j;
65
import org.apache.kafka.clients.producer.ProducerInterceptor;
@@ -25,7 +24,7 @@ public class KafkaProducerInterceptor implements ProducerInterceptor<String, Mes
2524
*/
2625
@Override
2726
public ProducerRecord<String, MessageDTO> onSend(ProducerRecord<String, MessageDTO> record) {
28-
log.info("onSend,orginalRecord:{}", JSON.toJSONString(record));
27+
log.info("原始topic:{}",record.topic());
2928
return new ProducerRecord<String, MessageDTO>(TOPIC_KEY_PREFIX + record.topic(),
3029
record.partition(),record.timestamp(),record.key(), record.value());
3130
}
@@ -40,7 +39,7 @@ public ProducerRecord<String, MessageDTO> onSend(ProducerRecord<String, MessageD
4039
*/
4140
@Override
4241
public void onAcknowledgement(RecordMetadata metadata, Exception exception) {
43-
42+
log.info("实际topic:{}",metadata.topic());
4443
}
4544

4645

0 commit comments

Comments
 (0)