Commit 3f33ec30 by Nepxion

重构类结构

parent 8860feac
...@@ -37,6 +37,11 @@ public class DiscoveryPluginConfig { ...@@ -37,6 +37,11 @@ public class DiscoveryPluginConfig {
} }
@Bean @Bean
public DiscoveryPluginConfigPublisher discoveryPluginConfigPublisher() {
return new DiscoveryPluginConfigPublisher();
}
@Bean
public DiscoveryEntity discoveryEntity() { public DiscoveryEntity discoveryEntity() {
return new DiscoveryEntity(); return new DiscoveryEntity();
} }
......
...@@ -62,7 +62,7 @@ public class DiscoveryPluginConfigLoader { ...@@ -62,7 +62,7 @@ public class DiscoveryPluginConfigLoader {
} }
@Subscribe @Subscribe
public void refresh(Event event) { public void subscribe(Event event) {
if (!remoteConfigEnabled) { if (!remoteConfigEnabled) {
return; return;
} }
......
...@@ -24,10 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,10 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.nepxion.discovery.plugin.config.DiscoveryPluginConfigPublisher;
import com.nepxion.discovery.plugin.loader.AbstractFileLoader; import com.nepxion.discovery.plugin.loader.AbstractFileLoader;
import com.nepxion.discovery.plugin.loader.FileLoader; import com.nepxion.discovery.plugin.loader.FileLoader;
import com.nepxion.eventbus.core.Event;
import com.nepxion.eventbus.core.EventControllerFactory;
@Component @Component
public class DiscoveryPluginSimulator { public class DiscoveryPluginSimulator {
...@@ -54,7 +53,7 @@ public class DiscoveryPluginSimulator { ...@@ -54,7 +53,7 @@ public class DiscoveryPluginSimulator {
// 模拟每隔15秒通过事件总线接收远程配置中心推送过来的配置更新 // 模拟每隔15秒通过事件总线接收远程配置中心推送过来的配置更新
@Autowired @Autowired
private EventControllerFactory eventControllerFactory; private DiscoveryPluginConfigPublisher discoveryPluginConfigPublisher;
@PostConstruct @PostConstruct
public void initialize() { public void initialize() {
...@@ -66,7 +65,7 @@ public class DiscoveryPluginSimulator { ...@@ -66,7 +65,7 @@ public class DiscoveryPluginSimulator {
// 本地文件模拟代替远程文件,随机读取 // 本地文件模拟代替远程文件,随机读取
int index = threadLocalRandom.nextInt(3) + 1; int index = threadLocalRandom.nextInt(3) + 1;
InputStream inputStream = createInputStream("src/main/resources/discovery" + index + ".xml"); InputStream inputStream = createInputStream("src/main/resources/discovery" + index + ".xml");
eventControllerFactory.getAsyncController().post(new Event(inputStream)); discoveryPluginConfigPublisher.publish(inputStream);
} }
}, 0L, 15000L); }, 0L, 15000L);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment