|
@@ -0,0 +1,33 @@
|
|
|
+package com.citygis.web.config;
|
|
|
+
|
|
|
+import lombok.Data;
|
|
|
+import org.apache.kafka.clients.admin.AdminClient;
|
|
|
+import org.apache.kafka.clients.admin.AdminClientConfig;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+
|
|
|
+import java.util.Properties;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Package com.shcd.config
|
|
|
+ * @Author zyl
|
|
|
+ * @Date 2024/5/29 0029 10:34
|
|
|
+ * @description: kafka配置类
|
|
|
+ */
|
|
|
+@Configuration
|
|
|
+@Data
|
|
|
+public class KafkaConfig {
|
|
|
+
|
|
|
+ @Value("${kafka.ip}")
|
|
|
+ private String ip;
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public AdminClient adminClient() {
|
|
|
+ Properties properties = new Properties();
|
|
|
+ properties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, ip);
|
|
|
+ return AdminClient.create(properties);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|