You've already forked FrameTour-BE
feat(kafka): 移除Kafka集成服务
- 删除了KafkaIntegrationService类及其相关逻辑 - 移除了Kafka消息发送和连接测试功能 - 清理了未实现的预留接口方法 - 移除了相关的配置属性获取方法
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
package com.ycwl.basic.integration.kafka.service;
|
||||
|
||||
import com.ycwl.basic.integration.kafka.config.KafkaIntegrationProperties;
|
||||
import com.ycwl.basic.integration.kafka.dto.KafkaMessage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(name = "kafka.enabled", havingValue = "true")
|
||||
public class KafkaIntegrationService {
|
||||
|
||||
private final KafkaTemplate<String, String> kafkaTemplate;
|
||||
private final KafkaIntegrationProperties kafkaProperties;
|
||||
|
||||
/**
|
||||
* 测试Kafka连接
|
||||
*/
|
||||
public boolean testConnection() {
|
||||
try {
|
||||
log.info("Testing Kafka connection to: {}", kafkaProperties.getBootstrapServers());
|
||||
|
||||
// 尝试获取元数据以测试连接
|
||||
var metadata = kafkaTemplate.getProducerFactory().createProducer().partitionsFor("test-topic");
|
||||
log.info("Kafka connection test successful");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("Kafka connection test failed", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息(预留接口,暂不实现具体逻辑)
|
||||
*/
|
||||
public void sendMessage(String topic, String key, KafkaMessage<?> message) {
|
||||
log.info("Kafka message sending is not implemented yet. Topic: {}, Key: {}", topic, key);
|
||||
// TODO: 后续实现具体的消息发送逻辑
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Kafka配置信息
|
||||
*/
|
||||
public KafkaIntegrationProperties getKafkaProperties() {
|
||||
return kafkaProperties;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user