1、修改@KafkaListener id topic为固定值
This commit is contained in:
@@ -8,6 +8,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
public class KafkaTopicConfig {
|
||||
@Bean
|
||||
public NewTopic batchTopic() {
|
||||
return new NewTopic("testTopic", 4, (short) 1);
|
||||
return new NewTopic("topic-alert", 4, (short) 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class KafkaConsumerService {
|
||||
this.alertMessageService = alertMessageService;
|
||||
}
|
||||
|
||||
@KafkaListener(id = "${spring.kafka.consumer.group-id}", topics = "${spring.kafka.consumer.topic-name}",
|
||||
@KafkaListener(id = "AlertGroup", topics = "topic-alert",
|
||||
errorHandler = "myKafkaListenerErrorHandler",
|
||||
properties = {"spring.json.value.default.type=com.realtime.protection.configuration.entity.alert.AlertMessage"})
|
||||
public void consume(AlertMessage alert, Acknowledgment ack) {
|
||||
|
||||
Reference in New Issue
Block a user