-
Notifications
You must be signed in to change notification settings - Fork 3k
modify dubbo plugin configuration based on selector #5953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
modify dubbo plugin configuration based on selector #5953
Conversation
...-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
Outdated
Show resolved
Hide resolved
...-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
Outdated
Show resolved
Hide resolved
...-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java
Outdated
Show resolved
Hide resolved
…ector' into feature/dubbo-config-base-on-selector
@Wweiei if u got time, fix the conflicts |
…g-base-on-selector # Conflicts: # db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql # db/upgrade/2.7.0-upgrade-2.7.1-ob.sql # db/upgrade/2.7.0-upgrade-2.7.1-og.sql # db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql # db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
|
@Wweiei hi, fix the ci, pls |
…g-base-on-selector # Conflicts: # db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql # db/upgrade/2.7.0-upgrade-2.7.1-ob.sql # db/upgrade/2.7.0-upgrade-2.7.1-og.sql # db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql # db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@Wweiei fix ci pls |
…g-base-on-selector # Conflicts: # db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql # db/upgrade/2.7.0-upgrade-2.7.1-ob.sql # db/upgrade/2.7.0-upgrade-2.7.1-og.sql # db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql # db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@@ -21,7 +21,7 @@ spring: | |||
application: | |||
name: shenyu-admin | |||
profiles: | |||
active: h2 | |||
active: mysql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not change this configuration
/** | ||
* The constant string separator. | ||
*/ | ||
String SEPARATOR_UNDERLINE = "_"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is existed
address: zookeeper://localhost:2181 | ||
|
||
address: nacos://127.0.0.1:8849?namespace=namespace1 | ||
# address: zookeeper://localhost:2181 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change this?
|
||
address: nacos://127.0.0.1:8849?namespace=namespace1 | ||
# address: zookeeper://localhost:2181 | ||
|
||
shenyu: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not add this
} | ||
|
||
ReferenceConfig<GenericService> reference = new ReferenceConfig<>(); | ||
reference.setGeneric("true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why "true"? not true?
Optional.ofNullable(dubboUpstream.getVersion()).ifPresent(registryConfigTemp::setVersion); | ||
if (StringUtils.isNotBlank(namespace)) { | ||
if (!registryConfigTemp.getAddress().contains(Constants.NAMESPACE)) { | ||
registryConfigTemp.setAddress(registryConfigTemp.getAddress() + "?" + Constants.NAMESPACE + "=" + namespace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use common method!
: dubboUpstreams.stream().filter(u -> u.isStatus() && StringUtils.isNotBlank(u.getRegistry())).collect(Collectors.toList()); | ||
// if dubboUpstreams is empty, use default plugin config | ||
if (CollectionUtils.isEmpty(dubboUpstreams)) { | ||
referenceKey = StringUtils.isNotBlank(namespace) ? namespace + ":" + referenceKey : referenceKey; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add common variable
List<Upstream> upstreams = this.convertUpstreamList(dubboUpstreams); | ||
String ip = Objects.requireNonNull(exchange.getRequest().getRemoteAddress()).getAddress().getHostAddress(); | ||
Upstream upstream = LoadBalancerFactory.selector(upstreams, LoadBalanceEnum.RANDOM.getName(), ip); | ||
DubboUpstream dubboUpstream = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
judge null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 12 out of 22 changed files in this pull request and generated 1 comment.
Files not reviewed (10)
- db/init/mysql/schema.sql: Language not supported
- db/init/ob/schema.sql: Language not supported
- db/init/og/create-table.sql: Language not supported
- db/init/oracle/schema.sql: Language not supported
- db/init/pg/create-table.sql: Language not supported
- db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql: Language not supported
- db/upgrade/2.7.0-upgrade-2.7.1-ob.sql: Language not supported
- db/upgrade/2.7.0-upgrade-2.7.1-og.sql: Language not supported
- db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql: Language not supported
- db/upgrade/2.7.0-upgrade-2.7.1-pg.sql: Language not supported
Upstream upstream = LoadBalancerFactory.selector(upstreams, LoadBalanceEnum.RANDOM.getName(), ip); | ||
DubboUpstream dubboUpstream = null; | ||
for (DubboUpstream upstreamItem : dubboUpstreams) { | ||
if (Objects.equals(upstreamItem.getRegistry(), upstreamItem.getRegistry()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-comparison of 'upstreamItem.getRegistry()' is detected. It is likely intended to compare 'upstreamItem.getRegistry()' with 'upstream.getRegistry()'.
if (Objects.equals(upstreamItem.getRegistry(), upstreamItem.getRegistry()) | |
if (Objects.equals(upstreamItem.getRegistry(), upstream.getRegistry()) |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
complete task 4 in #5923 , modify dubbo registry config base on selector.
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true
.