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
39d592bc
Commit
39d592bc
authored
Aug 25, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增强路由功能
parent
4ae12018
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
1 deletions
+28
-1
discovery-common/src/main/java/com/nepxion/discovery/common/constant/DiscoveryConstant.java
+0
-1
discovery-common/src/main/java/com/nepxion/discovery/common/entity/RouterEntity.java
+9
-0
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/RouterTopology.java
+4
-0
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/RouterEndpoint.java
+8
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/AbstractPluginAdapter.java
+5
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/PluginAdapter.java
+2
-0
No files found.
discovery-common/src/main/java/com/nepxion/discovery/common/constant/DiscoveryConstant.java
View file @
39d592bc
...
@@ -22,7 +22,6 @@ public class DiscoveryConstant {
...
@@ -22,7 +22,6 @@ public class DiscoveryConstant {
public
static
final
String
SPRING_APPLICATION_NAME
=
"spring.application.name"
;
public
static
final
String
SPRING_APPLICATION_NAME
=
"spring.application.name"
;
public
static
final
String
GROUP
=
"group"
;
public
static
final
String
GROUP
=
"group"
;
public
static
final
String
REGION
=
"region"
;
public
static
final
String
REGION
=
"region"
;
public
static
final
String
ZONE
=
"zone"
;
public
static
final
String
SERVICE_ID
=
"serviceId"
;
public
static
final
String
SERVICE_ID
=
"serviceId"
;
public
static
final
String
HOST
=
"host"
;
public
static
final
String
HOST
=
"host"
;
public
static
final
String
PORT
=
"port"
;
public
static
final
String
PORT
=
"port"
;
...
...
discovery-common/src/main/java/com/nepxion/discovery/common/entity/RouterEntity.java
View file @
39d592bc
...
@@ -24,6 +24,7 @@ public class RouterEntity implements Serializable {
...
@@ -24,6 +24,7 @@ public class RouterEntity implements Serializable {
private
String
serviceId
;
private
String
serviceId
;
private
String
version
;
private
String
version
;
private
String
region
;
private
String
host
;
private
String
host
;
private
int
port
;
private
int
port
;
private
int
weight
=
-
1
;
private
int
weight
=
-
1
;
...
@@ -48,6 +49,14 @@ public class RouterEntity implements Serializable {
...
@@ -48,6 +49,14 @@ public class RouterEntity implements Serializable {
this
.
version
=
version
;
this
.
version
=
version
;
}
}
public
String
getRegion
()
{
return
region
;
}
public
void
setRegion
(
String
region
)
{
this
.
region
=
region
;
}
public
String
getHost
()
{
public
String
getHost
()
{
return
host
;
return
host
;
}
}
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/RouterTopology.java
View file @
39d592bc
...
@@ -205,6 +205,10 @@ public class RouterTopology extends AbstractTopology {
...
@@ -205,6 +205,10 @@ public class RouterTopology extends AbstractTopology {
stringBuilder
.
append
(
"\n [V"
).
append
(
routerEntity
.
getVersion
()).
append
(
"]"
);
stringBuilder
.
append
(
"\n [V"
).
append
(
routerEntity
.
getVersion
()).
append
(
"]"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
routerEntity
.
getRegion
()))
{
stringBuilder
.
append
(
"\n [Region="
).
append
(
routerEntity
.
getRegion
()).
append
(
"]"
);
}
Map
<
String
,
String
>
customMap
=
routerEntity
.
getCustomMap
();
Map
<
String
,
String
>
customMap
=
routerEntity
.
getCustomMap
();
if
(
MapUtils
.
isNotEmpty
(
customMap
))
{
if
(
MapUtils
.
isNotEmpty
(
customMap
))
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
customMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
customMap
.
entrySet
())
{
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/RouterEndpoint.java
View file @
39d592bc
...
@@ -123,15 +123,21 @@ public class RouterEndpoint {
...
@@ -123,15 +123,21 @@ public class RouterEndpoint {
public
RouterEntity
getRouterEntity
()
{
public
RouterEntity
getRouterEntity
()
{
String
serviceId
=
pluginAdapter
.
getServiceId
();
String
serviceId
=
pluginAdapter
.
getServiceId
();
String
version
=
pluginAdapter
.
getVersion
();
String
version
=
pluginAdapter
.
getVersion
();
String
region
=
pluginAdapter
.
getRegion
();
String
host
=
pluginAdapter
.
getHost
();
String
host
=
pluginAdapter
.
getHost
();
int
port
=
pluginAdapter
.
getPort
();
int
port
=
pluginAdapter
.
getPort
();
int
weight
=
getWeight
(
serviceId
,
version
);
Map
<
String
,
String
>
customMap
=
getCustomMap
(
serviceId
);
String
contextPath
=
pluginAdapter
.
getContextPath
();
String
contextPath
=
pluginAdapter
.
getContextPath
();
RouterEntity
routerEntity
=
new
RouterEntity
();
RouterEntity
routerEntity
=
new
RouterEntity
();
routerEntity
.
setServiceId
(
serviceId
);
routerEntity
.
setServiceId
(
serviceId
);
routerEntity
.
setVersion
(
version
);
routerEntity
.
setVersion
(
version
);
routerEntity
.
setRegion
(
region
);
routerEntity
.
setHost
(
host
);
routerEntity
.
setHost
(
host
);
routerEntity
.
setPort
(
port
);
routerEntity
.
setPort
(
port
);
routerEntity
.
setWeight
(
weight
);
routerEntity
.
setCustomMap
(
customMap
);
routerEntity
.
setContextPath
(
contextPath
);
routerEntity
.
setContextPath
(
contextPath
);
return
routerEntity
;
return
routerEntity
;
...
@@ -155,6 +161,7 @@ public class RouterEndpoint {
...
@@ -155,6 +161,7 @@ public class RouterEndpoint {
Map
<
String
,
String
>
metadata
=
instance
.
getMetadata
();
Map
<
String
,
String
>
metadata
=
instance
.
getMetadata
();
String
serviceId
=
instance
.
getServiceId
().
toLowerCase
();
String
serviceId
=
instance
.
getServiceId
().
toLowerCase
();
String
version
=
metadata
.
get
(
DiscoveryConstant
.
VERSION
);
String
version
=
metadata
.
get
(
DiscoveryConstant
.
VERSION
);
String
region
=
metadata
.
get
(
DiscoveryConstant
.
REGION
);
String
host
=
instance
.
getHost
();
String
host
=
instance
.
getHost
();
int
port
=
instance
.
getPort
();
int
port
=
instance
.
getPort
();
int
weight
=
getWeight
(
routeServiceId
,
version
);
int
weight
=
getWeight
(
routeServiceId
,
version
);
...
@@ -164,6 +171,7 @@ public class RouterEndpoint {
...
@@ -164,6 +171,7 @@ public class RouterEndpoint {
RouterEntity
routerEntity
=
new
RouterEntity
();
RouterEntity
routerEntity
=
new
RouterEntity
();
routerEntity
.
setServiceId
(
serviceId
);
routerEntity
.
setServiceId
(
serviceId
);
routerEntity
.
setVersion
(
version
);
routerEntity
.
setVersion
(
version
);
routerEntity
.
setRegion
(
region
);
routerEntity
.
setHost
(
host
);
routerEntity
.
setHost
(
host
);
routerEntity
.
setPort
(
port
);
routerEntity
.
setPort
(
port
);
routerEntity
.
setWeight
(
weight
);
routerEntity
.
setWeight
(
weight
);
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/AbstractPluginAdapter.java
View file @
39d592bc
...
@@ -143,6 +143,11 @@ public abstract class AbstractPluginAdapter implements PluginAdapter {
...
@@ -143,6 +143,11 @@ public abstract class AbstractPluginAdapter implements PluginAdapter {
}
}
@Override
@Override
public
String
getRegion
()
{
return
getMetadata
().
get
(
DiscoveryConstant
.
REGION
);
}
@Override
public
String
getServerVersion
(
Server
server
)
{
public
String
getServerVersion
(
Server
server
)
{
return
getServerMetadata
(
server
).
get
(
DiscoveryConstant
.
VERSION
);
return
getServerMetadata
(
server
).
get
(
DiscoveryConstant
.
VERSION
);
}
}
...
...
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/adapter/PluginAdapter.java
View file @
39d592bc
...
@@ -49,6 +49,8 @@ public interface PluginAdapter {
...
@@ -49,6 +49,8 @@ public interface PluginAdapter {
void
clearDynamicRule
();
void
clearDynamicRule
();
String
getRegion
();
Map
<
String
,
String
>
getServerMetadata
(
Server
server
);
Map
<
String
,
String
>
getServerMetadata
(
Server
server
);
String
getServerVersion
(
Server
server
);
String
getServerVersion
(
Server
server
);
...
...
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