This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 89cf9020d Fixed several bugs about motan rpc plugin (#4934)
89cf9020d is described below
commit 89cf9020db40ab3e365c0861db642060135f1301
Author: coderDylan <[email protected]>
AuthorDate: Thu Aug 3 15:17:10 2023 +0800
Fixed several bugs about motan rpc plugin (#4934)
* Fixed several bugs about motan rpc plugin
1.Upgraded motan support to the latest stable version
2.Fixed an issue where motan generalization calls failed when arguments
were java primitive types or custom types
3.Fixed the motan registry hard coding issue and supported the
configuration extension
4.Fixed the schema.sql syntax problem in h2 database scenario
* Fix code style for Checkstyle
* Fix code style for Checkstyle
* Fixed code style for Checkstyle
* Fixed code for UnitTest
* Fixed code for integrated-test
* support og\oracle\pg database
* upgrade the motan version for fixed the ci
* upgrade the motan version for fixed the ci
* update sql
* update sql
* update sql
* update sql
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix ci
* fix throw exception
---------
Co-authored-by: xiaoyu <[email protected]>
Co-authored-by: dragon-zhang <[email protected]>
Co-authored-by: moremind <[email protected]>
Co-authored-by: Kunshuai Zhu <[email protected]>
---
db/init/mysql/schema.sql | 14 +--
db/init/og/create-table.sql | 13 +--
db/init/oracle/schema.sql | 7 +-
db/init/pg/create-table.sql | 13 +--
db/upgrade/2.5.1-upgrade-2.6.0-mysql.sql | 10 ++
db/upgrade/2.5.1-upgrade-2.6.0-oracle.sql | 5 +
db/upgrade/2.5.1-upgrade-2.6.0-pg.sql | 10 ++
pom.xml | 2 +-
.../src/main/resources/sql-script/h2/schema.sql | 15 +--
.../dto/convert/plugin/MotanRegisterConfig.java | 72 +++++++++-----
.../convert/plugin/MotanRegisterConfigTest.java | 8 +-
.../src/test/resources/docker-compose.mysql.yml | 21 ++--
.../src/test/resources/docker-compose.mysql.yml | 15 +--
.../src/test/resources/docker-compose.mysql.yml | 15 +--
.../src/test/resources/docker-compose.mysql.yml | 57 +++++------
.../service/impl/MotanClassDemoServiceImpl.java | 6 +-
.../motan/service/impl/MotanDemoServiceImpl.java | 4 +-
.../src/main/resources/application.yml | 2 +-
.../shenyu-integrated-test-combination/pom.xml | 8 +-
.../test/combination/SharedThreadPoolTest.java | 2 +-
.../shenyu-integrated-test-motan/pom.xml | 8 +-
.../test/motan/MotanPluginShareThreadPoolTest.java | 2 +-
.../integrated/test/motan/MotanPluginTest.java | 2 +-
.../plugin/motan/cache/ApplicationConfigCache.java | 106 ++++++++++-----------
.../plugin/motan/proxy/MotanProxyService.java | 11 ++-
.../motan/handler/MotanPluginDataHandlerTest.java | 4 +-
26 files changed, 252 insertions(+), 180 deletions(-)
diff --git a/db/init/mysql/schema.sql b/db/init/mysql/schema.sql
index 593ebb5d3..fd6ff2fb4 100644
--- a/db/init/mysql/schema.sql
+++ b/db/init/mysql/schema.sql
@@ -800,7 +800,7 @@ INSERT INTO `plugin` VALUES ('13', 'tars',
'{\"multiSelectorHandle\":\"1\",\"mul
INSERT INTO `plugin` VALUES ('14', 'contextPath', NULL, 'HttpProcess', 80, 1,
'2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
INSERT INTO `plugin` VALUES ('15', 'grpc',
'{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\",\"threadpool\":\"shared\"}',
'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
INSERT INTO `plugin` VALUES ('16', 'redirect', NULL, 'HttpProcess', 110, 0,
'2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
-INSERT INTO `plugin` VALUES ('17', 'motan',
'{\"register\":\"127.0.0.1:2181\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}',
'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
+INSERT INTO `plugin` VALUES ('17', 'motan',
'{\"registerProtocol\":\"direct\",\"registerAddress\":\"127.0.0.1:2181\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}',
'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
INSERT INTO `plugin` VALUES ('18', 'loggingConsole', NULL, 'Logging', 160, 0,
'2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
INSERT INTO `plugin` VALUES ('19', 'jwt', '{\"secretKey\":\"key\"}',
'Authentication', 30, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
INSERT INTO `plugin` VALUES ('2', 'waf', '{\"model\":\"black\"}',
'Authentication', 50, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null);
@@ -974,11 +974,11 @@ INSERT INTO `plugin_handle` VALUES
('1529402613204172830', '26', 'loadBalance',
INSERT INTO `plugin_handle` VALUES ('1529402613204172831', '26', 'retry',
'retryCount', 1, 2, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53');
INSERT INTO `plugin_handle` VALUES ('1529402613204172832', '26', 'timeout',
'timeout', 1, 2, 2, '{\"defaultValue\":\"3000\",\"rule\":\"\"}', '2022-05-25
18:02:53', '2022-05-25 18:02:53');
INSERT INTO `plugin_handle` VALUES ('1529402613204172833', '26',
'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25
18:02:53', '2022-05-25 18:02:53');
-INSERT INTO `plugin_handle` VALUES ('1529402613204172834', '17', 'register',
'register', 2, 3, 0, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53');
-INSERT INTO `plugin_handle` VALUES ('1529402613204172835', '17',
'corethreads', 'corethreads', 1, 3, 0,
'{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
-INSERT INTO `plugin_handle` VALUES ('1529402613204172836', '17', 'threads',
'threads', 1, 3, 0,
'{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
-INSERT INTO `plugin_handle` VALUES ('1529402613204172837', '17', 'queues',
'queues', 1, 3, 0,
'{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
-INSERT INTO `plugin_handle` VALUES ('1529402613204172838', '17', 'threadpool',
'threadpool', 3, 3, 0,
'{\"required\":\"0\",\"defaultValue\":\"cached\",\"placeholder\":\"threadpool\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
+INSERT INTO `plugin_handle` VALUES ('1529402613204172834', '17',
'registerProtocol', 'registerProtocol', 2, 3, 0,
'{\"required\":\"0\",\"defaultValue\":\"direct\",\"placeholder\":\"registerProtocol\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
+INSERT INTO `plugin_handle` VALUES ('1529402613204172835', '17',
'corethreads', 'corethreads', 1, 3, 2,
'{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"corethreads\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
+INSERT INTO `plugin_handle` VALUES ('1529402613204172836', '17', 'threads',
'threads', 1, 3, 3,
'{\"required\":\"0\",\"defaultValue\":\"2147483647\",\"placeholder\":\"threads\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
+INSERT INTO `plugin_handle` VALUES ('1529402613204172837', '17', 'queues',
'queues', 1, 3, 4,
'{\"required\":\"0\",\"defaultValue\":\"0\",\"placeholder\":\"queues\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
+INSERT INTO `plugin_handle` VALUES ('1529402613204172838', '17', 'threadpool',
'threadpool', 3, 3, 5,
'{\"required\":\"0\",\"defaultValue\":\"cached\",\"placeholder\":\"threadpool\",\"rule\":\"\"}',
'2022-05-25 18:02:53', '2022-05-25 18:02:53');
INSERT INTO `plugin_handle` VALUES ('1529402613204172839', '28', 'port',
'port', 1, 3, 1, NULL, '2022-05-25 18:02:53', '2022-05-25 18:02:53');
INSERT INTO `plugin_handle` VALUES ('1529402613204172840', '28',
'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25
18:02:53', '2022-05-25 18:02:53');
INSERT INTO `plugin_handle` VALUES ('1529402613204172841', '28',
'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:02:53',
'2022-05-25 18:02:53');
@@ -1159,6 +1159,8 @@ INSERT INTO `plugin_handle` VALUES
('1678997769998467072', '42', 'clientMaxLifeT
INSERT INTO `plugin_handle` VALUES ('1678997277012557824', '42',
'clientMaxConnections', 'clientMaxConnections', 2, 1, 6,
'{\"required\":\"0\",\"defaultValue\":\"20\",\"rule\":\"\"}', '2023-01-10
10:08:01.158', '2023-01-10 10:08:01.158');
INSERT INTO `plugin_handle` VALUES ('1678997557628272640', '42',
'clientPendingAcquireTimeout', 'clientPendingAcquireTimeout', 2, 1, 5,
'{\"required\":\"0\",\"defaultValue\":\"5\",\"rule\":\"\"}', '2023-01-10
10:08:01.158', '2023-01-10 10:08:01.158');
+INSERT INTO `plugin_handle` VALUES ('1678997557628272641', '17',
'registerAddress', 'registerAddress', 2, 3, 1,
'{\"required\":\"0\",\"defaultValue\":\"127.0.0.1:2181\",\"placeholder\":\"registerAddress\",\"rule\":\"\"}',
'2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158');
+
-- ----------------------------
-- Table structure for resource
-- ----------------------------
diff --git a/db/init/og/create-table.sql b/db/init/og/create-table.sql
index 9e89c26dc..a3db200a4 100644
--- a/db/init/og/create-table.sql
+++ b/db/init/og/create-table.sql
@@ -934,7 +934,7 @@ INSERT INTO "public"."plugin" VALUES ('13', 'tars',
'{"multiSelectorHandle":"1",
INSERT INTO "public"."plugin" VALUES ('14', 'contextPath', NULL,
'HttpProcess', 80, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('15', 'grpc',
'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}',
'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('16', 'redirect', NULL, 'HttpProcess',
110, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
-INSERT INTO "public"."plugin" VALUES ('17', 'motan',
'{"register":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}',
'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
+INSERT INTO "public"."plugin" VALUES ('17', 'motan',
'{"registerProtocol":"direct",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}',
'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('18', 'loggingConsole', NULL, 'Logging',
160, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('19', 'jwt', '{"secretKey":"key"}',
'Authentication', 30, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('2', 'waf', '{"model":"black"}',
'Authentication', 50, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
@@ -1118,11 +1118,12 @@ INSERT INTO "public"."plugin_handle" VALUES
('1529403902783524875', '26', 'loadB
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524876', '26',
'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:08:01', '2022-05-25
18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524877', '26',
'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}', '2022-05-25
18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524878', '26',
'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25
18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524879', '17',
'register', 'register', 2, 3, 0, NULL, '2022-05-25 18:08:01', '2022-05-25
18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524880', '17',
'corethreads', 'corethreads', 1, 3, 0,
'{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524881', '17',
'threads', 'threads', 1, 3, 0,
'{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524882', '17',
'queues', 'queues', 1, 3, 0,
'{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524883', '17',
'threadpool', 'threadpool', 3, 3, 0,
'{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524879', '17',
'registerProtocol', 'registerProtocol', 2, 3, 0,
'{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1678997557628272641', '17',
'registerAddress', 'registerAddress', 2, 3, 1,
'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524880', '17',
'corethreads', 'corethreads', 1, 3, 2,
'{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524881', '17',
'threads', 'threads', 1, 3, 3,
'{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524882', '17',
'queues', 'queues', 1, 3, 4,
'{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524883', '17',
'threadpool', 'threadpool', 3, 3, 5,
'{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524884', '28',
'port', 'port', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524885', '28',
'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25
18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524886', '28',
'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:08:01',
'2022-05-25 18:08:01');
diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql
index bcc5ec4f3..e8f879274 100644
--- a/db/init/oracle/schema.sql
+++ b/db/init/oracle/schema.sql
@@ -1116,7 +1116,7 @@ INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO
plugin (id, name, role
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, enabled) VALUES ('14', 'contextPath', 'HttpProcess', 80,'1');
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, config, enabled) VALUES ('15', 'grpc', 'Proxy',
310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0');
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, enabled) VALUES ('16', 'redirect', 'HttpProcess', 110,'0');
-INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, config, enabled) VALUES ('17', 'motan', 'Proxy',
310,'{"register":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}','0');
+INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, config, enabled) VALUES ('17', 'motan', 'Proxy',
310,'{"registerProtocol":"direct",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}','0');
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, enabled) VALUES ('18', 'loggingConsole', 'Logging', 160, '0');
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, config, enabled) VALUES ('19', 'jwt', 'Authentication', 30,
'{"secretKey":"key"}', '0');
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name,
role, sort, enabled) VALUES ('20', 'request', 'HttpProcess', 120, '0');
@@ -1219,7 +1219,10 @@ insert /*+
IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type)) */
values ('1518229897214468141', '26', 'multiSelectorHandle',
'multiSelectorHandle', 3, 3, 0, null);
insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type))
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT,
EXT_OBJ)
-values ('1518229897214468142', '17', 'register', 'register', 2, 3, 0, null);
+values ('1518229897214468142', '17', 'registerProtocol', 'registerProtocol',
2, 3, 0,
'{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}');
+
+insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type))
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT,
EXT_OBJ)
+values ('1679002911061737473', '17', 'registerAddress', 'registerAddress', 2,
3, 1,
'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}');
insert /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type))
*/ into plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT,
EXT_OBJ)
values ('1518229897214468143', '28', 'port', 'port', 1, 3, 1, null);
diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql
index ab23ef806..5661ea77f 100644
--- a/db/init/pg/create-table.sql
+++ b/db/init/pg/create-table.sql
@@ -934,7 +934,7 @@ INSERT INTO "public"."plugin" VALUES ('13', 'tars',
'{"multiSelectorHandle":"1",
INSERT INTO "public"."plugin" VALUES ('14', 'contextPath', NULL,
'HttpProcess', 80, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('15', 'grpc',
'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}',
'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('16', 'redirect', NULL, 'HttpProcess',
110, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
-INSERT INTO "public"."plugin" VALUES ('17', 'motan',
'{"register":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}',
'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
+INSERT INTO "public"."plugin" VALUES ('17', 'motan',
'{"registerProtocol":"direct",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}',
'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('18', 'loggingConsole', NULL, 'Logging',
160, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('19', 'jwt', '{"secretKey":"key"}',
'Authentication', 30, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
INSERT INTO "public"."plugin" VALUES ('2', 'waf', '{"model":"black"}',
'Authentication', 50, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null);
@@ -1117,11 +1117,12 @@ INSERT INTO "public"."plugin_handle" VALUES
('1529403902783524875', '26', 'loadB
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524876', '26',
'retry', 'retryCount', 1, 2, 1, NULL, '2022-05-25 18:08:01', '2022-05-25
18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524877', '26',
'timeout', 'timeout', 1, 2, 2, '{"defaultValue":"3000","rule":""}', '2022-05-25
18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524878', '26',
'multiSelectorHandle', 'multiSelectorHandle', 3, 3, 0, NULL, '2022-05-25
18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524879', '17',
'register', 'register', 2, 3, 0, NULL, '2022-05-25 18:08:01', '2022-05-25
18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524880', '17',
'corethreads', 'corethreads', 1, 3, 0,
'{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524881', '17',
'threads', 'threads', 1, 3, 0,
'{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524882', '17',
'queues', 'queues', 1, 3, 0,
'{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
-INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524883', '17',
'threadpool', 'threadpool', 3, 3, 0,
'{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524879', '17',
'registerProtocol', 'registerProtocol', 2, 3, 0,
'{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1678997557628272641', '17',
'registerAddress', 'registerAddress', 2, 3, 1,
'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524880', '17',
'corethreads', 'corethreads', 1, 3, 2,
'{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524881', '17',
'threads', 'threads', 1, 3, 3,
'{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524882', '17',
'queues', 'queues', 1, 3, 4,
'{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524883', '17',
'threadpool', 'threadpool', 3, 3, 5,
'{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524884', '28',
'port', 'port', 1, 3, 1, NULL, '2022-05-25 18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524885', '28',
'bossGroupThreadCount', 'bossGroupThreadCount', 1, 3, 1, NULL, '2022-05-25
18:08:01', '2022-05-25 18:08:01');
INSERT INTO "public"."plugin_handle" VALUES ('1529403902783524886', '28',
'maxPayloadSize', 'maxPayloadSize', 1, 3, 1, NULL, '2022-05-25 18:08:01',
'2022-05-25 18:08:01');
diff --git a/db/upgrade/2.5.1-upgrade-2.6.0-mysql.sql
b/db/upgrade/2.5.1-upgrade-2.6.0-mysql.sql
index 765efe5a7..26f46c5c5 100644
--- a/db/upgrade/2.5.1-upgrade-2.6.0-mysql.sql
+++ b/db/upgrade/2.5.1-upgrade-2.6.0-mysql.sql
@@ -168,3 +168,13 @@ INSERT INTO `plugin_handle` VALUES ('1678996921914392576',
'42', 'loadBalance',
INSERT INTO `plugin_handle` VALUES ('1678997769998467072', '42',
'clientMaxLifeTimeMs', 'clientMaxLifeTimeMs', 2, 1, 8,
'{\"required\":\"0\",\"defaultValue\":\"60000\",\"rule\":\"\"}', '2023-01-10
10:08:01.158', '2023-01-10 10:08:01.158');
INSERT INTO `plugin_handle` VALUES ('1678997277012557824', '42',
'clientMaxConnections', 'clientMaxConnections', 2, 1, 6,
'{\"required\":\"0\",\"defaultValue\":\"20\",\"rule\":\"\"}', '2023-01-10
10:08:01.158', '2023-01-10 10:08:01.158');
INSERT INTO `plugin_handle` VALUES ('1678997557628272640', '42',
'clientPendingAcquireTimeout', 'clientPendingAcquireTimeout', 2, 1, 5,
'{\"required\":\"0\",\"defaultValue\":\"5\",\"rule\":\"\"}', '2023-01-10
10:08:01.158', '2023-01-10 10:08:01.158');
+
+/* motan rpc */
+UPDATE `plugin` set config =
'{\"registerProtocol\":\"direct\",\"registerAddress\":\"127.0.0.1:8002\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0,\"threadpool\":\"shared\"}'
WHERE id = '17';
+UPDATE `plugin_handle` set field = 'registerProtocol', label =
'registerProtocol', sort = 0, ext_obj =
'{\"required\":\"0\",\"defaultValue\":\"direct\",\"placeholder\":\"registerProtocol\",\"rule\":\"\"}'
WHERE id = '1529402613204172834';
+UPDATE `plugin_handle` set sort = 2 where id = '1529402613204172835';
+UPDATE `plugin_handle` set sort = 3 where id = '1529402613204172836';
+UPDATE `plugin_handle` set sort = 4 where id = '1529402613204172837';
+UPDATE `plugin_handle` set sort = 5 where id = '1529402613204172838';
+
+INSERT INTO `plugin_handle` VALUES ('1678997557628272641', '17',
'registerAddress', 'registerAddress', 2, 3, 1,
'{\"required\":\"0\",\"defaultValue\":\"127.0.0.1:8002\",\"placeholder\":\"registerAddress\",\"rule\":\"\"}',
'2023-01-10 10:08:01.158', '2023-01-10 10:08:01.158'));
diff --git a/db/upgrade/2.5.1-upgrade-2.6.0-oracle.sql
b/db/upgrade/2.5.1-upgrade-2.6.0-oracle.sql
index cec53d4fc..7112b19f0 100644
--- a/db/upgrade/2.5.1-upgrade-2.6.0-oracle.sql
+++ b/db/upgrade/2.5.1-upgrade-2.6.0-oracle.sql
@@ -298,3 +298,8 @@ VALUES ('1678997277012557824', '42',
'clientMaxConnections', 'clientMaxConnectio
INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin_handle(plugin_id, field, type))
*/ INTO plugin_handle (ID, PLUGIN_ID, FIELD, LABEL, DATA_TYPE, TYPE, SORT,
EXT_OBJ)
VALUES ('1678997557628272640', '42', 'clientPendingAcquireTimeout',
'clientPendingAcquireTimeout', 2, 1, 5,
'{"required":"0","defaultValue":"5","rule":""}');
+
+UPDATE "public"."plugin" set config =
'{"registerProtocol":"direct",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}'
WHERE id = '17';
+UPDATE "public"."plugin_handle" set field = 'registerProtocol', label =
'registerProtocol', sort = 0, ext_obj =
'{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}'
where id = '1518229897214468142';
+
+INSERT INTO "public"."plugin_handle" VALUES ('1678997557628272641', '17',
'registerAddress', 'registerAddress', 2, 3, 1,
'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
diff --git a/db/upgrade/2.5.1-upgrade-2.6.0-pg.sql
b/db/upgrade/2.5.1-upgrade-2.6.0-pg.sql
index e1a2464a2..505359c71 100644
--- a/db/upgrade/2.5.1-upgrade-2.6.0-pg.sql
+++ b/db/upgrade/2.5.1-upgrade-2.6.0-pg.sql
@@ -226,3 +226,13 @@ VALUES('1678997277012557824', '42',
'clientMaxConnections', 'clientMaxConnection
INSERT INTO "public"."plugin_handle"
(id, plugin_id, field, "label", data_type, "type", sort, ext_obj,
date_created, date_updated)
VALUES('1678997557628272640', '42', 'clientPendingAcquireTimeout',
'clientPendingAcquireTimeout', 2, 1, 5,
'{"required":"0","defaultValue":"5","rule":""}', '2023-07-12 13:19:47.000',
'2023-07-12 13:23:33.253');
+
+UPDATE "public"."plugin" set config =
'{"registerProtocol":"direct",registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}'
WHERE id = '17';
+UPDATE "public"."plugin_handle" set field = 'registerProtocol', label =
'registerProtocol', ext_obj =
'{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}'
where id = '1529403902783524879';
+UPDATE "public"."plugin_handle" set sort = 2 where id = '1529403902783524880';
+UPDATE "public"."plugin_handle" set sort = 3 where id = '1529403902783524881';
+UPDATE "public"."plugin_handle" set sort = 4 where id = '1529403902783524882';
+UPDATE "public"."plugin_handle" set sort = 5 where id = '1529403902783524883';
+
+INSERT INTO "public"."plugin_handle" VALUES ('1678997557628272641', '17',
'registerAddress', 'registerAddress', 2, 3, 1,
'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}',
'2022-05-25 18:08:01', '2022-05-25 18:08:01');
+
diff --git a/pom.xml b/pom.xml
index b336e38dd..fe4ceeaed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,7 +132,7 @@
<zkclient.version>0.10</zkclient.version>
<shiro.version>1.8.0</shiro.version>
<jwt.version>3.12.0</jwt.version>
- <motan.version>1.2.0</motan.version>
+ <motan.version>1.2.1</motan.version>
<spring-boot.version>2.7.13</spring-boot.version>
<aspectjweaver.version>1.9.6</aspectjweaver.version>
<h2.version>1.4.200</h2.version>
diff --git a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
index 94170b073..449df6662 100755
--- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
+++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql
@@ -522,7 +522,7 @@ INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`,
`config`, `enabled`)
INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES
('14', 'contextPath', 'HttpProcess', 80,'1');
INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,
`enabled`) VALUES ('15', 'grpc', 'Proxy',
310,'{"multiSelectorHandle":"1","multiRuleHandle":"0","threadpool":"shared"}','0');
INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES
('16', 'redirect', 'HttpProcess', 110,'0');
-INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,
`enabled`) VALUES ('17', 'motan', 'Proxy',
310,'{"register":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}','0');
+INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,
`enabled`) VALUES ('17', 'motan', 'Proxy',
310,'{"registerProtocol":"direct","registerAddress":"127.0.0.1:2181","corethreads":0,"threads":2147483647,"queues":0,"threadpool":"shared"}','0');
INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES
('18', 'loggingConsole', 'Logging', 160, '0');
INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,
`enabled`) VALUES ('19', 'jwt', 'Authentication', 30, '{"secretKey":"key"}',
'0');
INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES
('20', 'request', 'HttpProcess', 120, '0');
@@ -670,11 +670,11 @@ INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES
('1529402613204172831', '26', 'retry', 'retryCount', 1, 2, 1);
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172832', '26', 'timeout', 'timeout', 1, 2, 2,
'{"defaultValue":"3000","rule":""}');
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES
('1529402613204172833', '26', 'multiSelectorHandle', 'multiSelectorHandle', 3,
3, 0);
-INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES
('1529402613204172834', '17', 'register', 'register', 2, 3, 0);
-INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172835', '17', 'corethreads', 'corethreads', 1, 3, 0,
'{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}');
-INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172836', '17', 'threads', 'threads', 1, 3, 0,
'{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}');
-INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172837', '17', 'queues', 'queues', 1, 3, 0,
'{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}');
-INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172838', '17', 'threadpool', 'threadpool', 3, 3, 0,
'{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172834', '17', 'registerProtocol', 'registerProtocol', 2, 3, 0,
'{"required":"0","defaultValue":"direct","placeholder":"registerProtocol","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172835', '17', 'corethreads', 'corethreads', 1, 3, 2,
'{"required":"0","defaultValue":"0","placeholder":"corethreads","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172836', '17', 'threads', 'threads', 1, 3, 3,
'{"required":"0","defaultValue":"2147483647","placeholder":"threads","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172837', '17', 'queues', 'queues', 1, 3, 4,
'{"required":"0","defaultValue":"0","placeholder":"queues","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1529402613204172838', '17', 'threadpool', 'threadpool', 3, 3, 5,
'{"required":"0","defaultValue":"cached","placeholder":"threadpool","rule":""}');
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES
('1529402613204172839', '28', 'port', 'port', 1, 3, 1);
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES
('1529402613204172840', '28', 'bossGroupThreadCount', 'bossGroupThreadCount',
1, 3, 1);
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`) VALUES
('1529402613204172841', '28', 'maxPayloadSize', 'maxPayloadSize', 1, 3, 1);
@@ -861,6 +861,9 @@ INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1678997277012557824', '42', 'clientMaxConnections', 'clientMaxConnections',
2, 1, 6, '{"required":"0","defaultValue":"20","rule":""}');
INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1678997557628272640', '42', 'clientPendingAcquireTimeout',
'clientPendingAcquireTimeout', 2, 1, 5,
'{"required":"0","defaultValue":"5","rule":""}');
+INSERT IGNORE INTO plugin_handle (`id`,
`plugin_id`,`field`,`label`,`data_type`,`type`,`sort`,`ext_obj`) VALUES
('1678997557628272641', '17', 'registerAddress', 'registerAddress', 2, 3,
1,'{"required":"0","defaultValue":"127.0.0.1:2181","placeholder":"registerAddress","rule":""}');
+
+
/** insert resource for resource */
INSERT IGNORE INTO `resource` (`id`, `parent_id`, `title`, `name`, `url`,
`component`, `resource_type`, `sort`, `icon`, `is_leaf`, `is_route`, `perms`,
`status`)
VALUES('1346775491550474240','','SHENYU.MENU.PLUGIN.LIST','plug','/plug','PluginList','0','0','dashboard','0','0','','1');
diff --git
a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java
b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java
index f4f29b9be..90624a4ca 100644
---
a/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java
+++
b/shenyu-common/src/main/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfig.java
@@ -21,13 +21,15 @@ import java.io.Serializable;
import java.util.Objects;
/**
- * Motan register config.
+ * The type motan register config.
*/
public class MotanRegisterConfig implements Serializable {
private static final long serialVersionUID = 2488053756247710408L;
- private String register;
+ private String registerProtocol;
+
+ private String registerAddress;
private String threadpool;
@@ -55,23 +57,6 @@ public class MotanRegisterConfig implements Serializable {
this.threadpool = threadpool;
}
- /**
- * get register.
- *
- * @return register
- */
- public String getRegister() {
- return register;
- }
-
- /**
- * set register.
- *
- * @param register register
- */
- public void setRegister(final String register) {
- this.register = register;
- }
/**
* get corethreads.
@@ -94,7 +79,7 @@ public class MotanRegisterConfig implements Serializable {
/**
* get threads.
*
- * @return threads
+ * @return threads threads
*/
public Integer getThreads() {
return threads;
@@ -127,6 +112,42 @@ public class MotanRegisterConfig implements Serializable {
this.queues = queues;
}
+ /**
+ * get RegisterProtocol.
+ *
+ * @return registerProtocol
+ */
+ public String getRegisterProtocol() {
+ return registerProtocol;
+ }
+
+ /**
+ * set registerProtocol.
+ *
+ * @param registerProtocol registerProtocol
+ */
+ public void setRegisterProtocol(final String registerProtocol) {
+ this.registerProtocol = registerProtocol;
+ }
+
+ /**
+ * get RegisterAddress.
+ *
+ * @return registerAddress
+ */
+ public String getRegisterAddress() {
+ return registerAddress;
+ }
+
+ /**
+ * set RegisterAddress.
+ *
+ * @param registerAddress registerAddress
+ */
+ public void setRegisterAddress(final String registerAddress) {
+ this.registerAddress = registerAddress;
+ }
+
@Override
public boolean equals(final Object o) {
if (this == o) {
@@ -136,21 +157,24 @@ public class MotanRegisterConfig implements Serializable {
return false;
}
MotanRegisterConfig that = (MotanRegisterConfig) o;
- return Objects.equals(register, that.register) &&
Objects.equals(threadpool, that.threadpool)
+ return Objects.equals(registerProtocol, that.registerProtocol) &&
Objects.equals(registerAddress, that.registerAddress) &&
Objects.equals(threadpool, that.threadpool)
&& Objects.equals(corethreads, that.corethreads) &&
Objects.equals(threads, that.threads)
&& Objects.equals(queues, that.queues);
}
@Override
public int hashCode() {
- return Objects.hash(register, threadpool, corethreads, threads,
queues);
+ return Objects.hash(registerProtocol, registerAddress, threadpool,
corethreads, threads, queues);
}
@Override
public String toString() {
return "MotanRegisterConfig{"
- + "register='"
- + register
+ + "registerProtocol='"
+ + registerProtocol
+ + '\''
+ + ", registerAddress='"
+ + registerAddress
+ '\''
+ ", threadpool='"
+ threadpool
diff --git
a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java
b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java
index 034e01dbb..8471d2d9b 100644
---
a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java
+++
b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/plugin/MotanRegisterConfigTest.java
@@ -32,12 +32,14 @@ public class MotanRegisterConfigTest {
@Test
public void testGetterSetter() {
MotanRegisterConfig config = new MotanRegisterConfig();
- config.setRegister("reg");
+ config.setRegisterAddress("reg");
+ config.setRegisterProtocol("zk");
config.setCorethreads(10);
config.setThreads(10);
config.setQueues(2);
-
- assertThat(config.getRegister(), is("reg"));
+
+ assertThat(config.getRegisterAddress(), is("reg"));
+ assertThat(config.getRegisterProtocol(), is("zk"));
assertThat(config.getCorethreads(), is(10));
assertThat(config.getThreads(), is(10));
assertThat(config.getQueues(), is(2));
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
index 83eb20529..2790efa70 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/resources/docker-compose.mysql.yml
@@ -19,7 +19,7 @@ version: '2.3'
services:
zookeeper:
- image: zookeeper:3.5
+ image: zookeeper:3.8.0
restart: always
expose:
- 2181
@@ -27,7 +27,8 @@ services:
test: ["CMD", "curl", "-f", "http://localhost:8080/commands/stat"]
interval: 10s
timeout: 5s
- retries: 3
+ retries: 10
+ start_period: 30s
nacos:
image: nacos/nacos-server:v2.2.3
@@ -43,6 +44,7 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 30s
admin:
image: shenyu/admin:latest
@@ -52,11 +54,11 @@ services:
- "9095:9095"
depends_on:
mysql:
- condition: service_healthy
+ condition: service_started
nacos:
- condition: service_healthy
+ condition: service_started
zookeeper:
- condition: service_healthy
+ condition: service_started
volumes:
-
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
-
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
@@ -69,7 +71,7 @@ services:
test: [ "CMD-SHELL", "wget -q -O - http://admin:9095/actuator/health |
grep UP || exit 1" ]
timeout: 2s
retries: 3
- start_period: 5s
+ start_period: 30s
dubbo:
image: shenyu-examples-alibaba-dubbo-service:latest
@@ -78,7 +80,7 @@ services:
test: [ "CMD-SHELL", "wget -q -O - http://dubbo:8011/actuator/health |
grep UP || exit 1" ]
timeout: 2s
retries: 3
- start_period: 5s
+ start_period: 20s
ports:
- "8011:8011"
- "20888:20888"
@@ -96,7 +98,7 @@ services:
ports:
- "9195:9195"
depends_on:
- dubbo:
+ admin:
condition: service_healthy
volumes:
-
../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml
@@ -104,7 +106,7 @@ services:
test: [ "CMD", "wget", "-q", "-O", "-",
"http://gateway:9195/actuator/health" ]
timeout: 2s
retries: 3
- start_period: 5s
+ start_period: 30s
mysql:
image: mysql:8
@@ -117,5 +119,6 @@ services:
interval: 2s
timeout: 20s
retries: 10
+ start_period: 60s
volumes:
- /tmp/shenyu-e2e/mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql
\ No newline at end of file
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
index 783418e22..506d9c450 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/resources/docker-compose.mysql.yml
@@ -19,7 +19,7 @@ version: '2.3'
services:
zookeeper:
- image: zookeeper:3.8
+ image: zookeeper:3.8.0
restart: always
expose:
- 2181
@@ -28,6 +28,7 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 30s
nacos:
image: nacos/nacos-server:v2.2.3
@@ -43,6 +44,7 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 30s
admin:
image: shenyu/admin:latest
@@ -52,11 +54,11 @@ services:
- "9095:9095"
depends_on:
mysql:
- condition: service_healthy
+ condition: service_started
nacos:
- condition: service_healthy
+ condition: service_started
zookeeper:
- condition: service_healthy
+ condition: service_started
environment:
- SPRING_PROFILES_ACTIVE=mysql
- spring.datasource.username=shenyue2e
@@ -69,7 +71,7 @@ services:
test: [ "CMD-SHELL", "wget -q -O - http://admin:9095/actuator/health |
grep UP || exit 1" ]
timeout: 2s
retries: 3
- start_period: 5s
+ start_period: 10s
dubbo:
image: shenyu-examples-apache-dubbo-service:latest
@@ -96,7 +98,7 @@ services:
ports:
- "9195:9195"
depends_on:
- dubbo:
+ admin:
condition: service_healthy
volumes:
-
../../target/test-classes/bootstrap-application.yml:/opt/shenyu-bootstrap/conf/application.yml
@@ -117,5 +119,6 @@ services:
interval: 3s
timeout: 30s
retries: 5
+ start_period: 60s
volumes:
- /tmp/shenyu-e2e/mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql
\ No newline at end of file
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml
index d5b4113a3..0c59c62e4 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/resources/docker-compose.mysql.yml
@@ -19,7 +19,7 @@ version: '2.3'
services:
zookeeper:
- image: zookeeper:3.5
+ image: zookeeper:3.8.0
restart: always
expose:
- 2181
@@ -28,6 +28,7 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 40s
nacos:
image: nacos/nacos-server:v2.2.3
@@ -43,6 +44,7 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 30s
admin:
image: shenyu/admin:latest
@@ -52,11 +54,11 @@ services:
- "9095:9095"
depends_on:
zookeeper:
- condition: service_healthy
+ condition: service_started
nacos:
- condition: service_healthy
+ condition: service_started
mysql:
- condition: service_healthy
+ condition: service_started
volumes:
-
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
-
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
@@ -69,7 +71,7 @@ services:
test: [ "CMD-SHELL", "wget -q -O - http://admin:9095/actuator/health |
grep UP || exit 1" ]
timeout: 2s
retries: 3
- start_period: 5s
+ start_period: 10s
sofa:
image: shenyu-examples-sofa:latest
@@ -81,7 +83,7 @@ services:
test: ["CMD", "nc", "-z", "localhost", "28011"]
timeout: 2s
retries: 3
- start_period: 5s
+ start_period: 10s
expose:
- 28011
- 8888
@@ -120,5 +122,6 @@ services:
interval: 2s
timeout: 20s
retries: 10
+ start_period: 60s
volumes:
- /tmp/shenyu-e2e/mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql
\ No newline at end of file
diff --git
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
index e64ac6cfb..535aa8c3e 100644
---
a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
+++
b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/resources/docker-compose.mysql.yml
@@ -19,7 +19,7 @@ version: '2.3'
services:
zookeeper:
- image: zookeeper:3.5
+ image: zookeeper:3.8.0
restart: always
expose:
- 2181
@@ -28,6 +28,7 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 30s
nacos:
image: nacos/nacos-server:v2.2.3
@@ -43,6 +44,20 @@ services:
interval: 10s
timeout: 5s
retries: 3
+ start_period: 30s
+
+ eureka:
+ image: shenyu-examples-eureka:latest
+ restart: always
+ expose:
+ - 8761
+ ports:
+ - "8761:8761"
+ healthcheck:
+ test: [ "CMD-SHELL", "wget -q -O - http://eureka:8761/actuator/health |
grep UP || exit 1" ]
+ timeout: 5s
+ retries: 5
+ start_period: 60s
admin:
image: shenyu/admin:latest
@@ -57,29 +72,20 @@ services:
-
spring.datasource.url=jdbc:mysql://mysql:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
healthcheck:
test: [ "CMD-SHELL", "wget -q -O - http://admin:9095/actuator/health |
grep UP || exit 1" ]
- timeout: 2s
+ timeout: 5s
retries: 3
- start_period: 5s
+ start_period: 20s
depends_on:
- springcloud:
- condition: service_healthy
+ mysql:
+ condition: service_started
+ nacos:
+ condition: service_started
+ zookeeper:
+ condition: service_started
volumes:
-
../../target/test-classes/admin-application.yml:/opt/shenyu-admin/conf/application.yml
-
/tmp/shenyu-e2e/mysql/mysql-connector.jar:/opt/shenyu-admin/ext-lib/mysql-connector.jar
- eureka:
- image: shenyu-examples-eureka:latest
- restart: always
- expose:
- - 8761
- ports:
- - "8761:8761"
- healthcheck:
- test: [ "CMD-SHELL", "wget -q -O - http://eureka:8761/actuator/health |
grep UP || exit 1" ]
- timeout: 2s
- retries: 3
- start_period: 5s
-
springcloud:
image: shenyu-examples-springcloud:latest
restart: always
@@ -93,16 +99,10 @@ services:
depends_on:
eureka:
condition: service_healthy
- mysql:
- condition: service_healthy
- nacos:
- condition: service_healthy
- zookeeper:
- condition: service_healthy
healthcheck:
test: [ "CMD-SHELL", "wget -q -O -
http://springcloud:8884/actuator/health | grep UP || exit 1" ]
- timeout: 2s
- retries: 5
+ timeout: 5s
+ retries: 3
start_period: 8s
gateway:
@@ -127,8 +127,9 @@ services:
- MYSQL_PASSWORD=123456
healthcheck:
test: "/usr/bin/mysql --user=root --password=123123 --execute \"SHOW
DATABASES;\""
- interval: 2s
- timeout: 20s
+ interval: 5s
+ timeout: 40s
retries: 10
+ start_period: 60s
volumes:
- /tmp/shenyu-e2e/mysql/schema.sql:/docker-entrypoint-initdb.d/schema.sql
\ No newline at end of file
diff --git
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java
index 295ebcbf8..a39b4ee1c 100644
---
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java
+++
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanClassDemoServiceImpl.java
@@ -36,12 +36,12 @@ public class MotanClassDemoServiceImpl implements
MotanClassDemoService {
}
@Override
- public String testTimeOut(final long timeout) {
+ public String testTimeOut(final long seconds) {
try {
- Thread.sleep(timeout * 1000);
+ Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- return "hello timeout " + timeout + "s";
+ return "hello seconds " + seconds + "s";
}
}
diff --git
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
index 4a2292925..be0a28c2c 100644
---
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
+++
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/java/org/apache/shenyu/examples/motan/service/impl/MotanDemoServiceImpl.java
@@ -31,7 +31,7 @@ import
org.apache.shenyu.springboot.starter.client.motan.ShenyuMotanClientConfig
* <P>Default motan service name is "motan2", If you want to inject other
services,
* please refer to {@link ShenyuMotanClientConfiguration}
*/
-@ShenyuMotanService(value = "/demo/**", export = "motan2:8002")
+@ShenyuMotanService(value = "/demo", export = "motan2:8002")
@ApiModule("MotanDemoService")
public class MotanDemoServiceImpl implements MotanDemoService {
@@ -52,6 +52,6 @@ public class MotanDemoServiceImpl implements MotanDemoService
{
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- return "hello timeout " + seconds + "s";
+ return "hello seconds " + seconds + "s";
}
}
diff --git
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml
index cc692e8f0..c292ad4eb 100644
---
a/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml
+++
b/shenyu-examples/shenyu-examples-motan/shenyu-examples-motan-service/src/main/resources/application.yml
@@ -43,7 +43,7 @@ shenyu:
motan:
registry:
- protocol: zookeeper
+ protocol: local
address: 127.0.0.1:2181
logging:
diff --git a/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml
b/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml
index 1ea26c4b2..62ac3f5e5 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml
+++ b/shenyu-integrated-test/shenyu-integrated-test-combination/pom.xml
@@ -133,22 +133,22 @@
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-core</artifactId>
- <version>1.1.9</version>
+ <version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-registry-zookeeper</artifactId>
- <version>1.1.9</version>
+ <version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-transport-netty4</artifactId>
- <version>1.1.9</version>
+ <version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-springsupport</artifactId>
- <version>1.1.9</version>
+ <version>1.2.1</version>
</dependency>
<!-- apache shenyu motan plugin end-->
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java
b/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java
index 820b9ec04..62b3d49c3 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java
+++
b/shenyu-integrated-test/shenyu-integrated-test-combination/src/test/java/org/apache/shenyu/integrated/test/combination/SharedThreadPoolTest.java
@@ -57,7 +57,7 @@ public class SharedThreadPoolTest extends
AbstractPluginDataInit {
pluginResult = initPlugin(PluginEnum.GRPC.getName(),
"{\"register\":\"zookeeper://shenyu-zk:2181\",\"threadpool\": \"shared\"}");
assertThat(pluginResult, is("success"));
// for motan
- pluginResult = initPlugin(PluginEnum.MOTAN.getName(),
"{\"register\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}");
+ pluginResult = initPlugin(PluginEnum.MOTAN.getName(),
"{\"registerProtocol\": \"zk\",
\"registerAddress\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}");
assertThat(pluginResult, is("success"));
// for sofa
pluginResult = initPlugin(PluginEnum.SOFA.getName(),
"{\"protocol\":\"zookeeper\",\"register\":\"shenyu-zk:2181\",\"threadpool\":
\"shared\"}");
diff --git a/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml
b/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml
index 0c6ec7f45..2c5d27c86 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml
+++ b/shenyu-integrated-test/shenyu-integrated-test-motan/pom.xml
@@ -39,25 +39,25 @@
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-core</artifactId>
- <version>1.1.9</version>
+ <version>${motan.version}</version>
</dependency>
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-registry-zookeeper</artifactId>
- <version>1.1.9</version>
+ <version>${motan.version}</version>
</dependency>
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-transport-netty4</artifactId>
- <version>1.1.9</version>
+ <version>${motan.version}</version>
</dependency>
<dependency>
<groupId>com.weibo</groupId>
<artifactId>motan-springsupport</artifactId>
- <version>1.1.9</version>
+ <version>${motan.version}</version>
</dependency>
<!-- apache shenyu motan plugin end-->
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java
b/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java
index 5efece8a7..34a8811f2 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java
+++
b/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginShareThreadPoolTest.java
@@ -36,7 +36,7 @@ public class MotanPluginShareThreadPoolTest extends
AbstractPluginDataInit {
@BeforeAll
public static void setup() throws IOException {
- String pluginResult = initPlugin(PluginEnum.MOTAN.getName(),
"{\"register\":\"shenyu-zk:2181\",\"threadpool\": \"shared\"}");
+ String pluginResult = initPlugin(PluginEnum.MOTAN.getName(),
"{\"registerProtocol\":\"zk\",\"registerAddress\":\"shenyu-zk:2181\",\"threadpool\":
\"shared\"}");
assertThat(pluginResult, is("success"));
}
diff --git
a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java
b/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java
index e510c68de..c21e5e3cd 100644
---
a/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java
+++
b/shenyu-integrated-test/shenyu-integrated-test-motan/src/test/java/org/apache/shenyu/integrated/test/motan/MotanPluginTest.java
@@ -36,7 +36,7 @@ public class MotanPluginTest extends AbstractPluginDataInit {
@BeforeAll
public static void setup() throws IOException {
- String pluginResult = initPlugin(PluginEnum.MOTAN.getName(),
"{\"register\":\"shenyu-zk:2181\"}");
+ String pluginResult = initPlugin(PluginEnum.MOTAN.getName(),
"{\"registerAddress\":shenyu-zk:2181\"\",\"registerProtocol\":\"zk\"}");
assertThat(pluginResult, is("success"));
}
diff --git
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java
index e8c847059..42b824c27 100644
---
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java
+++
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/cache/ApplicationConfigCache.java
@@ -23,7 +23,7 @@ import com.google.common.cache.LoadingCache;
import com.weibo.api.motan.config.ProtocolConfig;
import com.weibo.api.motan.config.RefererConfig;
import com.weibo.api.motan.config.RegistryConfig;
-import com.weibo.api.motan.proxy.CommonHandler;
+import com.weibo.api.motan.proxy.CommonClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
@@ -50,19 +50,19 @@ import java.util.concurrent.ExecutionException;
* The cache info.
*/
public final class ApplicationConfigCache {
-
+
/**
* The constant PARAM_MAP.
*/
public static final ConcurrentMap<String, MotanParamInfo> PARAM_MAP = new
ConcurrentHashMap<>();
-
+
private static final Logger LOG =
LoggerFactory.getLogger(ApplicationConfigCache.class);
-
+
private RegistryConfig registryConfig;
-
+
private ProtocolConfig protocolConfig;
-
- private final LoadingCache<String, RefererConfig<CommonHandler>> cache =
CacheBuilder.newBuilder()
+
+ private final LoadingCache<String, RefererConfig<CommonClient>> cache =
CacheBuilder.newBuilder()
.maximumSize(Constants.CACHE_MAX_COUNT)
.removalListener(notification -> {
RefererConfig<?> config = (RefererConfig<?>)
notification.getValue();
@@ -77,17 +77,17 @@ public final class ApplicationConfigCache {
}
}
})
- .build(new CacheLoader<String, RefererConfig<CommonHandler>>() {
+ .build(new CacheLoader<String, RefererConfig<CommonClient>>() {
@Override
@NonNull
- public RefererConfig<CommonHandler> load(@NonNull final String
key) {
+ public RefererConfig<CommonClient> load(@NonNull final String
key) {
return new RefererConfig<>();
}
});
-
+
private ApplicationConfigCache() {
}
-
+
/**
* Gets instance.
*
@@ -96,7 +96,7 @@ public final class ApplicationConfigCache {
public static ApplicationConfigCache getInstance() {
return ApplicationConfigCacheInstance.INSTANCE;
}
-
+
/**
* Init.
*
@@ -107,8 +107,8 @@ public final class ApplicationConfigCache {
registryConfig = new RegistryConfig();
registryConfig.setId("shenyu_motan_proxy");
registryConfig.setRegister(false);
- registryConfig.setRegProtocol("zookeeper");
- registryConfig.setAddress(motanRegisterConfig.getRegister());
+
registryConfig.setRegProtocol(motanRegisterConfig.getRegisterProtocol());
+
registryConfig.setAddress(motanRegisterConfig.getRegisterAddress());
}
if (Objects.isNull(protocolConfig)) {
protocolConfig = new ProtocolConfig();
@@ -116,7 +116,7 @@ public final class ApplicationConfigCache {
protocolConfig.setName("motan2");
}
}
-
+
/**
* Get reference config.
*
@@ -129,19 +129,19 @@ public final class ApplicationConfigCache {
try {
return (RefererConfig<T>) cache.get(path);
} catch (ExecutionException e) {
- throw new ShenyuException(e.getCause());
+ throw new ShenyuException(e);
}
}
-
+
/**
* Init ref reference config.
*
* @param metaData the meta data
* @return the reference config
*/
- public RefererConfig<CommonHandler> initRef(final MetaData metaData) {
+ public RefererConfig<CommonClient> initRef(final MetaData metaData) {
try {
- RefererConfig<CommonHandler> referenceConfig =
cache.get(metaData.getPath());
+ RefererConfig<CommonClient> referenceConfig =
cache.get(metaData.getPath());
if
(StringUtils.isNoneBlank(referenceConfig.getServiceInterface())) {
return referenceConfig;
}
@@ -149,21 +149,21 @@ public final class ApplicationConfigCache {
LOG.error("init motan ref ex:{}", e.getMessage());
}
return build(metaData);
-
+
}
-
+
/**
* Build reference config.
*
* @param metaData the meta data
* @return the reference config
*/
- public RefererConfig<CommonHandler> build(final MetaData metaData) {
+ public RefererConfig<CommonClient> build(final MetaData metaData) {
if (Objects.isNull(protocolConfig) || Objects.isNull(registryConfig)) {
return new RefererConfig<>();
}
- RefererConfig<CommonHandler> reference = new RefererConfig<>();
- reference.setInterface(CommonHandler.class);
+ RefererConfig<CommonClient> reference = new RefererConfig<>();
+ reference.setInterface(CommonClient.class);
reference.setServiceInterface(metaData.getServiceName());
// the group of motan rpc call
MotanParamExtInfo motanParamExtInfo =
@@ -189,14 +189,14 @@ public final class ApplicationConfigCache {
reference.setRequestTimeout(Optional.ofNullable(motanParamExtInfo.getTimeout()).orElse(1000));
reference.setRegistry(registryConfig);
reference.setProtocol(protocolConfig);
- CommonHandler obj = reference.getRef();
+ CommonClient obj = reference.getRef();
if (Objects.nonNull(obj)) {
LOG.info("init motan reference success there meteData is :{}",
metaData);
cache.put(metaData.getPath(), reference);
}
return reference;
}
-
+
/**
* Invalidate.
*
@@ -205,38 +205,38 @@ public final class ApplicationConfigCache {
public void invalidate(final String path) {
cache.invalidate(path);
}
-
+
/**
* Invalidate all.
*/
public void invalidateAll() {
cache.invalidateAll();
}
-
+
/**
* The type Application config cache instance.
*/
static final class ApplicationConfigCacheInstance {
-
+
/**
* The Instance.
*/
static final ApplicationConfigCache INSTANCE = new
ApplicationConfigCache();
-
+
private ApplicationConfigCacheInstance() {
-
+
}
}
-
+
/**
* The type Motan param ext info.
*/
static class MethodInfo {
-
+
private String methodName;
-
+
private List<Pair<String, String>> params;
-
+
/**
* Gets method name.
*
@@ -245,7 +245,7 @@ public final class ApplicationConfigCache {
public String getMethodName() {
return methodName;
}
-
+
/**
* Sets method name.
*
@@ -254,7 +254,7 @@ public final class ApplicationConfigCache {
public void setMethodName(final String methodName) {
this.methodName = methodName;
}
-
+
/**
* Gets params.
*
@@ -263,7 +263,7 @@ public final class ApplicationConfigCache {
public List<Pair<String, String>> getParams() {
return params;
}
-
+
/**
* Sets params.
*
@@ -273,18 +273,18 @@ public final class ApplicationConfigCache {
this.params = params;
}
}
-
+
/**
* The type Motan param ext info.
*/
static class MotanParamExtInfo {
-
+
private List<MethodInfo> methodInfo;
-
+
private String group;
private Integer timeout;
-
+
/**
* Gets method info.
*
@@ -293,7 +293,7 @@ public final class ApplicationConfigCache {
public List<MethodInfo> getMethodInfo() {
return methodInfo;
}
-
+
/**
* Sets method info.
*
@@ -302,7 +302,7 @@ public final class ApplicationConfigCache {
public void setMethodInfo(final List<MethodInfo> methodInfo) {
this.methodInfo = methodInfo;
}
-
+
/**
* Gets group.
*
@@ -311,7 +311,7 @@ public final class ApplicationConfigCache {
public String getGroup() {
return group;
}
-
+
/**
* Sets group.
*
@@ -329,16 +329,16 @@ public final class ApplicationConfigCache {
this.timeout = timeout;
}
}
-
+
/**
* The type Motan param ext info.
*/
public static class MotanParamInfo {
-
+
private Class<?>[] paramTypes;
-
+
private String[] paramNames;
-
+
/**
* Instantiates a new Motan param info.
*
@@ -349,7 +349,7 @@ public final class ApplicationConfigCache {
this.paramTypes = paramTypes;
this.paramNames = paramNames;
}
-
+
/**
* Get param types class [ ].
*
@@ -358,7 +358,7 @@ public final class ApplicationConfigCache {
public Class<?>[] getParamTypes() {
return paramTypes;
}
-
+
/**
* Sets param types.
*
@@ -367,7 +367,7 @@ public final class ApplicationConfigCache {
public void setParamTypes(final Class<?>[] paramTypes) {
this.paramTypes = paramTypes;
}
-
+
/**
* Get param names string [ ].
*
@@ -376,7 +376,7 @@ public final class ApplicationConfigCache {
public String[] getParamNames() {
return paramNames;
}
-
+
/**
* Sets param names.
*
diff --git
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java
index 5810c80fc..405b876a5 100644
---
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java
+++
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/main/java/org/apache/shenyu/plugin/motan/proxy/MotanProxyService.java
@@ -18,7 +18,7 @@
package org.apache.shenyu.plugin.motan.proxy;
import com.weibo.api.motan.config.RefererConfig;
-import com.weibo.api.motan.proxy.CommonHandler;
+import com.weibo.api.motan.proxy.CommonClient;
import com.weibo.api.motan.rpc.ResponseFuture;
import com.weibo.api.motan.rpc.RpcContext;
import org.apache.commons.lang3.StringUtils;
@@ -78,12 +78,12 @@ public class MotanProxyService {
Optional.ofNullable(rpcContext).map(context ->
context.get(PluginEnum.MOTAN.getName())).ifPresent(context -> {
context.forEach((k, v) ->
RpcContext.getContext().setRpcAttachment(k, v));
});
- RefererConfig<CommonHandler> reference =
ApplicationConfigCache.getInstance().get(metaData.getPath());
+ RefererConfig<CommonClient> reference =
ApplicationConfigCache.getInstance().get(metaData.getPath());
if (Objects.isNull(reference) ||
StringUtils.isEmpty(reference.getServiceInterface())) {
ApplicationConfigCache.getInstance().invalidate(metaData.getPath());
reference = ApplicationConfigCache.getInstance().initRef(metaData);
}
- CommonHandler commonHandler = reference.getRef();
+ CommonClient commonClient = reference.getRef();
ApplicationConfigCache.MotanParamInfo motanParamInfo =
ApplicationConfigCache.PARAM_MAP.get(metaData.getMethodName());
Object[] params;
if (Objects.isNull(motanParamInfo)) {
@@ -94,13 +94,14 @@ public class MotanProxyService {
Map<String, Object> bodyMap =
GsonUtils.getInstance().convertToMap(body);
ParamCheckUtils.checkParamsLength(bodyMap.size(),
motanParamInfo.getParamNames().length);
for (int i = 0; i < num; i++) {
- params[i] =
bodyMap.get(motanParamInfo.getParamNames()[i]).toString();
+ //Fix the bug by dylan,Use primitive type。Otherwise, the
generalization call will fail
+ params[i] = bodyMap.get(motanParamInfo.getParamNames()[i]);
}
}
ResponseFuture responseFuture;
//CHECKSTYLE:OFF IllegalCatch
try {
- responseFuture = (ResponseFuture)
commonHandler.asyncCall(metaData.getMethodName(), params, Object.class);
+ responseFuture = (ResponseFuture)
commonClient.asyncCall(metaData.getMethodName(), params, Object.class);
} catch (Throwable e) {
LOG.error("Exception caught in MotanProxyService#genericInvoker.",
e);
return null;
diff --git
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java
index 47654ee49..a9ca36334 100644
---
a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java
+++
b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-motan/src/test/java/org/apache/shenyu/plugin/motan/handler/MotanPluginDataHandlerTest.java
@@ -42,9 +42,9 @@ public final class MotanPluginDataHandlerTest {
@Test
public void testHandlerPlugin() {
pluginData.setEnabled(true);
- pluginData.setConfig("{\"register\" : \"127.0.0.1:2181\"}");
+ pluginData.setConfig("{\"registerAddress\" : \"127.0.0.1:2181\"}");
motanPluginDataHandler.handlerPlugin(pluginData);
-
Assertions.assertEquals(Singleton.INST.get(MotanRegisterConfig.class).getRegister(),
"127.0.0.1:2181");
+
Assertions.assertEquals(Singleton.INST.get(MotanRegisterConfig.class).getRegisterAddress(),
"127.0.0.1:2181");
}
@Test