{"id":25627445,"url":"https://github.com/xincao9/jswitcher","last_synced_at":"2025-08-12T01:23:50.170Z","repository":{"id":57724161,"uuid":"164421483","full_name":"xincao9/jswitcher","owner":"xincao9","description":"Grayscale release, Service degradation","archived":false,"fork":false,"pushed_at":"2023-07-20T19:25:44.000Z","size":631,"stargazers_count":38,"open_issues_count":6,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-02T22:46:36.676Z","etag":null,"topics":["degradation","grayscale","java","switcher"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xincao9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-07T11:16:46.000Z","updated_at":"2022-10-26T14:45:56.000Z","dependencies_parsed_at":"2025-04-14T14:04:04.760Z","dependency_job_id":null,"html_url":"https://github.com/xincao9/jswitcher","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/xincao9/jswitcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xincao9%2Fjswitcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xincao9%2Fjswitcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xincao9%2Fjswitcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xincao9%2Fjswitcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xincao9","download_url":"https://codeload.github.com/xincao9/jswitcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xincao9%2Fjswitcher/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269983778,"owners_count":24507664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["degradation","grayscale","java","switcher"],"created_at":"2025-02-22T17:49:15.111Z","updated_at":"2025-08-12T01:23:50.139Z","avatar_url":"https://github.com/xincao9.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## jswitcher\n\n### Grayscale release, Service degradation [中文文档](https://github.com/xincao9/jswitcher/wiki/%E4%B8%AD%E6%96%87%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)\n\nSupport for grayscale publishing of functions, service downgrade, Automated operation and maintenance\n\n![logo](https://github.com/xincao9/jswitcher/blob/master/logo.png)\n\n\n**_Maven dependency_**\n\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.xincao9\u003c/groupId\u003e\n    \u003cartifactId\u003ejswitcher-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e1.2.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**_controller_**\n\n```\npackage com.github.xincao9.jswitcher.sample.controller;\n\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n@RestController\npublic class RootController {\n\n    @GetMapping(\"/\")\n    public ResponseEntity\u003cString\u003e root () {\n        return ResponseEntity.ok(RandomStringUtils.randomAscii(128));\n    }\n}\n```\n\n**_service application_**\n\n```\npackage com.github.xincao9.jswitcher.sample;\n\nimport com.github.xincao9.jswitcher.api.service.SwitcherService;\nimport com.github.xincao9.jswitcher.api.vo.QoS;\nimport com.github.xincao9.jswitcher.spring.boot.starter.EnableJswitcher;\nimport java.util.concurrent.TimeUnit;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.CommandLineRunner;\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.context.annotation.Bean;\n\n@SpringBootApplication\n@EnableJswitcher\npublic class ServiceApplication {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ServiceApplication.class);\n    @Autowired\n    private SwitcherService switcherService;\n    private static final String KEY = ServiceApplication.class.getCanonicalName();\n\n    public static void main(String[] args) {\n        SpringApplication.run(ServiceApplication.class, args);\n\n    }\n\n    @Bean\n    public CommandLineRunner commandLineRunner() {\n        return (String... args) -\u003e {\n            switcherService.register(KEY, Boolean.TRUE, \"Recording ServiceApplication Logger\", QoS.API);\n            for (int no = 0; no \u003c 100; no++) {\n                if (switcherService.isOpen(KEY)) {\n                    LOGGER.info(RandomStringUtils.randomAscii(128));\n                }\n                TimeUnit.SECONDS.sleep(1);\n            }\n        };\n    }\n\n}\n```\n\n**_application.properties_**\n\n```\njswitcher.application.name=jswitcher-sample\njswitcher.server.port=12306\njswitcher.discovery.zookeeper=localhost:2181\njswitcher.database.name=switcher\njswitcher.database.user=root\njswitcher.database.pass=\njswitcher.database.host=127.0.0.1\njswitcher.database.port=3306\njswitcher.database.opts=useUnicode=true\u0026characterEncoding=UTF-8\u0026zeroDateTimeBehavior=convertToNull\u0026autoReconnect=true\n```\n\n**_Create a table structure_**\n\n```\n## create a table of storage switch information\n\nCREATE TABLE `switcher` (\n  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n  `application` varchar(64) NOT NULL DEFAULT 'default',\n  `key` varchar(64) NOT NULL DEFAULT '',\n  `open` tinyint(1) NOT NULL DEFAULT '0',\n  `describe` varchar(128) DEFAULT NULL,\n  `qos` varchar(24) NOT NULL DEFAULT 'API',\n  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `key` (`key`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n\n```\n\n### jswitcher-ui\n\n**_Install_**\n\n\n1. [download jswitcher-ui](https://search.maven.org/remotecontent?filepath=com/github/xincao9/jswitcher-ui/1.2.2/jswitcher-ui-1.2.2.jar)\n2. java -jar jswitcher-ui-1.2.2.jar --jsonrpc.discovery.zookeeper=localhost:2181\n3. [ui url](http://localhost:8080)\n\n**_Used_**\n\n![keys](https://github.com/xincao9/jswitcher/blob/master/keys.png)\n\n#### Contact\n\n* [https://github.com/xincao9/jswitcher/issues](https://github.com/xincao9/jswitcher/issues)\n* xincao9@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxincao9%2Fjswitcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxincao9%2Fjswitcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxincao9%2Fjswitcher/lists"}