Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
3f33ec30
Commit
3f33ec30
authored
Jun 22, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构类结构
parent
8860feac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
discovery-plugin/src/main/java/com/nepxion/discovery/plugin/config/DiscoveryPluginConfig.java
+5
-0
discovery-plugin/src/main/java/com/nepxion/discovery/plugin/config/DiscoveryPluginConfigLoader.java
+1
-1
discovery-springcloud-example-a/src/main/java/com/nepxion/discovery/plugin/example/DiscoveryPluginSimulator.java
+3
-4
No files found.
discovery-plugin/src/main/java/com/nepxion/discovery/plugin/config/DiscoveryPluginConfig.java
View file @
3f33ec30
...
@@ -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
();
}
}
...
...
discovery-plugin/src/main/java/com/nepxion/discovery/plugin/config/DiscoveryPluginConfigLoader.java
View file @
3f33ec30
...
@@ -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
;
}
}
...
...
discovery-springcloud-example-a/src/main/java/com/nepxion/discovery/plugin/example/DiscoveryPluginSimulator.java
View file @
3f33ec30
...
@@ -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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment