From f5e3cadab35c450746a16819d4fa925793cc665d Mon Sep 17 00:00:00 2001 From: cloudbase-ai <22498243+cloudbase-ai@users.noreply.github.com> Date: Thu, 8 Oct 2026 01:02:12 -0700 Subject: [PATCH 1/2] refactor: externalize Hystrix to plugin store Signed-off-by: cloudbase-ai <22498243+cloudbase-ai@users.noreply.github.com> --- README.md | 2 +- db/init/mysql/schema.sql | 22 --- db/init/ob/schema.sql | 22 --- db/init/og/create-table.sql | 22 --- db/init/oracle/schema.sql | 2 - db/init/pg/create-table.sql | 22 --- docs/plugin-store-hystrix.md | 33 ++++ .../admin/service/impl/EnumServiceImpl.java | 7 +- .../main/resources/sql-script/h2/schema.sql | 1 - .../shenyu/admin/service/EnumServiceTest.java | 4 +- shenyu-bootstrap/pom.xml | 8 - .../src/main/resources/application.yml | 1 - .../src/main/release-docs/LICENSE | 3 - .../shenyu-e2e-case/k8s/sync/shenyu-cm.yml | 1 - .../k8s/shenyu-cm.yml | 1 - .../org/apache/shenyu/e2e/model/Plugin.java | 1 - .../shenyu-integrated-test-http/pom.xml | 8 - .../test/http/HttpTestControllerTest.java | 2 +- .../http/combination/HystrixPluginTest.java | 122 --------------- .../src/main/resources/application.yml | 1 - .../src/main/resources/application.yml | 1 - .../src/main/resources/application.yml | 1 - .../src/main/resources/application.yml | 1 - .../src/main/resources/application.yml | 1 - .../shenyu-plugin-fault-tolerance/pom.xml | 1 - .../shenyu-plugin-hystrix/pom.xml | 52 ------ .../shenyu/plugin/hystrix/HystrixPlugin.java | 109 ------------- .../hystrix/builder/HystrixBuilder.java | 148 ------------------ .../plugin/hystrix/command/Command.java | 91 ----------- .../hystrix/command/HystrixCommand.java | 100 ------------ .../command/HystrixCommandOnThread.java | 97 ------------ .../handler/HystrixPluginDataHandler.java | 94 ----------- .../plugin/hystrix/HystrixPluginTest.java | 114 -------------- .../hystrix/builder/HystrixBuilderTest.java | 50 ------ .../command/HystrixCommandOnThreadTest.java | 90 ----------- .../hystrix/command/HystrixCommandTest.java | 119 -------------- .../handler/HystrixPluginDataHandlerTest.java | 54 ------- .../shenyu-spring-boot-starter-plugin/pom.xml | 1 - .../pom.xml | 35 ----- .../hystrix/HystrixPluginConfiguration.java | 54 ------- .../main/resources/META-INF/spring.factories | 19 --- .../main/resources/META-INF/spring.provides | 18 --- ...ot.autoconfigure.AutoConfiguration.imports | 18 --- .../HystrixPluginConfigurationTest.java | 63 -------- .../mock_configs_fetch_response.json | 7 - 45 files changed, 38 insertions(+), 1585 deletions(-) create mode 100644 docs/plugin-store-hystrix.md delete mode 100644 shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/HystrixPluginTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/pom.xml delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/HystrixPlugin.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilder.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/Command.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommand.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThread.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandler.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/HystrixPluginTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilderTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThreadTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandTest.java delete mode 100644 shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandlerTest.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/pom.xml delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfiguration.java delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.factories delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.provides delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/test/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfigurationTest.java diff --git a/README.md b/README.md index 9c1f13d92850..d5cfbbc3aba7 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Apache ShenYu is a Java-based gateway for service proxying, protocol conversion, | Plugin routing and extensions | An ordered plugin chain for HTTP requests, with selector and rule matching where applicable. Spring Boot starters select plugins; [custom Java plugins](https://shenyu.apache.org/docs/developer/custom-plugin/), SPI implementations, and WASM plugin APIs extend the gateway. | | Protocols and upstreams | HTTP and Spring Cloud services, WebSocket connections, and Apache Dubbo, gRPC, SOFA, and Tars backends. Optional TCP and MQTT listeners provide additional ingress. | | Registration and discovery | Client SDKs register service addresses and API metadata with Admin. Registry integrations support discovery; an optional Kubernetes controller reconciles Ingress and Endpoints resources. | -| Security and traffic control | WAF, signing, authentication plugins, load balancing, rate limiting, and fault tolerance through Hystrix, Resilience4j, and Sentinel. | +| Security and traffic control | WAF, signing, authentication plugins, load balancing, rate limiting, and fault tolerance through Resilience4j and Sentinel; deprecated Hystrix remains available as an external plugin (see [plugin-store-hystrix](docs/plugin-store-hystrix.md)). | | Caching and transformation | In-memory or Redis-backed response caching, URL rewriting, redirection, and request/response transformation. | | Dynamic configuration | Admin persists plugins, selectors, rules, metadata, and authentication data. WebSocket sync is the default; HTTP long polling, ZooKeeper, Nacos, etcd, Consul, Apollo, and Polaris are available. Gateway replicas apply updates to their local caches. | | Observability | Metrics and logging plugins, including Kafka, Pulsar, Elasticsearch, and ClickHouse destinations; email and DingTalk alerts from Admin. | diff --git a/db/init/mysql/schema.sql b/db/init/mysql/schema.sql index e0f6ccc0d2bc..283302a665c5 100644 --- a/db/init/mysql/schema.sql +++ b/db/init/mysql/schema.sql @@ -452,7 +452,6 @@ INSERT INTO `permission` VALUES ('1529402639305326616', '1346358560427216896', ' INSERT INTO `permission` VALUES ('1529402639305326617', '1346358560427216896', '1529402639284355096', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639305326618', '1346358560427216896', '1529402639284355097', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639305326619', '1346358560427216896', '1529402639284355098', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639305326620', '1346358560427216896', '1529402639284355099', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639372435663', '1346358560427216896', '1529402639368241152', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639372435664', '1346358560427216896', '1529402639368241153', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639372435665', '1346358560427216896', '1529402639368241154', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -705,15 +704,6 @@ INSERT INTO `permission` VALUES ('1529402639376629884', '1346358560427216896', ' INSERT INTO `permission` VALUES ('1529402639376629885', '1346358560427216896', '1529402639372435651', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639376629886', '1346358560427216896', '1529402639372435652', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639376629887', '1346358560427216896', '1529402639372435653', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629888', '1346358560427216896', '1529402639372435654', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629889', '1346358560427216896', '1529402639372435655', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629890', '1346358560427216896', '1529402639372435656', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629891', '1346358560427216896', '1529402639372435657', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629892', '1346358560427216896', '1529402639372435658', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629893', '1346358560427216896', '1529402639372435659', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629894', '1346358560427216896', '1529402639372435660', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629895', '1346358560427216896', '1529402639372435661', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629896', '1346358560427216896', '1529402639372435662', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1534577122279825408', '1346358560427216896', '1534577121923309568', '2022-06-09 00:44:32', '2022-06-09 00:44:31'); INSERT INTO `permission` VALUES ('1534585430587875328', '1346358560427216896', '1534585430311051264', '2022-06-09 01:17:33', '2022-06-09 01:17:32'); INSERT INTO `permission` VALUES ('1534585531389583360', '1346358560427216896', '1534585531108564992', '2022-06-09 01:17:57', '2022-06-09 01:17:56'); @@ -1009,7 +999,6 @@ INSERT INTO `plugin` VALUES ('30', 'cache', '{\"cacheType\":\"memory\"}', 'Cache INSERT INTO `plugin` VALUES ('4', 'rateLimiter', '{\"master\":\"mymaster\",\"mode\":\"standalone\",\"url\":\"192.168.1.1:6379\",\"password\":\"abc\"}', 'FaultTolerance', 60, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('5', 'divide', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\"}', 'Proxy', 200, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('6', 'dubbo', '{\"register\":\"zookeeper://localhost:2181\",\"multiSelectorHandle\":\"1\",\"threadpool\":\"shared\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); -INSERT INTO `plugin` VALUES ('9', 'hystrix', NULL, 'FaultTolerance', 130, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('32', 'loggingElasticSearch','{\"host\":\"localhost\", \"port\": \"9200\"}', 'Logging', 190, 0, '2022-06-19 22:00:00', '2022-06-19 22:00:00',null); INSERT INTO `plugin` VALUES ('33', 'loggingKafka','{\"topic\":\"shenyu-access-logging\",\"namesrvAddr\":\"http://localhost:9092\",\"sampleRate\":\"1\",\"maxResponseBody\":524288,\"maxRequestBody\":524288,\"compressAlg\":\"none\"}', 'Logging', 180, 0, '2022-07-04 22:00:00', '2022-07-02 22:00:00',null); INSERT INTO `plugin` VALUES ('34', 'loggingAliyunSls','{\"projectName\": \"shenyu\", \"logStoreName\": \"shenyu-logstore\", \"topic\": \"shenyu-topic\"}', 'Logging', 175, 0, '2022-06-30 21:00:00', '2022-06-30 21:00:00',null); @@ -1608,7 +1597,6 @@ INSERT INTO `resource` VALUES ('1529402639284355094', '1346775491550474240', 'ca INSERT INTO `resource` VALUES ('1529402639284355095', '1346775491550474240', 'rateLimiter', 'rateLimiter', '/plug/rateLimiter', 'rateLimiter', 1, 0, 'key', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355096', '1346775491550474240', 'divide', 'divide', '/plug/divide', 'divide', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355097', '1346775491550474240', 'dubbo', 'dubbo', '/plug/dubbo', 'dubbo', 1, 0, 'fire', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639284355099', '1346775491550474240', 'hystrix', 'hystrix', '/plug/hystrix', 'hystrix', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241152', '1529402639271772160', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:signSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241153', '1529402639271772160', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:signSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241154', '1529402639271772160', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:signSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -1843,15 +1831,6 @@ INSERT INTO `resource` VALUES ('1529402639372435641', '1529402639284355097', 'SH INSERT INTO `resource` VALUES ('1529402639372435642', '1529402639284355097', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435643', '1529402639284355097', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435644', '1529402639284355097', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubbo:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435654', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435655', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435656', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435657', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435658', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435659', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435660', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435661', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435662', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrix:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1534577121923309568', '', 'SHENYU.MENU.DOCUMENT', '', '/document', '', 0, 3, 'file-text', 0, 0, '', 1, '2022-06-09 00:44:32', '2022-06-09 01:06:45'); INSERT INTO `resource` VALUES ('1534585430311051264', '1534577121923309568', 'SHENYU.MENU.DOCUMENT.APIDOC', '', '/document/apidoc', '', 1, 0, 'api', 0, 0, '', 1, '2022-06-09 01:17:32', '2022-06-09 01:17:32'); INSERT INTO `resource` VALUES ('1534585531108564992', '1534585430311051264', 'send', '', '', '', 2, 0, '', 1, 0, 'document:apirun:send', 1, '2022-06-09 01:17:56', '2022-06-09 01:17:56'); @@ -2661,7 +2640,6 @@ INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, ` INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822182','649330b6-c2d7-4edc-be8e-8a54df9eb385','45', '{\"host\":\"127.0.0.1\",\"port\":5672,\"password\":\"admin\",\"username\":\"admin\",\"exchangeName\":\"exchange.logging.plugin\",\"queueName\":\"queue.logging.plugin\",\"routingKey\":\"topic.logging\",\"virtualHost\":\"/\",\"exchangeType\":\"direct\",\"durable\":\"true\",\"exclusive\":\"false\",\"autoDelete\":\"false\"}', 171, 0, '2023-11-06 15:49:56.454', '2023-11-10 10:40:58.447'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822183','649330b6-c2d7-4edc-be8e-8a54df9eb385','5', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\"}', 200, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822184','649330b6-c2d7-4edc-be8e-8a54df9eb385','6', '{\"register\":\"zookeeper://localhost:2181\",\"multiSelectorHandle\":\"1\",\"threadpool\":\"shared\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822186','649330b6-c2d7-4edc-be8e-8a54df9eb385','9', NULL, 130, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822187','649330b6-c2d7-4edc-be8e-8a54df9eb385','50', '{\"provider\":\"OpenAI\",\"baseUrl\":\"https://api.openai.com/v1/chat/completions\",\"model\":\"gpt-4o-mini\",\"apiKey\":\"your_api_key\",\"temperature\":\"0.5\",\"maxTokens\":\"1000\",\"stream\":\"false\",\"proxyEnabled\":\"false\",\"fallbackEnabled\":\"false\",\"fallbackProvider\":\"OpenAI\",\"fallbackModel\":\"gpt-4.1\"}', 199, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822188','649330b6-c2d7-4edc-be8e-8a54df9eb385','51', NULL, 171, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/ob/schema.sql b/db/init/ob/schema.sql index 159ff514e4a5..543d31e29277 100644 --- a/db/init/ob/schema.sql +++ b/db/init/ob/schema.sql @@ -452,7 +452,6 @@ INSERT INTO `permission` VALUES ('1529402639305326616', '1346358560427216896', ' INSERT INTO `permission` VALUES ('1529402639305326617', '1346358560427216896', '1529402639284355096', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639305326618', '1346358560427216896', '1529402639284355097', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639305326619', '1346358560427216896', '1529402639284355098', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639305326620', '1346358560427216896', '1529402639284355099', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639372435663', '1346358560427216896', '1529402639368241152', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639372435664', '1346358560427216896', '1529402639368241153', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639372435665', '1346358560427216896', '1529402639368241154', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -705,15 +704,6 @@ INSERT INTO `permission` VALUES ('1529402639376629884', '1346358560427216896', ' INSERT INTO `permission` VALUES ('1529402639376629885', '1346358560427216896', '1529402639372435651', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639376629886', '1346358560427216896', '1529402639372435652', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1529402639376629887', '1346358560427216896', '1529402639372435653', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629888', '1346358560427216896', '1529402639372435654', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629889', '1346358560427216896', '1529402639372435655', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629890', '1346358560427216896', '1529402639372435656', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629891', '1346358560427216896', '1529402639372435657', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629892', '1346358560427216896', '1529402639372435658', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629893', '1346358560427216896', '1529402639372435659', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629894', '1346358560427216896', '1529402639372435660', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629895', '1346358560427216896', '1529402639372435661', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `permission` VALUES ('1529402639376629896', '1346358560427216896', '1529402639372435662', '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `permission` VALUES ('1534577122279825408', '1346358560427216896', '1534577121923309568', '2022-06-09 00:44:32', '2022-06-09 00:44:31'); INSERT INTO `permission` VALUES ('1534585430587875328', '1346358560427216896', '1534585430311051264', '2022-06-09 01:17:33', '2022-06-09 01:17:32'); INSERT INTO `permission` VALUES ('1534585531389583360', '1346358560427216896', '1534585531108564992', '2022-06-09 01:17:57', '2022-06-09 01:17:56'); @@ -980,7 +970,6 @@ INSERT INTO `plugin` VALUES ('30', 'cache', '{\"cacheType\":\"memory\"}', 'Cache INSERT INTO `plugin` VALUES ('4', 'rateLimiter', '{\"master\":\"mymaster\",\"mode\":\"standalone\",\"url\":\"192.168.1.1:6379\",\"password\":\"abc\"}', 'FaultTolerance', 60, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('5', 'divide', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\"}', 'Proxy', 200, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('6', 'dubbo', '{\"register\":\"zookeeper://localhost:2181\",\"multiSelectorHandle\":\"1\",\"threadpool\":\"shared\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0}', 'Proxy', 310, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); -INSERT INTO `plugin` VALUES ('9', 'hystrix', NULL, 'FaultTolerance', 130, 0, '2022-05-25 18:02:53', '2022-05-25 18:02:53',null); INSERT INTO `plugin` VALUES ('32', 'loggingElasticSearch','{\"host\":\"localhost\", \"port\": \"9200\"}', 'Logging', 190, 0, '2022-06-19 22:00:00', '2022-06-19 22:00:00',null); INSERT INTO `plugin` VALUES ('33', 'loggingKafka','{\"host\":\"localhost\", \"port\": \"9092\"}', 'Logging', 180, 0, '2022-07-04 22:00:00', '2022-07-02 22:00:00',null); INSERT INTO `plugin` VALUES ('34', 'loggingAliyunSls','{\"projectName\": \"shenyu\", \"logStoreName\": \"shenyu-logstore\", \"topic\": \"shenyu-topic\"}', 'Logging', 175, 0, '2022-06-30 21:00:00', '2022-06-30 21:00:00',null); @@ -1557,7 +1546,6 @@ INSERT INTO `resource` VALUES ('1529402639284355094', '1346775491550474240', 'ca INSERT INTO `resource` VALUES ('1529402639284355095', '1346775491550474240', 'rateLimiter', 'rateLimiter', '/plug/rateLimiter', 'rateLimiter', 1, 0, 'key', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355096', '1346775491550474240', 'divide', 'divide', '/plug/divide', 'divide', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639284355097', '1346775491550474240', 'dubbo', 'dubbo', '/plug/dubbo', 'dubbo', 1, 0, 'fire', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639284355099', '1346775491550474240', 'hystrix', 'hystrix', '/plug/hystrix', 'hystrix', 1, 0, 'border-bottom', 0, 0, '', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241152', '1529402639271772160', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:signSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241153', '1529402639271772160', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:signSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639368241154', '1529402639271772160', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:signSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); @@ -1792,15 +1780,6 @@ INSERT INTO `resource` VALUES ('1529402639372435641', '1529402639284355097', 'SH INSERT INTO `resource` VALUES ('1529402639372435642', '1529402639284355097', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435643', '1529402639284355097', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1529402639372435644', '1529402639284355097', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubbo:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435654', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435655', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435656', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435657', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435658', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:add', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435659', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:query', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435660', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:edit', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435661', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:delete', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); -INSERT INTO `resource` VALUES ('1529402639372435662', '1529402639284355099', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrix:modify', 1, '2022-05-25 18:02:58', '2022-05-25 18:02:58'); INSERT INTO `resource` VALUES ('1534577121923309568', '', 'SHENYU.MENU.DOCUMENT', '', '/document', '', 0, 3, 'file-text', 0, 0, '', 1, '2022-06-09 00:44:32', '2022-06-09 01:06:45'); INSERT INTO `resource` VALUES ('1534585430311051264', '1534577121923309568', 'SHENYU.MENU.DOCUMENT.APIDOC', '', '/document/apidoc', '', 1, 0, 'api', 0, 0, '', 1, '2022-06-09 01:17:32', '2022-06-09 01:17:32'); INSERT INTO `resource` VALUES ('1534585531108564992', '1534585430311051264', 'send', '', '', '', 2, 0, '', 1, 0, 'document:apirun:send', 1, '2022-06-09 01:17:56', '2022-06-09 01:17:56'); @@ -2588,7 +2567,6 @@ INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, ` INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822182','649330b6-c2d7-4edc-be8e-8a54df9eb385','45', '{\"host\":\"127.0.0.1\",\"port\":5672,\"password\":\"admin\",\"username\":\"admin\",\"exchangeName\":\"exchange.logging.plugin\",\"queueName\":\"queue.logging.plugin\",\"routingKey\":\"topic.logging\",\"virtualHost\":\"/\",\"exchangeType\":\"direct\",\"durable\":\"true\",\"exclusive\":\"false\",\"autoDelete\":\"false\"}', 171, 0, '2023-11-06 15:49:56.454', '2023-11-10 10:40:58.447'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822183','649330b6-c2d7-4edc-be8e-8a54df9eb385','5', '{\"multiSelectorHandle\":\"1\",\"multiRuleHandle\":\"0\"}', 200, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822184','649330b6-c2d7-4edc-be8e-8a54df9eb385','6', '{\"register\":\"zookeeper://localhost:2181\",\"multiSelectorHandle\":\"1\",\"threadpool\":\"shared\",\"corethreads\":0,\"threads\":2147483647,\"queues\":0}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822186','649330b6-c2d7-4edc-be8e-8a54df9eb385','9', NULL, 130, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822187','649330b6-c2d7-4edc-be8e-8a54df9eb385','50', '{\"provider\":\"OpenAI\",\"baseUrl\":\"https://api.openai.com/v1/chat/completions\",\"model\":\"gpt-4o-mini\",\"apiKey\":\"your_api_key\",\"temperature\":\"0.5\",\"maxTokens\":\"1000\",\"stream\":\"false\",\"prompt\":\"\"}', 199, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822188','649330b6-c2d7-4edc-be8e-8a54df9eb385','51', NULL, 171, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882832189','649330b6-c2d7-4edc-be8e-8a54df9eb385','61', NULL, 180, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/og/create-table.sql b/db/init/og/create-table.sql index 79d9efa27938..399e2797119d 100644 --- a/db/init/og/create-table.sql +++ b/db/init/og/create-table.sql @@ -557,7 +557,6 @@ INSERT INTO "public"."permission" VALUES ('1529403932797964308', '13463585604272 INSERT INTO "public"."permission" VALUES ('1529403932797964309', '1346358560427216896', '1529403932781187092', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964310', '1346358560427216896', '1529403932781187093', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964311', '1346358560427216896', '1529403932781187094', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932797964312', '1346358560427216896', '1529403932781187095', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964313', '1346358560427216896', '1529403932781187096', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964314', '1346358560427216896', '1529403932781187097', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964315', '1346358560427216896', '1529403932781187098', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -778,15 +777,6 @@ INSERT INTO "public"."permission" VALUES ('1529403932886044718', '13463585604272 INSERT INTO "public"."permission" VALUES ('1529403932886044719', '1346358560427216896', '1529403932881850464', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044720', '1346358560427216896', '1529403932881850465', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044721', '1346358560427216896', '1529403932881850466', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044722', '1346358560427216896', '1529403932881850467', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044723', '1346358560427216896', '1529403932881850468', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044724', '1346358560427216896', '1529403932881850469', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044725', '1346358560427216896', '1529403932881850470', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044726', '1346358560427216896', '1529403932881850471', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044727', '1346358560427216896', '1529403932881850472', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044728', '1346358560427216896', '1529403932881850473', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044729', '1346358560427216896', '1529403932881850474', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044730', '1346358560427216896', '1529403932881850475', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044731', '1346358560427216896', '1529403932881850476', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044732', '1346358560427216896', '1529403932881850477', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044733', '1346358560427216896', '1529403932881850478', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -967,7 +957,6 @@ INSERT INTO "public"."plugin" VALUES ('3', 'rewrite', NULL, 'HttpProcess', 90, 0 INSERT INTO "public"."plugin" VALUES ('4', 'rateLimiter', '{"master":"mymaster","mode":"standalone","url":"192.168.1.1:6379","password":"abc"}', 'FaultTolerance', 60, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('5', 'divide', '{"multiSelectorHandle":"1","multiRuleHandle":"0"}', 'Proxy', 200, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('6', 'dubbo', '{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); -INSERT INTO "public"."plugin" VALUES ('9', 'hystrix', NULL, 'FaultTolerance', 130, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('27', 'generalContext', NULL, 'Common', 125, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('28', 'mqtt', '{"port": 9500,"bossGroupThreadCount": 1,"maxPayloadSize": 65536,"workerGroupThreadCount": 12,"userName": "shenyu","password": "shenyu","isEncryptPassword": false,"encryptMode": "","leakDetectorLevel": "DISABLED"}', 'Proxy', 125, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('29', 'loggingRocketMQ', '{"topic":"shenyu-access-logging", "namesrvAddr": "localhost:9876","producerGroup":"shenyu-plugin-logging-rocketmq"}', 'Logging', 170, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1561,7 +1550,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932781187090', '1346775491550474 INSERT INTO "public"."resource" VALUES ('1529403932781187091', '1346775491550474240', 'rateLimiter', 'rateLimiter', '/plug/rateLimiter', 'rateLimiter', 1, 0, 'pic-center', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187092', '1346775491550474240', 'divide', 'divide', '/plug/divide', 'divide', 1, 0, 'block', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187093', '1346775491550474240', 'dubbo', 'dubbo', '/plug/dubbo', 'dubbo', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932781187095', '1346775491550474240', 'hystrix', 'hystrix', '/plug/hystrix', 'hystrix', 1, 0, 'fire', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187096', '1346775491550474240', 'generalContext', 'generalContext', '/plug/generalContext', 'generalContext', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187097', '1346775491550474240', 'mqtt', 'mqtt', '/plug/mqtt', 'mqtt', 1, 0, 'database', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187098', '1346775491550474240', 'loggingRocketMQ', 'loggingRocketMQ', '/plug/loggingRocketMQ', 'loggingRocketMQ', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1764,15 +1752,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932881850454', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932881850455', '1529403932781187093', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850456', '1529403932781187093', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850457', '1529403932781187093', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubbo:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850467', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850468', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850469', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850470', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850471', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850472', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850473', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850474', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850475', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrix:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850476', '1529403932781187096', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:generalContextSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850477', '1529403932781187096', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:generalContextSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850478', '1529403932781187096', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:generalContextSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2753,7 +2732,6 @@ INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822181','64933 INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822182','649330b6-c2d7-4edc-be8e-8a54df9eb385','45', '{"host":"127.0.0.1","port":5672,"password":"admin","username":"admin","exchangeName":"exchange.logging.plugin","queueName":"queue.logging.plugin","routingKey":"topic.logging","virtualHost":"/","exchangeType":"direct","durable":"true","exclusive":"false","autoDelete":"false"}', 171, 0, '2023-11-06 15:49:56.454', '2023-11-10 10:40:58.447'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822183','649330b6-c2d7-4edc-be8e-8a54df9eb385','5', '{"multiSelectorHandle":"1","multiRuleHandle":"0"}', 200, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822184','649330b6-c2d7-4edc-be8e-8a54df9eb385','6', '{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822186','649330b6-c2d7-4edc-be8e-8a54df9eb385','9', NULL, 130, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822187','649330b6-c2d7-4edc-be8e-8a54df9eb385','50', '{"provider":"OpenAI","baseUrl":"https://api.openai.com/v1/chat/completions","model":"gpt-4o-mini","apiKey":"your_api_key","temperature":"0.5","maxTokens":"1000","stream":"false","prompt":""}', 199, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822188','649330b6-c2d7-4edc-be8e-8a54df9eb385','51', NULL, 171, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822190','649330b6-c2d7-4edc-be8e-8a54df9eb385','53', NULL, 65, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/db/init/oracle/schema.sql b/db/init/oracle/schema.sql index 89904f4da8ed..118dfaac5e29 100644 --- a/db/init/oracle/schema.sql +++ b/db/init/oracle/schema.sql @@ -1168,7 +1168,6 @@ 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, config,enabled) VALUES ('4','rateLimiter','FaultTolerance', 60,'{"master":"mymaster","mode":"standalone","url":"192.168.1.1:6379","password":"abc"}', '0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config,enabled) VALUES ('5','divide', 'Proxy', 200,'{"multiSelectorHandle":"1","multiRuleHandle":"0"}','1'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config,enabled) VALUES ('6','dubbo','Proxy', 310,'{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', '0'); -INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('9','hystrix', 'FaultTolerance', 130,'0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('10','sentinel', 'FaultTolerance', 140,'0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, config, enabled) VALUES ('11','sofa', 'Proxy', 310, '{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}', '0'); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX(plugin(id)) */ INTO plugin (id, name, role, sort, enabled) VALUES ('12','resilience4j', 'FaultTolerance', 310,'0'); @@ -3062,7 +3061,6 @@ INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespa INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822182','649330b6-c2d7-4edc-be8e-8a54df9eb385','45', '{"host":"127.0.0.1","port":5672,"password":"admin","username":"admin","exchangeName":"exchange.logging.plugin","queueName":"queue.logging.plugin","routingKey":"topic.logging","virtualHost":"/","exchangeType":"direct","durable":"true","exclusive":"false","autoDelete":"false"}', 171, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822183','649330b6-c2d7-4edc-be8e-8a54df9eb385','5', '{"multiSelectorHandle":"1","multiRuleHandle":"0"}', 200, 1); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822184','649330b6-c2d7-4edc-be8e-8a54df9eb385','6', '{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', 310, 0); -INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822186','649330b6-c2d7-4edc-be8e-8a54df9eb385','9', NULL, 130, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822187','649330b6-c2d7-4edc-be8e-8a54df9eb385','50', '{"provider":"OpenAI","baseUrl":"https://api.openai.com/v1/chat/completions","model":"gpt-4o-mini","apiKey":"your_api_key","temperature":"0.5","maxTokens":"1000","stream":"false","prompt":""}', 199, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822188','649330b6-c2d7-4edc-be8e-8a54df9eb385','51', NULL, 171, 0); INSERT /*+ IGNORE_ROW_ON_DUPKEY_INDEX (namespace_plugin_rel(id)) */ INTO namespace_plugin_rel (id,namespace_id,plugin_id, config, sort, enabled) VALUES ('1801816010882822190','649330b6-c2d7-4edc-be8e-8a54df9eb385','53', NULL, 65, 0); diff --git a/db/init/pg/create-table.sql b/db/init/pg/create-table.sql index ada3867541e9..a519e00a8ebf 100644 --- a/db/init/pg/create-table.sql +++ b/db/init/pg/create-table.sql @@ -554,7 +554,6 @@ INSERT INTO "public"."permission" VALUES ('1529403932797964308', '13463585604272 INSERT INTO "public"."permission" VALUES ('1529403932797964309', '1346358560427216896', '1529403932781187092', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964310', '1346358560427216896', '1529403932781187093', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964311', '1346358560427216896', '1529403932781187094', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932797964312', '1346358560427216896', '1529403932781187095', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964313', '1346358560427216896', '1529403932781187096', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964314', '1346358560427216896', '1529403932781187097', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932797964315', '1346358560427216896', '1529403932781187098', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -775,15 +774,6 @@ INSERT INTO "public"."permission" VALUES ('1529403932886044718', '13463585604272 INSERT INTO "public"."permission" VALUES ('1529403932886044719', '1346358560427216896', '1529403932881850464', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044720', '1346358560427216896', '1529403932881850465', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044721', '1346358560427216896', '1529403932881850466', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044722', '1346358560427216896', '1529403932881850467', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044723', '1346358560427216896', '1529403932881850468', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044724', '1346358560427216896', '1529403932881850469', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044725', '1346358560427216896', '1529403932881850470', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044726', '1346358560427216896', '1529403932881850471', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044727', '1346358560427216896', '1529403932881850472', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044728', '1346358560427216896', '1529403932881850473', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044729', '1346358560427216896', '1529403932881850474', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."permission" VALUES ('1529403932886044730', '1346358560427216896', '1529403932881850475', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044731', '1346358560427216896', '1529403932881850476', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044732', '1346358560427216896', '1529403932881850477', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."permission" VALUES ('1529403932886044733', '1346358560427216896', '1529403932881850478', '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1025,7 +1015,6 @@ INSERT INTO "public"."plugin" VALUES ('3', 'rewrite', NULL, 'HttpProcess', 90, 0 INSERT INTO "public"."plugin" VALUES ('4', 'rateLimiter', '{"master":"mymaster","mode":"standalone","url":"192.168.1.1:6379","password":"abc"}', 'FaultTolerance', 60, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('5', 'divide', '{"multiSelectorHandle":"1","multiRuleHandle":"0"}', 'Proxy', 200, 1, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('6', 'dubbo', '{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', 'Proxy', 310, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); -INSERT INTO "public"."plugin" VALUES ('9', 'hystrix', NULL, 'FaultTolerance', 130, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('27', 'generalContext', NULL, 'Common', 125, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('28', 'mqtt', '{"port": 9500,"bossGroupThreadCount": 1,"maxPayloadSize": 65536,"workerGroupThreadCount": 12,"userName": "shenyu","password": "shenyu","isEncryptPassword": false,"encryptMode": "","leakDetectorLevel": "DISABLED"}', 'Proxy', 125, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); INSERT INTO "public"."plugin" VALUES ('29', 'loggingRocketMQ', '{"topic":"shenyu-access-logging", "namesrvAddr": "localhost:9876","producerGroup":"shenyu-plugin-logging-rocketmq"}', 'Logging', 170, 0, '2022-05-25 18:08:01', '2022-05-25 18:08:01', null); @@ -1618,7 +1607,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932781187090', '1346775491550474 INSERT INTO "public"."resource" VALUES ('1529403932781187091', '1346775491550474240', 'rateLimiter', 'rateLimiter', '/plug/rateLimiter', 'rateLimiter', 1, 0, 'pic-center', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187092', '1346775491550474240', 'divide', 'divide', '/plug/divide', 'divide', 1, 0, 'block', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187093', '1346775491550474240', 'dubbo', 'dubbo', '/plug/dubbo', 'dubbo', 1, 0, 'align-left', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932781187095', '1346775491550474240', 'hystrix', 'hystrix', '/plug/hystrix', 'hystrix', 1, 0, 'fire', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187096', '1346775491550474240', 'generalContext', 'generalContext', '/plug/generalContext', 'generalContext', 1, 0, 'highlight', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187097', '1346775491550474240', 'mqtt', 'mqtt', '/plug/mqtt', 'mqtt', 1, 0, 'database', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932781187098', '1346775491550474240', 'loggingRocketMQ', 'loggingRocketMQ', '/plug/loggingRocketMQ', 'loggingRocketMQ', 1, 0, 'stop', 0, 0, '', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -1821,15 +1809,6 @@ INSERT INTO "public"."resource" VALUES ('1529403932881850454', '1529403932781187 INSERT INTO "public"."resource" VALUES ('1529403932881850455', '1529403932781187093', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850456', '1529403932781187093', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubboRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850457', '1529403932781187093', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:dubbo:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850467', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850468', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850469', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850470', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SELECTOR.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixSelector:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850471', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850472', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850473', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850474', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.RULE.DELETE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrixRule:delete', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); -INSERT INTO "public"."resource" VALUES ('1529403932881850475', '1529403932781187095', 'SHENYU.BUTTON.PLUGIN.SYNCHRONIZE', '', '', '', 2, 0, '', 1, 0, 'plugin:hystrix:modify', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850476', '1529403932781187096', 'SHENYU.BUTTON.PLUGIN.SELECTOR.ADD', '', '', '', 2, 0, '', 1, 0, 'plugin:generalContextSelector:add', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850477', '1529403932781187096', 'SHENYU.BUTTON.PLUGIN.SELECTOR.QUERY', '', '', '', 2, 0, '', 1, 0, 'plugin:generalContextSelector:query', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); INSERT INTO "public"."resource" VALUES ('1529403932881850478', '1529403932781187096', 'SHENYU.BUTTON.PLUGIN.SELECTOR.EDIT', '', '', '', 2, 0, '', 1, 0, 'plugin:generalContextSelector:edit', 1, '2022-05-25 18:08:07', '2022-05-25 18:08:07'); @@ -2870,7 +2849,6 @@ INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822181','64933 INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822182','649330b6-c2d7-4edc-be8e-8a54df9eb385','45', '{"host":"127.0.0.1","port":5672,"password":"admin","username":"admin","exchangeName":"exchange.logging.plugin","queueName":"queue.logging.plugin","routingKey":"topic.logging","virtualHost":"/","exchangeType":"direct","durable":"true","exclusive":"false","autoDelete":"false"}', 171, 0, '2023-11-06 15:49:56.454', '2023-11-10 10:40:58.447'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822183','649330b6-c2d7-4edc-be8e-8a54df9eb385','5', '{"multiSelectorHandle":"1","multiRuleHandle":"0"}', 200, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822184','649330b6-c2d7-4edc-be8e-8a54df9eb385','6', '{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822186','649330b6-c2d7-4edc-be8e-8a54df9eb385','9', NULL, 130, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822187','649330b6-c2d7-4edc-be8e-8a54df9eb385','50', '{"provider":"OpenAI","baseUrl":"https://api.openai.com/v1/chat/completions","model":"gpt-4o-mini","apiKey":"your_api_key","temperature":"0.5","maxTokens":"1000","stream":"false","prompt":""}', 199, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822188','649330b6-c2d7-4edc-be8e-8a54df9eb385','51', NULL, 171, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT INTO "public"."namespace_plugin_rel" VALUES ('1801816010882822190','649330b6-c2d7-4edc-be8e-8a54df9eb385','53', NULL, 65, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); diff --git a/docs/plugin-store-hystrix.md b/docs/plugin-store-hystrix.md new file mode 100644 index 000000000000..e9f75c6bd18e --- /dev/null +++ b/docs/plugin-store-hystrix.md @@ -0,0 +1,33 @@ + +# Hystrix Plugin Store Cutover + +The Hystrix runtime plugin and Spring Boot starter are no longer built or shipped by the main ShenYu repository. Existing deployments that still need Hystrix compatibility should add the external plugin-store starter: + +```xml + + org.apache.shenyu + shenyu-spring-boot-starter-plugin-hystrix + 2.7.1-SNAPSHOT + +``` + +Hystrix is a deprecated legacy compatibility plugin. New deployments should use the Resilience4j plugin. + +The main repository keeps `PluginEnum.HYSTRIX`, `HystrixHandle`, `HystrixIsolationModeEnum`, and related default constants as a stable compatibility contract for the external plugin and existing admin data during the supported cutover window. The main repository no longer publishes the Hystrix runtime artifact or includes Hystrix dependencies in the default bootstrap distribution. + +Rollback during the cutover window is a dependency-only change: remove the external starter and return to a ShenYu build that still shipped the in-tree Hystrix starter. Existing selector and rule data keep the same plugin name and rule-handle schema. diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/EnumServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/EnumServiceImpl.java index e82ddc58211f..ee2bae5cb284 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/EnumServiceImpl.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/EnumServiceImpl.java @@ -21,7 +21,6 @@ import org.apache.shenyu.admin.service.EnumService; import org.apache.shenyu.admin.model.vo.EnumVO; import org.apache.shenyu.common.enums.HttpMethodEnum; -import org.apache.shenyu.common.enums.HystrixIsolationModeEnum; import org.apache.shenyu.common.enums.LoadBalanceEnum; import org.apache.shenyu.common.enums.MatchModeEnum; import org.apache.shenyu.common.enums.OperatorEnum; @@ -75,6 +74,7 @@ public Map> list() { .map(paramTypeEnum -> new EnumVO(null, paramTypeEnum.getName(), paramTypeEnum.getSupport())).collect(Collectors.toList()); List pluginEnums = Arrays.stream(PluginEnum.values()) + .filter(pluginEnum -> pluginEnum != PluginEnum.HYSTRIX) .map(pluginEnum -> new EnumVO(pluginEnum.getCode(), pluginEnum.getName(), true)) .collect(Collectors.toList()); @@ -101,10 +101,6 @@ public Map> list() { .map(redisModeEnum -> new EnumVO(null, redisModeEnum.getName(), true)) .collect(Collectors.toList()); - List hystrixIsolationModeEnums = Arrays.stream(HystrixIsolationModeEnum.values()) - .map(hystrixIsolationModeEnum -> new EnumVO(hystrixIsolationModeEnum.getCode(), hystrixIsolationModeEnum.getName(), true)) - .collect(Collectors.toList()); - Map> enums = Maps.newHashMap(); enums.put("httpMethodEnums", httpMethodEnums); enums.put("loadBalanceEnums", loadBalanceEnums); @@ -118,7 +114,6 @@ public Map> list() { enums.put("serializeEnums", serializeEnums); enums.put("wafEnums", wafEnums); enums.put("redisModeEnums", redisModeEnums); - enums.put("hystrixIsolationModeEnums", hystrixIsolationModeEnums); return enums; } 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 4fcb873aead3..796451eb71a8 100644 --- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql +++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql @@ -567,7 +567,6 @@ INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('3 INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,`enabled`) VALUES ('4','rateLimiter','FaultTolerance', 60,'{"master":"mymaster","mode":"standalone","url":"192.168.1.1:6379","password":"abc"}', '0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,`enabled`) VALUES ('5','divide', 'Proxy', 200,'{"multiSelectorHandle":"1","multiRuleHandle":"0"}','1'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`,`enabled`) VALUES ('6','dubbo','Proxy', 310,'{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', '0'); -INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('9','hystrix', 'FaultTolerance', 130,'0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('10','sentinel', 'FaultTolerance', 140,'0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `config`, `enabled`) VALUES ('11','sofa', 'Proxy', 310, '{"protocol":"zookeeper","register":"127.0.0.1:2181","threadpool":"shared"}', '0'); INSERT IGNORE INTO `plugin` (`id`, `name`, `role`, `sort`, `enabled`) VALUES ('12','resilience4j', 'FaultTolerance', 310,'0'); diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/EnumServiceTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/EnumServiceTest.java index ca4e57fa3fe9..3c98c956eb60 100644 --- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/EnumServiceTest.java +++ b/shenyu-admin/src/test/java/org/apache/shenyu/admin/service/EnumServiceTest.java @@ -93,7 +93,7 @@ public void testListEleSupport(final String key) { private static Stream nonNullEleKeys() { return Stream.of("httpMethodEnums", "loadBalanceEnums", "matchModeEnums", "operatorEnums", "paramTypeEnums", "pluginEnums", "pluginTypeEnums", "rpcTypeEnums", "selectorTypeEnums", "serializeEnums", "wafEnums", - "redisModeEnums", "hystrixIsolationModeEnums"); + "redisModeEnums"); } private static Stream nullEleCodeKeys() { @@ -103,7 +103,7 @@ private static Stream nullEleCodeKeys() { private static Stream supportEleCodeKeys() { return Stream.of("loadBalanceEnums", "matchModeEnums", "pluginEnums", "pluginTypeEnums", "selectorTypeEnums", - "serializeEnums", "wafEnums", "redisModeEnums", "hystrixIsolationModeEnums"); + "serializeEnums", "wafEnums", "redisModeEnums"); } } diff --git a/shenyu-bootstrap/pom.xml b/shenyu-bootstrap/pom.xml index 504bb9f2bdbe..19be87b38b73 100644 --- a/shenyu-bootstrap/pom.xml +++ b/shenyu-bootstrap/pom.xml @@ -72,14 +72,6 @@ - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-hystrix - ${project.version} - - - org.apache.shenyu diff --git a/shenyu-bootstrap/src/main/resources/application.yml b/shenyu-bootstrap/src/main/resources/application.yml index 4c1df632a498..7f7bd424f8af 100644 --- a/shenyu-bootstrap/src/main/resources/application.yml +++ b/shenyu-bootstrap/src/main/resources/application.yml @@ -274,7 +274,6 @@ shenyu: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j - /fallback/sentinel health: diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE index ae16c477a83d..98b0e7ad37bf 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/release-docs/LICENSE @@ -314,9 +314,6 @@ The text of each license is the standard Apache 2.0 license. httpcore5-h2 5.2.4: https://hc.apache.org/httpcomponents-core-5.0.x, Apache 2.0 httpcore-nio 4.4.16: http://hc.apache.org/httpcomponents-core-ga, Apache 2.0 httpmime 4.5.13: http://hc.apache.org/httpcomponents-client, Apache 2.0 - hystrix-core 1.5.18: https://github.com/Netflix/Hystrix, Apache 2.0 - hystrix-metrics-event-stream 1.5.18: https://github.com/Netflix/Hystrix, Apache 2.0 - hystrix-serialization 1.5.18: https://github.com/Netflix/Hystrix, Apache 2.0 j2objc-annotations 2.8 https://github.com/google/j2objc, Apache 2.0 jackson-annotations 2.17.1: http://github.com/FasterXML/jackson, Apache 2.0 jackson-core 2.17.1: http://github.com/FasterXML/jackson, Apache 2.0 diff --git a/shenyu-e2e/shenyu-e2e-case/k8s/sync/shenyu-cm.yml b/shenyu-e2e/shenyu-e2e-case/k8s/sync/shenyu-cm.yml index 176b4ea1c826..641cc16ef5b7 100644 --- a/shenyu-e2e/shenyu-e2e-case/k8s/sync/shenyu-cm.yml +++ b/shenyu-e2e/shenyu-e2e-case/k8s/sync/shenyu-cm.yml @@ -400,7 +400,6 @@ data: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j - /fallback/sentinel health: diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/k8s/shenyu-cm.yml b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/k8s/shenyu-cm.yml index 9cde385a082d..0f9fd2f09007 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/k8s/shenyu-cm.yml +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/k8s/shenyu-cm.yml @@ -377,7 +377,6 @@ data: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j - /fallback/sentinel health: diff --git a/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java b/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java index 2339b04c42b5..bb92e6d95389 100644 --- a/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java +++ b/shenyu-e2e/shenyu-e2e-common/src/main/java/org/apache/shenyu/e2e/model/Plugin.java @@ -42,7 +42,6 @@ public enum Plugin { DIVIDE("divide", 5), DUBBO("dubbo", 6), SPRING_CLOUD("springCloud", 8), - HYSTRIX("hystrix", 9), SENTINEL("sentinel", 10), SOFA("sofa", 11), RESILIENCE4J("resilience4j", 12), diff --git a/shenyu-integrated-test/shenyu-integrated-test-http/pom.xml b/shenyu-integrated-test/shenyu-integrated-test-http/pom.xml index 9ef4d79953f9..21d9eca45032 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-http/pom.xml +++ b/shenyu-integrated-test/shenyu-integrated-test-http/pom.xml @@ -130,14 +130,6 @@ - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin-hystrix - ${project.version} - - - org.apache.shenyu diff --git a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/HttpTestControllerTest.java b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/HttpTestControllerTest.java index b8d745c8b1d8..aae5a984a3c6 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/HttpTestControllerTest.java +++ b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/HttpTestControllerTest.java @@ -21,7 +21,7 @@ import okhttp3.MultipartBody; import okhttp3.RequestBody; import okhttp3.Response; -import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.shenyu.common.utils.GsonUtils; import org.apache.shenyu.integratedtest.common.AbstractTest; import org.apache.shenyu.integratedtest.common.dto.BigObject; diff --git a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/HystrixPluginTest.java b/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/HystrixPluginTest.java deleted file mode 100644 index 1ba725205f21..000000000000 --- a/shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/HystrixPluginTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.integrated.test.http.combination; - -import org.apache.shenyu.common.dto.ConditionData; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.enums.HystrixIsolationModeEnum; -import org.apache.shenyu.common.enums.OperatorEnum; -import org.apache.shenyu.common.enums.ParamTypeEnum; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.JsonUtils; -import org.apache.shenyu.integratedtest.common.AbstractPluginDataInit; -import org.apache.shenyu.integratedtest.common.helper.HttpHelper; -import org.apache.shenyu.integratedtest.common.result.ResultBean; -import org.apache.shenyu.plugin.api.result.ShenyuResultEnum; -import org.apache.shenyu.web.controller.LocalPluginController.RuleLocalData; -import org.hamcrest.CoreMatchers; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public final class HystrixPluginTest extends AbstractPluginDataInit { - - private static final String TEST_HYSTRIX_PATH = "/http/test/hystrix/pass"; - - private static final String TEST_HYSTRIX_BAD_REQUEST_PATH = "/http/test/hystrix/fallback"; - - private static final String FALL_BACK = "fallback:/fallback/hystrix"; - - @BeforeEach - public void setup() throws IOException { - String pluginResult = initPlugin(PluginEnum.HYSTRIX.getName(), ""); - assertThat(pluginResult, is("success")); - } - - @Test - public void testPass() throws IOException, ExecutionException, InterruptedException { - String selectorAndRulesResult = - initSelectorAndRules(PluginEnum.HYSTRIX.getName(), "", buildSelectorConditionList(), buildRuleLocalDataList(TEST_HYSTRIX_PATH)); - assertThat(selectorAndRulesResult, is("success")); - Future resp = this.getService().submit(() -> HttpHelper.INSTANCE.getFromGateway(TEST_HYSTRIX_PATH, ResultBean.class)); - assertEquals(200, resp.get().getCode()); - } - - @Test - public void testFallbackBySemaphore() throws IOException, ExecutionException, InterruptedException { - String selectorAndRulesResult = - initSelectorAndRules(PluginEnum.HYSTRIX.getName(), "", buildSelectorConditionList(), buildRuleLocalDataList(FALL_BACK)); - assertThat(selectorAndRulesResult, CoreMatchers.is("success")); - Set resultSet = new HashSet<>(); - Future resp0 = this.getService().submit(() -> HttpHelper.INSTANCE.getFromGateway(TEST_HYSTRIX_BAD_REQUEST_PATH, ResultBean.class)); - Future resp1 = this.getService().submit(() -> HttpHelper.INSTANCE.getFromGateway(TEST_HYSTRIX_BAD_REQUEST_PATH, ResultBean.class)); - Future resp2 = this.getService().submit(() -> HttpHelper.INSTANCE.getFromGateway(TEST_HYSTRIX_BAD_REQUEST_PATH, ResultBean.class)); - resultSet.add(resp0.get().getCode()); - resultSet.add(resp1.get().getCode()); - resultSet.add(resp2.get().getCode()); - assertTrue(resultSet.contains(ShenyuResultEnum.HYSTRIX_PLUGIN_FALLBACK.getCode())); - } - - private static List buildSelectorConditionList() { - ConditionData conditionData = new ConditionData(); - conditionData.setParamType(ParamTypeEnum.URI.getName()); - conditionData.setOperator(OperatorEnum.MATCH.getAlias()); - conditionData.setParamValue("/http/**"); - return Collections.singletonList(conditionData); - } - - private static List buildRuleLocalDataList(final String commandKey) { - final RuleLocalData ruleLocalData = new RuleLocalData(); - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setGroupKey("/http/**"); - hystrixHandle.setCommandKey(commandKey); - hystrixHandle.setMaxConcurrentRequests(1); - hystrixHandle.setRequestVolumeThreshold(1); - hystrixHandle.setErrorThresholdPercentage(0); - hystrixHandle.setSleepWindowInMilliseconds(10000); - hystrixHandle.setTimeout(120000); - hystrixHandle.setCallBackUri("/fallback/hystrix"); - hystrixHandle.setExecutionIsolationStrategy(HystrixIsolationModeEnum.SEMAPHORE.getCode()); - ConditionData conditionData = new ConditionData(); - conditionData.setParamType(ParamTypeEnum.URI.getName()); - conditionData.setOperator(OperatorEnum.MATCH.getAlias()); - conditionData.setParamName("/"); - conditionData.setParamValue("/http/**"); - ruleLocalData.setConditionDataList(Collections.singletonList(conditionData)); - ruleLocalData.setRuleHandler(JsonUtils.toJson(hystrixHandle)); - return Collections.singletonList(ruleLocalData); - } - - @AfterEach - public void clean() throws IOException { - cleanPluginData(PluginEnum.HYSTRIX.getName()); - } -} diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml index c1640fe11b20..b2cad8ad71d8 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-apache-dubbo/src/main/resources/application.yml @@ -254,7 +254,6 @@ shenyu: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j - /fallback/sentinel health: diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml index c1640fe11b20..b2cad8ad71d8 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-http/src/main/resources/application.yml @@ -254,7 +254,6 @@ shenyu: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j - /fallback/sentinel health: diff --git a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml index b736c391a232..34a7ecd17367 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-k8s-ingress-websocket/src/main/resources/application.yml @@ -255,7 +255,6 @@ shenyu: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j - /fallback/sentinel health: diff --git a/shenyu-integrated-test/shenyu-integrated-test-sdk-apache-dubbo/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-sdk-apache-dubbo/src/main/resources/application.yml index 225d1793b835..54ee7d822cf9 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-sdk-apache-dubbo/src/main/resources/application.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-sdk-apache-dubbo/src/main/resources/application.yml @@ -102,7 +102,6 @@ shenyu: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j health: enabled: false diff --git a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml index 27100bbc125e..2161949ad0b9 100644 --- a/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml +++ b/shenyu-integrated-test/shenyu-integrated-test-sdk-http/src/main/resources/application.yml @@ -102,7 +102,6 @@ shenyu: fallback: enabled: false paths: - - /fallback/hystrix - /fallback/resilience4j health: enabled: false diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/pom.xml b/shenyu-plugin/shenyu-plugin-fault-tolerance/pom.xml index 97202ce87b18..1d29eb9539ef 100644 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/pom.xml +++ b/shenyu-plugin/shenyu-plugin-fault-tolerance/pom.xml @@ -27,7 +27,6 @@ pom - shenyu-plugin-hystrix shenyu-plugin-ratelimiter shenyu-plugin-resilience4j shenyu-plugin-sentinel diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/pom.xml b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/pom.xml deleted file mode 100644 index dc802eeec67e..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-plugin-fault-tolerance - 2.7.2-SNAPSHOT - - 4.0.0 - shenyu-plugin-hystrix - - - 1.5.18 - 1.5.18 - 1.2.1 - - - - - - com.netflix.hystrix - hystrix-core - ${hystrix-core.version} - - - com.netflix.hystrix - hystrix-metrics-event-stream - ${hystrix-metrics-event-stream.version} - - - io.reactivex - rxjava-reactive-streams - ${rxjava-reactive-streams.version} - - - diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/HystrixPlugin.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/HystrixPlugin.java deleted file mode 100644 index b8ec643cd0bd..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/HystrixPlugin.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix; - -import org.apache.commons.lang3.StringUtils; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.enums.HystrixIsolationModeEnum; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.enums.ResultEnum; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.plugin.api.context.ShenyuContext; -import org.apache.shenyu.plugin.base.AbstractShenyuPlugin; -import org.apache.shenyu.plugin.base.utils.CacheKeyUtils; -import org.apache.shenyu.plugin.hystrix.builder.HystrixBuilder; -import org.apache.shenyu.plugin.hystrix.command.Command; -import org.apache.shenyu.plugin.hystrix.command.HystrixCommand; -import org.apache.shenyu.plugin.hystrix.command.HystrixCommandOnThread; -import org.apache.shenyu.plugin.hystrix.handler.HystrixPluginDataHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatusCode; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; -import rx.Subscription; - -import java.util.Objects; -import java.util.Optional; -import java.util.function.Consumer; - -/** - * Hystrix Plugin. - */ -public class HystrixPlugin extends AbstractShenyuPlugin { - - private static final Logger LOG = LoggerFactory.getLogger(HystrixPlugin.class); - - @Override - protected Mono doExecute(final ServerWebExchange exchange, final ShenyuPluginChain chain, final SelectorData selector, final RuleData rule) { - final ShenyuContext shenyuContext = exchange.getAttribute(Constants.CONTEXT); - Objects.requireNonNull(shenyuContext); - final HystrixHandle hystrixHandle = HystrixPluginDataHandler.CACHED_HANDLE.get().obtainHandle(CacheKeyUtils.INST.getKey(rule)); - if (Objects.isNull(hystrixHandle)) { - LOG.error("hystrix handler is null, rule: {}", rule); - return chain.execute(exchange); - } - String groupKey = hystrixHandle.getGroupKey(); - if (StringUtils.isBlank(hystrixHandle.getGroupKey())) { - groupKey = Objects.requireNonNull(shenyuContext).getModule(); - } - String commandKey = hystrixHandle.getCommandKey(); - if (StringUtils.isBlank(hystrixHandle.getCommandKey())) { - commandKey = Objects.requireNonNull(shenyuContext).getMethod(); - } - Command command = fetchCommand(hystrixHandle, exchange, chain, commandKey, groupKey); - return Mono.create(s -> { - Subscription sub = command.fetchObservable().subscribe(s::success, - s::error, s::success); - s.onCancel(sub::unsubscribe); - if (command.isCircuitBreakerOpen()) { - LOG.error("hystrix execute have circuitBreaker is Open! groupKey:{},commandKey:{}", hystrixHandle.getGroupKey(), hystrixHandle.getCommandKey()); - } - }).doOnError(throwable -> { - LOG.error("hystrix execute exception:", throwable); - exchange.getAttributes().put(Constants.CLIENT_RESPONSE_RESULT_TYPE, ResultEnum.ERROR.getName()); - chain.execute(exchange); - }).then().doFinally(monoV -> { - final Consumer consumer = exchange.getAttribute(Constants.METRICS_HYSTRIX); - Optional.ofNullable(consumer).ifPresent(c -> c.accept(exchange.getResponse().getStatusCode())); - }); - } - - private Command fetchCommand(final HystrixHandle hystrixHandle, final ServerWebExchange exchange, final ShenyuPluginChain chain, final String commandKey, final String groupKey) { - if (hystrixHandle.getExecutionIsolationStrategy() == HystrixIsolationModeEnum.SEMAPHORE.getCode()) { - return new HystrixCommand(HystrixBuilder.build(hystrixHandle, commandKey, groupKey), - exchange, chain, hystrixHandle.getCallBackUri()); - } - return new HystrixCommandOnThread(HystrixBuilder.buildForHystrixCommand(hystrixHandle, commandKey, groupKey), - exchange, chain, hystrixHandle.getCallBackUri()); - } - - @Override - public String named() { - return PluginEnum.HYSTRIX.getName(); - } - - @Override - public int getOrder() { - return PluginEnum.HYSTRIX.getCode(); - } - -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilder.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilder.java deleted file mode 100644 index decfa42f0db5..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilder.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.builder; - -import com.netflix.hystrix.HystrixCommand; -import com.netflix.hystrix.HystrixCommandGroupKey; -import com.netflix.hystrix.HystrixCommandKey; -import com.netflix.hystrix.HystrixCommandProperties; -import com.netflix.hystrix.HystrixObservableCommand; -import com.netflix.hystrix.HystrixThreadPoolProperties; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle.HystrixThreadPoolConfig; - -import java.util.Objects; - -/** - * the hystrix builder. - */ -public final class HystrixBuilder { - - private HystrixBuilder() { - } - - /** - * this is build HystrixObservableCommand.Setter. - * - * @param hystrixHandle {@linkplain HystrixHandle} - * @param commandKey commandKey - * @param groupKey groupKey - * @return {@linkplain HystrixObservableCommand.Setter} - */ - public static HystrixObservableCommand.Setter build(final HystrixHandle hystrixHandle, final String commandKey, final String groupKey) { - initHystrixHandleOnRequire(hystrixHandle); - HystrixCommandGroupKey hystrixCommandGroupKey = HystrixCommandGroupKey.Factory.asKey(groupKey); - HystrixCommandKey hystrixCommandKey = HystrixCommandKey.Factory.asKey(commandKey); - HystrixCommandProperties.Setter propertiesSetter = - HystrixCommandProperties.Setter() - .withExecutionTimeoutInMilliseconds((int) hystrixHandle.getTimeout()) - .withCircuitBreakerEnabled(true) - .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE) - .withExecutionIsolationSemaphoreMaxConcurrentRequests(hystrixHandle.getMaxConcurrentRequests()) - .withCircuitBreakerErrorThresholdPercentage(hystrixHandle.getErrorThresholdPercentage()) - .withCircuitBreakerRequestVolumeThreshold(hystrixHandle.getRequestVolumeThreshold()) - .withCircuitBreakerSleepWindowInMilliseconds(hystrixHandle.getSleepWindowInMilliseconds()); - return HystrixObservableCommand.Setter - .withGroupKey(hystrixCommandGroupKey) - .andCommandKey(hystrixCommandKey) - .andCommandPropertiesDefaults(propertiesSetter); - } - - /** - * this is build HystrixObservableCommand.Setter. - * - * @param hystrixHandle {@linkplain HystrixHandle} - * @return {@linkplain HystrixObservableCommand.Setter} - */ - public static HystrixObservableCommand.Setter build(final HystrixHandle hystrixHandle) { - return build(hystrixHandle, hystrixHandle.getCommandKey(), hystrixHandle.getGroupKey()); - } - - /** - * this is build HystrixCommand.Setter. - * - * @param hystrixHandle {@linkplain HystrixHandle} - * @return {@linkplain HystrixCommand.Setter} - */ - public static HystrixCommand.Setter buildForHystrixCommand(final HystrixHandle hystrixHandle) { - return buildForHystrixCommand(hystrixHandle, hystrixHandle.getCommandKey(), hystrixHandle.getGroupKey()); - } - - /** - * this is build HystrixCommand.Setter. - * - * @param hystrixHandle {@linkplain HystrixHandle} - * @param commandKey commandKey - * @param groupKey groupKey - * @return {@linkplain HystrixCommand.Setter} - */ - public static HystrixCommand.Setter buildForHystrixCommand(final HystrixHandle hystrixHandle, final String commandKey, final String groupKey) { - initHystrixHandleOnRequire(hystrixHandle); - HystrixCommandGroupKey hystrixCommandGroupKey = HystrixCommandGroupKey.Factory.asKey(groupKey); - HystrixCommandKey hystrixCommandKey = HystrixCommandKey.Factory.asKey(commandKey); - HystrixCommandProperties.Setter propertiesSetter = - HystrixCommandProperties.Setter() - .withExecutionTimeoutInMilliseconds((int) hystrixHandle.getTimeout()) - .withCircuitBreakerEnabled(true) - .withCircuitBreakerErrorThresholdPercentage(hystrixHandle.getErrorThresholdPercentage()) - .withCircuitBreakerRequestVolumeThreshold(hystrixHandle.getRequestVolumeThreshold()) - .withCircuitBreakerSleepWindowInMilliseconds(hystrixHandle.getSleepWindowInMilliseconds()); - HystrixThreadPoolConfig hystrixThreadPoolConfig = hystrixHandle.getHystrixThreadPoolConfig(); - HystrixThreadPoolProperties.Setter threadPoolPropertiesSetter = - HystrixThreadPoolProperties.Setter() - .withCoreSize(hystrixThreadPoolConfig.getCoreSize()) - .withMaximumSize(hystrixThreadPoolConfig.getMaximumSize()) - .withMaxQueueSize(hystrixThreadPoolConfig.getMaxQueueSize()) - .withKeepAliveTimeMinutes(hystrixThreadPoolConfig.getKeepAliveTimeMinutes()) - .withAllowMaximumSizeToDivergeFromCoreSize(true); - return HystrixCommand.Setter - .withGroupKey(hystrixCommandGroupKey) - .andCommandKey(hystrixCommandKey) - .andCommandPropertiesDefaults(propertiesSetter) - .andThreadPoolPropertiesDefaults(threadPoolPropertiesSetter); - } - - private static void initHystrixHandleOnRequire(final HystrixHandle hystrixHandle) { - if (hystrixHandle.getMaxConcurrentRequests() == 0) { - hystrixHandle.setMaxConcurrentRequests(Constants.MAX_CONCURRENT_REQUESTS); - } - if (hystrixHandle.getErrorThresholdPercentage() == 0) { - hystrixHandle.setErrorThresholdPercentage(Constants.ERROR_THRESHOLD_PERCENTAGE); - } - if (hystrixHandle.getRequestVolumeThreshold() == 0) { - hystrixHandle.setRequestVolumeThreshold(Constants.REQUEST_VOLUME_THRESHOLD); - } - if (hystrixHandle.getSleepWindowInMilliseconds() == 0) { - hystrixHandle.setSleepWindowInMilliseconds(Constants.SLEEP_WINDOW_INMILLISECONDS); - } - if (Objects.isNull(hystrixHandle.getHystrixThreadPoolConfig())) { - hystrixHandle.setHystrixThreadPoolConfig(new HystrixThreadPoolConfig()); - } - HystrixThreadPoolConfig hystrixThreadPoolConfig = hystrixHandle.getHystrixThreadPoolConfig(); - if (hystrixThreadPoolConfig.getCoreSize() == 0) { - hystrixThreadPoolConfig.setCoreSize(Constants.HYSTRIX_THREAD_POOL_CORE_SIZE); - } - if (hystrixThreadPoolConfig.getMaximumSize() == 0) { - hystrixThreadPoolConfig.setMaximumSize(Constants.HYSTRIX_THREAD_POOL_MAX_SIZE); - } - if (hystrixThreadPoolConfig.getMaxQueueSize() == 0) { - hystrixThreadPoolConfig.setMaxQueueSize(Constants.HYSTRIX_THREAD_POOL_QUEUE_SIZE); - } - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/Command.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/Command.java deleted file mode 100644 index 55648faae347..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/Command.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.command; - -import com.netflix.hystrix.exception.HystrixRuntimeException; -import com.netflix.hystrix.exception.HystrixTimeoutException; -import org.apache.shenyu.plugin.api.result.ShenyuResultEnum; -import org.apache.shenyu.plugin.api.result.ShenyuResultWrap; -import org.apache.shenyu.plugin.api.utils.WebFluxResultUtils; -import org.apache.shenyu.plugin.base.fallback.FallbackHandler; -import org.springframework.http.HttpStatus; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; -import rx.Observable; - -import java.net.URI; - -/** - * hystrix command for semaphore and thread. - */ -public interface Command extends FallbackHandler { - /** - * wrap fetch Observable in {@link HystrixCommand} and {@link HystrixCommandOnThread}. - * - * @return {@code Observable} that executes and calls back with the result of command execution - * or a fallback if the command fails for any reason. - */ - Observable fetchObservable(); - - /** - * whether the 'circuit-breaker' is open. - * - * @return boolean - */ - boolean isCircuitBreakerOpen(); - - @Override - default Mono withoutFallback(final ServerWebExchange exchange, final Throwable throwable) { - Object error; - if (throwable instanceof HystrixRuntimeException) { - HystrixRuntimeException e = (HystrixRuntimeException) throwable; - if (e.getFailureType() == HystrixRuntimeException.FailureType.TIMEOUT) { - exchange.getResponse().setStatusCode(HttpStatus.GATEWAY_TIMEOUT); - error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.SERVICE_TIMEOUT); - } else { - exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); - error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.SERVICE_RESULT_ERROR); - } - } else if (throwable instanceof HystrixTimeoutException) { - exchange.getResponse().setStatusCode(HttpStatus.GATEWAY_TIMEOUT); - error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.SERVICE_TIMEOUT); - } else { - exchange.getResponse().setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); - error = ShenyuResultWrap.error(exchange, ShenyuResultEnum.SERVICE_RESULT_ERROR); - } - return WebFluxResultUtils.result(exchange, error); - } - - /** - * get call back uri. - * @return when some error occurs in hystrix invoke it will forward to this - */ - URI getCallBackUri(); - - /** - * removeCommandKey rule data. - * @param commandKey commandKey - */ - void removeCommandKey(String commandKey); - - /** - * clean all command. - */ - void cleanCommand(); - -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommand.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommand.java deleted file mode 100644 index a98d61014546..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommand.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.command; - -import com.netflix.hystrix.HystrixObservableCommand; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.common.utils.UriUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; -import rx.Observable; -import rx.RxReactiveStreams; - -import java.net.URI; - -/** - * the Hystrix command. - */ -public class HystrixCommand extends HystrixObservableCommand implements Command { - - private static final Logger LOG = LoggerFactory.getLogger(HystrixCommand.class); - - private final ServerWebExchange exchange; - - private final ShenyuPluginChain chain; - - private final URI callBackUri; - - /** - * Instantiates a new Http command. - * - * @param setter the setter - * @param exchange the exchange - * @param chain the chain - * @param callBackUri the call back uri - */ - public HystrixCommand(final Setter setter, - final ServerWebExchange exchange, - final ShenyuPluginChain chain, - final String callBackUri) { - super(setter); - this.exchange = exchange; - this.chain = chain; - this.callBackUri = UriUtils.createUri(callBackUri); - } - - @Override - protected Observable construct() { - return RxReactiveStreams.toObservable(chain.execute(exchange)); - } - - @Override - protected Observable resumeWithFallback() { - return RxReactiveStreams.toObservable(doFallback()); - } - - private Mono doFallback() { - if (isFailedExecution()) { - LOG.error("hystrix execute have error: ", getExecutionException()); - } - final Throwable exception = getExecutionException(); - return fallback(exchange, getCallBackUri(), exception); - } - - @Override - public Observable fetchObservable() { - return this.toObservable(); - } - - @Override - public URI getCallBackUri() { - return callBackUri; - } - - @Override - public void removeCommandKey(final String commandKey) { - executionSemaphorePerCircuit.remove(commandKey); - } - - @Override - public void cleanCommand() { - executionSemaphorePerCircuit.clear(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThread.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThread.java deleted file mode 100644 index 8babca267d64..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThread.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.command; - -import com.netflix.hystrix.HystrixCommand; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.common.utils.UriUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; -import rx.Observable; -import rx.RxReactiveStreams; - -import java.net.URI; - -/** - * hystrix command in thread isolation mode. - */ -public class HystrixCommandOnThread extends HystrixCommand> implements Command { - - private static final Logger LOG = LoggerFactory.getLogger(HystrixCommandOnThread.class); - - private final ServerWebExchange exchange; - - private final ShenyuPluginChain chain; - - private final URI callBackUri; - - /** - * Instantiates a new Http command. - * - * @param setter the setter - * @param exchange the exchange - * @param chain the chain - * @param callBackUri the call back uri - */ - public HystrixCommandOnThread(final HystrixCommand.Setter setter, - final ServerWebExchange exchange, - final ShenyuPluginChain chain, - final String callBackUri) { - super(setter); - this.exchange = exchange; - this.chain = chain; - this.callBackUri = UriUtils.createUri(callBackUri); - } - - @Override - protected Mono run() { - RxReactiveStreams.toObservable(chain.execute(exchange)).toBlocking().subscribe(); - return Mono.empty(); - } - - @Override - protected Mono getFallback() { - if (isFailedExecution()) { - LOG.error("hystrix execute have error: ", getExecutionException()); - } - final Throwable exception = getExecutionException(); - return fallback(exchange, getCallBackUri(), exception); - } - - @Override - public Observable fetchObservable() { - return RxReactiveStreams.toObservable(this.execute()); - } - - @Override - public URI getCallBackUri() { - return callBackUri; - } - - @Override - public void removeCommandKey(final String commandKey) { - executionSemaphorePerCircuit.remove(commandKey); - } - - @Override - public void cleanCommand() { - executionSemaphorePerCircuit.clear(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandler.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandler.java deleted file mode 100644 index be88c5c55e63..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/main/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandler.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.handler; - -import com.netflix.hystrix.strategy.properties.HystrixPropertiesFactory; -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.plugin.base.cache.CommonHandleCache; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.apache.shenyu.plugin.base.utils.BeanHolder; -import org.apache.shenyu.plugin.base.utils.CacheKeyUtils; -import org.apache.shenyu.plugin.hystrix.builder.HystrixBuilder; -import org.apache.shenyu.plugin.hystrix.command.Command; -import org.apache.shenyu.plugin.hystrix.command.HystrixCommand; -import org.springframework.util.StringUtils; - -import java.util.Optional; -import java.util.function.Supplier; - -/** - * The type Hystrix plugin data handler. - */ -public class HystrixPluginDataHandler implements PluginDataHandler { - - public static final Supplier> CACHED_HANDLE = new BeanHolder<>(CommonHandleCache::new); - - @Override - public void handlerSelector(final SelectorData selectorData) { - if (!selectorData.getContinued()) { - CACHED_HANDLE.get().cachedHandle(CacheKeyUtils.INST.getKey(selectorData.getId(), Constants.DEFAULT_RULE), HystrixHandle.newDefaultInstance()); - } - } - - @Override - public void removeSelector(final SelectorData selectorData) { - CACHED_HANDLE.get().removeHandle(CacheKeyUtils.INST.getKey(selectorData.getId(), Constants.DEFAULT_RULE)); - } - - @Override - public void handlerRule(final RuleData ruleData) { - HystrixPropertiesFactory.reset(); - Optional.ofNullable(ruleData.getHandle()).ifPresent(rule -> { - HystrixHandle hystrixHandle = GsonUtils.getInstance().fromJson(rule, HystrixHandle.class); - String key = CacheKeyUtils.INST.getKey(ruleData); - Optional.ofNullable(CACHED_HANDLE.get().obtainHandle(key)).ifPresent(hystrixHandleCache -> { - if (hystrixHandleCache.getMaxConcurrentRequests() != hystrixHandle.getMaxConcurrentRequests()) { - String commandKey = hystrixHandle.getCommandKey(); - Command command = new HystrixCommand(HystrixBuilder.build(hystrixHandle), null, null, null); - command.removeCommandKey(commandKey); - } - // fix ISSUE #3820, in same rule, change isolation strategy, can't circuit breaker - if (hystrixHandleCache.getExecutionIsolationStrategy() != hystrixHandle.getExecutionIsolationStrategy()) { - Command command = new HystrixCommand(HystrixBuilder.build(hystrixHandleCache), null, null, null); - if (StringUtils.hasText(hystrixHandle.getCommandKey())) { - command.removeCommandKey(hystrixHandle.getCommandKey()); - } else { - // delete all old Commands of the specified group - command.cleanCommand(); - } - } - }); - CACHED_HANDLE.get().cachedHandle(key, hystrixHandle); - }); - } - - @Override - public void removeRule(final RuleData ruleData) { - Optional.ofNullable(ruleData.getHandle()).ifPresent(rule -> CACHED_HANDLE.get().removeHandle(CacheKeyUtils.INST.getKey(ruleData))); - } - - @Override - public String pluginNamed() { - return PluginEnum.HYSTRIX.getName(); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/HystrixPluginTest.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/HystrixPluginTest.java deleted file mode 100644 index 2ca316b64389..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/HystrixPluginTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix; - -import org.apache.shenyu.common.constant.Constants; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.dto.SelectorData; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.enums.HystrixIsolationModeEnum; -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.common.utils.GsonUtils; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.plugin.api.context.ShenyuContext; -import org.apache.shenyu.plugin.base.utils.CacheKeyUtils; -import org.apache.shenyu.plugin.hystrix.handler.HystrixPluginDataHandler; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; -import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.web.server.ServerWebExchange; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - - -/** - * The Test Case For HystrixPlugin. - */ -public final class HystrixPluginTest { - - private HystrixPlugin hystrixPlugin; - - @BeforeEach - public void setUp() { - hystrixPlugin = new HystrixPlugin(); - } - - @Test - public void testDoExecuteNullException() { - final ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - ShenyuContext shenyuContext = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, shenyuContext); - ShenyuPluginChain chain = mock(ShenyuPluginChain.class); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setMaxConcurrentRequests(0); - hystrixHandle.setErrorThresholdPercentage(0); - hystrixHandle.setRequestVolumeThreshold(0); - hystrixHandle.setSleepWindowInMilliseconds(0); - RuleData rule = new RuleData(); - HystrixPluginDataHandler.CACHED_HANDLE.get().cachedHandle(CacheKeyUtils.INST.getKey(rule), hystrixHandle); - rule.setHandle(GsonUtils.getInstance().toJson(hystrixHandle)); - SelectorData selectorData = mock(SelectorData.class); - assertThrows(NullPointerException.class, () -> { - Mono mono = hystrixPlugin.doExecute(exchange, chain, selectorData, rule); - StepVerifier.create(mono).expectSubscription().verifyComplete(); - }); - } - - @Test - public void testDoExecute() { - final ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("localhost").build()); - ShenyuContext shenyuContext = mock(ShenyuContext.class); - exchange.getAttributes().put(Constants.CONTEXT, shenyuContext); - ShenyuPluginChain chain = mock(ShenyuPluginChain.class); - when(chain.execute(exchange)).thenReturn(Mono.empty()); - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setGroupKey("groupKey"); - hystrixHandle.setCommandKey(" commandKey"); - hystrixHandle.setMaxConcurrentRequests(0); - hystrixHandle.setErrorThresholdPercentage(0); - hystrixHandle.setRequestVolumeThreshold(0); - hystrixHandle.setSleepWindowInMilliseconds(0); - RuleData rule = new RuleData(); - HystrixPluginDataHandler.CACHED_HANDLE.get().cachedHandle(CacheKeyUtils.INST.getKey(rule), hystrixHandle); - rule.setHandle(GsonUtils.getInstance().toJson(hystrixHandle)); - SelectorData selectorData = mock(SelectorData.class); - Mono mono = hystrixPlugin.doExecute(exchange, chain, selectorData, rule); - StepVerifier.create(mono).expectSubscription().verifyComplete(); - hystrixHandle.setExecutionIsolationStrategy(HystrixIsolationModeEnum.THREAD_POOL.getCode()); - rule.setHandle(GsonUtils.getInstance().toJson(hystrixHandle)); - Mono threadMono = hystrixPlugin.doExecute(exchange, chain, selectorData, rule); - StepVerifier.create(threadMono).expectSubscription().verifyComplete(); - } - - @Test - public void testNamed() { - assertEquals(hystrixPlugin.named(), PluginEnum.HYSTRIX.getName()); - } - - @Test - public void testGetOrder() { - assertEquals(hystrixPlugin.getOrder(), PluginEnum.HYSTRIX.getCode()); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilderTest.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilderTest.java deleted file mode 100644 index 27096f0a56dd..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/builder/HystrixBuilderTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.builder; - -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle.HystrixThreadPoolConfig; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * The Test Case For HystrixBuilder. - */ -public final class HystrixBuilderTest { - - @Test - public void testBuild() { - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setGroupKey("groupKey"); - hystrixHandle.setCommandKey("commandKey"); - hystrixHandle.setMaxConcurrentRequests(0); - hystrixHandle.setErrorThresholdPercentage(0); - hystrixHandle.setRequestVolumeThreshold(0); - hystrixHandle.setSleepWindowInMilliseconds(0); - hystrixHandle.setHystrixThreadPoolConfig(null); - assertNotNull(HystrixBuilder.build(hystrixHandle)); - HystrixThreadPoolConfig hystrixThreadPoolConfig = new HystrixThreadPoolConfig(); - hystrixThreadPoolConfig.setCoreSize(0); - hystrixThreadPoolConfig.setMaximumSize(0); - hystrixThreadPoolConfig.setMaxQueueSize(0); - hystrixHandle.setHystrixThreadPoolConfig(hystrixThreadPoolConfig); - assertNotNull(HystrixBuilder.build(hystrixHandle)); - assertNotNull(HystrixBuilder.buildForHystrixCommand(hystrixHandle)); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThreadTest.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThreadTest.java deleted file mode 100644 index 1f0f643c3e71..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandOnThreadTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.command; - -import com.netflix.hystrix.HystrixCommand; -import com.netflix.hystrix.HystrixCommandGroupKey; -import com.netflix.hystrix.HystrixCommandKey; -import com.netflix.hystrix.HystrixCommandProperties; -import com.netflix.hystrix.HystrixThreadPoolProperties; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle.HystrixThreadPoolConfig; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.apache.shenyu.plugin.base.fallback.FallbackHandler; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; -import org.springframework.mock.web.server.MockServerWebExchange; -import reactor.test.StepVerifier; - -import java.net.InetSocketAddress; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.mock; - -/** - * The Test Case For HystrixCommandOnThread. - */ -public final class HystrixCommandOnThreadTest { - - private HystrixCommandOnThread hystrixCommandOnThread; - - @BeforeEach - public void setUp() { - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setGroupKey("groupKey"); - hystrixHandle.setCommandKey("commandKey"); - hystrixHandle.setHystrixThreadPoolConfig(new HystrixThreadPoolConfig()); - HystrixCommandProperties.Setter propertiesSetter = - HystrixCommandProperties.Setter() - .withExecutionTimeoutInMilliseconds((int) hystrixHandle.getTimeout()) - .withCircuitBreakerEnabled(true) - .withCircuitBreakerErrorThresholdPercentage(hystrixHandle.getErrorThresholdPercentage()) - .withCircuitBreakerRequestVolumeThreshold(hystrixHandle.getRequestVolumeThreshold()) - .withCircuitBreakerSleepWindowInMilliseconds(hystrixHandle.getSleepWindowInMilliseconds()); - HystrixThreadPoolConfig hystrixThreadPoolConfig = hystrixHandle.getHystrixThreadPoolConfig(); - HystrixThreadPoolProperties.Setter threadPoolPropertiesSetter = - HystrixThreadPoolProperties.Setter() - .withCoreSize(hystrixThreadPoolConfig.getCoreSize()) - .withMaximumSize(hystrixThreadPoolConfig.getMaximumSize()) - .withMaxQueueSize(hystrixThreadPoolConfig.getMaxQueueSize()) - .withKeepAliveTimeMinutes(hystrixThreadPoolConfig.getKeepAliveTimeMinutes()) - .withAllowMaximumSizeToDivergeFromCoreSize(true); - HystrixCommand.Setter setter = HystrixCommand.Setter - .withGroupKey(HystrixCommandGroupKey.Factory.asKey(hystrixHandle.getGroupKey())) - .andCommandKey(HystrixCommandKey.Factory.asKey(hystrixHandle.getCommandKey())) - .andCommandPropertiesDefaults(propertiesSetter) - .andThreadPoolPropertiesDefaults(threadPoolPropertiesSetter); - MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("http://localhost:8080/http") - .remoteAddress(new InetSocketAddress(8092)) - .header("MetaDataCache", "Hello") - .build()); - hystrixCommandOnThread = new HystrixCommandOnThread(setter, exchange, mock(ShenyuPluginChain.class), FallbackHandler.PREFIX + "/test"); - } - - @Test - public void testGetCallBackUri() { - assertEquals("/test", hystrixCommandOnThread.getCallBackUri().getPath()); - } - - @Test - public void testGetFallback() { - assertThrows(NullPointerException.class, () -> StepVerifier.create(hystrixCommandOnThread.getFallback()).expectSubscription().verifyComplete()); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandTest.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandTest.java deleted file mode 100644 index 1d8ffa6f3d78..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/command/HystrixCommandTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.command; - -import com.netflix.hystrix.HystrixCommandGroupKey; -import com.netflix.hystrix.HystrixCommandKey; -import com.netflix.hystrix.HystrixCommandProperties; -import com.netflix.hystrix.HystrixObservableCommand; -import org.apache.shenyu.common.dto.convert.rule.HystrixHandle; -import org.apache.shenyu.plugin.api.ShenyuPluginChain; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.mock.http.server.reactive.MockServerHttpRequest; -import org.springframework.mock.web.server.MockServerWebExchange; -import org.springframework.test.util.ReflectionTestUtils; -import rx.observers.TestSubscriber; - -import java.net.InetSocketAddress; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * The Test Case For HystrixCommand. - */ -@ExtendWith(MockitoExtension.class) -public final class HystrixCommandTest { - - private HystrixCommand hystrixCommand; - - @BeforeEach - public void setUp() { - MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("http://localhost:8080/http") - .remoteAddress(new InetSocketAddress(8092)) - .header("MetaDataCache", "Hello") - .build()); - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setGroupKey("groupKey"); - hystrixHandle.setCommandKey("commandKey"); - final HystrixCommandProperties.Setter propertiesSetter = - HystrixCommandProperties.Setter() - .withExecutionTimeoutInMilliseconds((int) hystrixHandle.getTimeout()) - .withCircuitBreakerEnabled(true) - .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE) - .withExecutionIsolationSemaphoreMaxConcurrentRequests(hystrixHandle.getMaxConcurrentRequests()) - .withCircuitBreakerErrorThresholdPercentage(hystrixHandle.getErrorThresholdPercentage()) - .withCircuitBreakerRequestVolumeThreshold(hystrixHandle.getRequestVolumeThreshold()) - .withCircuitBreakerSleepWindowInMilliseconds(hystrixHandle.getSleepWindowInMilliseconds()); - HystrixObservableCommand.Setter setter = HystrixObservableCommand.Setter - .withGroupKey(HystrixCommandGroupKey.Factory.asKey(hystrixHandle.getGroupKey())) - .andCommandKey(HystrixCommandKey.Factory.asKey(hystrixHandle.getCommandKey())) - .andCommandPropertiesDefaults(propertiesSetter); - hystrixCommand = new HystrixCommand(setter, exchange, mock(ShenyuPluginChain.class), "http://callback:8093/test"); - } - - @Test - public void testFetchObservable() { - assertNotNull(hystrixCommand.fetchObservable()); - } - - @Test - public void testGetCallBackUri() { - assertEquals("callback", hystrixCommand.getCallBackUri().getHost()); - } - - @Test - public void testConstruct() { - assertNotNull(ReflectionTestUtils.invokeMethod(this.hystrixCommand, "construct")); - } - - @Test - public void testResumeWithFallback() { - MockServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("http://localhost:8080/http") - .remoteAddress(new InetSocketAddress(8092)) - .header("MetaDataCache", "Hello") - .build()); - HystrixHandle hystrixHandle = new HystrixHandle(); - hystrixHandle.setGroupKey("groupKey"); - hystrixHandle.setCommandKey("commandKey"); - final HystrixCommandProperties.Setter propertiesSetter = - HystrixCommandProperties.Setter() - .withExecutionTimeoutInMilliseconds((int) hystrixHandle.getTimeout()) - .withCircuitBreakerEnabled(true) - .withExecutionIsolationStrategy(HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE) - .withExecutionIsolationSemaphoreMaxConcurrentRequests(hystrixHandle.getMaxConcurrentRequests()) - .withCircuitBreakerErrorThresholdPercentage(hystrixHandle.getErrorThresholdPercentage()) - .withCircuitBreakerRequestVolumeThreshold(hystrixHandle.getRequestVolumeThreshold()) - .withCircuitBreakerSleepWindowInMilliseconds(hystrixHandle.getSleepWindowInMilliseconds()); - HystrixObservableCommand.Setter setter = HystrixObservableCommand.Setter - .withGroupKey(HystrixCommandGroupKey.Factory.asKey(hystrixHandle.getGroupKey())) - .andCommandKey(HystrixCommandKey.Factory.asKey(hystrixHandle.getCommandKey())) - .andCommandPropertiesDefaults(propertiesSetter); - assertThrows(NullPointerException.class, () -> { - HystrixCommand hystrixCommand = new HystrixCommand(setter, exchange, mock(ShenyuPluginChain.class), null); - TestSubscriber testSubscriberWithNull = new TestSubscriber<>(); - when(hystrixCommand.resumeWithFallback().subscribe(testSubscriberWithNull)).thenThrow(NullPointerException.class); - }); - } -} diff --git a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandlerTest.java deleted file mode 100644 index bf76fac6968d..000000000000 --- a/shenyu-plugin/shenyu-plugin-fault-tolerance/shenyu-plugin-hystrix/src/test/java/org/apache/shenyu/plugin/hystrix/handler/HystrixPluginDataHandlerTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.plugin.hystrix.handler; - -import com.netflix.hystrix.HystrixCommandKey; -import com.netflix.hystrix.HystrixCommandProperties.Setter; -import com.netflix.hystrix.strategy.properties.HystrixPropertiesFactory; -import org.apache.shenyu.common.dto.RuleData; -import org.apache.shenyu.common.enums.PluginEnum; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.mockito.Mockito.mock; - -/** - * The Test Case For HystrixPluginDataHandler. - */ -public final class HystrixPluginDataHandlerTest { - - private HystrixPluginDataHandler hystrixPluginDataHandler; - - @BeforeEach - public void setUp() { - hystrixPluginDataHandler = new HystrixPluginDataHandler(); - } - - @Test - public void testHandlerRUle() { - hystrixPluginDataHandler.handlerRule(mock(RuleData.class)); - assertNotNull(HystrixPropertiesFactory.getCommandProperties(mock(HystrixCommandKey.class), mock(Setter.class))); - } - - @Test - public void testPluginNamed() { - assertEquals(hystrixPluginDataHandler.pluginNamed(), PluginEnum.HYSTRIX.getName()); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml index edf659b8adfb..ec4c7752d45d 100644 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml +++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/pom.xml @@ -30,7 +30,6 @@ shenyu-spring-boot-starter-plugin-global shenyu-spring-boot-starter-plugin-divide shenyu-spring-boot-starter-plugin-httpclient - shenyu-spring-boot-starter-plugin-hystrix shenyu-spring-boot-starter-plugin-ratelimiter shenyu-spring-boot-starter-plugin-sign shenyu-spring-boot-starter-plugin-waf diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/pom.xml b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/pom.xml deleted file mode 100644 index 887af42cfe85..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - org.apache.shenyu - shenyu-spring-boot-starter-plugin - 2.7.2-SNAPSHOT - - 4.0.0 - shenyu-spring-boot-starter-plugin-hystrix - - - - org.apache.shenyu - shenyu-plugin-hystrix - ${project.version} - - - diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfiguration.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfiguration.java deleted file mode 100644 index fe80aad95b58..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfiguration.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.springboot.starter.plugin.hystrix; - -import org.apache.shenyu.plugin.api.ShenyuPlugin; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.apache.shenyu.plugin.hystrix.HystrixPlugin; -import org.apache.shenyu.plugin.hystrix.handler.HystrixPluginDataHandler; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * The type Hystrix plugin configuration. - */ -@Configuration -@ConditionalOnProperty(value = {"shenyu.plugins.hystrix.enabled"}, havingValue = "true", matchIfMissing = true) -public class HystrixPluginConfiguration { - - /** - * Hystrix plugin. - * - * @return the shenyu plugin - */ - @Bean - public ShenyuPlugin hystrixPlugin() { - return new HystrixPlugin(); - } - - /** - * Hystrix plugin data handler. - * - * @return the plugin data handler - */ - @Bean - public PluginDataHandler hystrixPluginDataHandler() { - return new HystrixPluginDataHandler(); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.factories b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 72bc5a0f4dfd..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,19 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.apache.shenyu.springboot.starter.plugin.hystrix.HystrixPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.provides b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.provides deleted file mode 100644 index d00844605a65..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring.provides +++ /dev/null @@ -1,18 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -provides: shenyu-spring-boot-starter-plugin-hystrix diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 553510d1d278..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1,18 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -org.apache.shenyu.springboot.starter.plugin.hystrix.HystrixPluginConfiguration diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/test/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfigurationTest.java b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/test/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfigurationTest.java deleted file mode 100644 index 8db9ac489af8..000000000000 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-hystrix/src/test/java/org/apache/shenyu/springboot/starter/plugin/hystrix/HystrixPluginConfigurationTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shenyu.springboot.starter.plugin.hystrix; - -import org.apache.shenyu.common.enums.PluginEnum; -import org.apache.shenyu.plugin.api.ShenyuPlugin; -import org.apache.shenyu.plugin.base.handler.PluginDataHandler; -import org.junit.jupiter.api.Test; -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.context.annotation.Configuration; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * Test case for {@link HystrixPluginConfiguration}. - */ -@Configuration -@EnableConfigurationProperties -public class HystrixPluginConfigurationTest { - - @Test - public void testHystrixPlugin() { - new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(HystrixPluginConfiguration.class)) - .withBean(HystrixPluginConfigurationTest.class) - .withPropertyValues("debug=true") - .run(context -> { - ShenyuPlugin plugin = context.getBean("hystrixPlugin", ShenyuPlugin.class); - assertNotNull(plugin); - assertThat(plugin.named()).isEqualTo(PluginEnum.HYSTRIX.getName()); - }); - } - - @Test - public void testHystrixPluginDataHandler() { - new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(HystrixPluginConfiguration.class)) - .withBean(HystrixPluginConfigurationTest.class) - .withPropertyValues("debug=true") - .run(context -> { - PluginDataHandler handler = context.getBean("hystrixPluginDataHandler", PluginDataHandler.class); - assertNotNull(handler); - }); - } -} diff --git a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-http/src/test/resources/mock_configs_fetch_response.json b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-http/src/test/resources/mock_configs_fetch_response.json index 3e5a0b78626a..75df1d048f9c 100644 --- a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-http/src/test/resources/mock_configs_fetch_response.json +++ b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-http/src/test/resources/mock_configs_fetch_response.json @@ -64,13 +64,6 @@ "config": null, "role": 0, "enabled": false - }, - { - "id": "9", - "name": "hystrix", - "config": null, - "role": 0, - "enabled": false } ] }, From 84cf73a75968adbc90f32cedb166964c0cf13c1c Mon Sep 17 00:00:00 2001 From: cloudbase-ai <22498243+cloudbase-ai@users.noreply.github.com> Date: Thu, 8 Oct 2026 21:45:20 -0700 Subject: [PATCH 2/2] fix: remove orphan Hystrix namespace relation from H2 seed Signed-off-by: cloudbase-ai <22498243+cloudbase-ai@users.noreply.github.com> --- shenyu-admin/src/main/resources/sql-script/h2/schema.sql | 1 - 1 file changed, 1 deletion(-) 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 796451eb71a8..fe1330404a58 100644 --- a/shenyu-admin/src/main/resources/sql-script/h2/schema.sql +++ b/shenyu-admin/src/main/resources/sql-script/h2/schema.sql @@ -1476,7 +1476,6 @@ INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `con INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822182','649330b6-c2d7-4edc-be8e-8a54df9eb385','45', '{"host":"127.0.0.1","port":5672,"password":"admin","username":"admin","exchangeName":"exchange.logging.plugin","queueName":"queue.logging.plugin","routingKey":"topic.logging","virtualHost":"/","exchangeType":"direct","durable":"true","exclusive":"false","autoDelete":"false"}', 171, 0, '2023-11-06 15:49:56.454', '2023-11-10 10:40:58.447'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822183','649330b6-c2d7-4edc-be8e-8a54df9eb385','5', '{"multiSelectorHandle":"1","multiRuleHandle":"0"}', 200, 1, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822184','649330b6-c2d7-4edc-be8e-8a54df9eb385','6', '{"register":"zookeeper://localhost:2181","multiSelectorHandle":"1","threadpool":"shared","corethreads":0,"threads":2147483647,"queues":0}', 310, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); -INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822186','649330b6-c2d7-4edc-be8e-8a54df9eb385','9', NULL, 130, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822187','649330b6-c2d7-4edc-be8e-8a54df9eb385','50', '{"provider":"OpenAI","baseUrl":"https://api.openai.com/v1/chat/completions","model":"gpt-4o-mini","apiKey":"your_api_key","temperature":"0.5","maxTokens":"1000","stream":"false","prompt":""}', 200, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000'); INSERT IGNORE INTO `namespace_plugin_rel` (`id`,`namespace_id`,`plugin_id`, `config`, `sort`, `enabled`, `date_created`, `date_updated`) VALUES ('1801816010882822188','649330b6-c2d7-4edc-be8e-8a54df9eb385','51', NULL, 171, 0, '2022-05-25 18:02:53.000', '2022-05-25 18:02:53.000');