{"id":33179191,"url":"https://github.com/imadcn/idworker","last_synced_at":"2026-01-14T03:36:47.063Z","repository":{"id":37451181,"uuid":"107519346","full_name":"imadcn/idworker","owner":"imadcn","description":"idworker 是一个基于zookeeper和snowflake算法的分布式ID生成工具，通过zookeeper自动注册机器（最多1024台），无需手动指定workerId和datacenterId","archived":false,"fork":false,"pushed_at":"2024-02-03T03:01:53.000Z","size":275,"stargazers_count":265,"open_issues_count":9,"forks_count":73,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-08-20T11:41:32.299Z","etag":null,"topics":["algorithm","distributed","idgenerator","java","snowflake","uniqueid","zookeeper"],"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/imadcn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-10-19T08:30:13.000Z","updated_at":"2025-08-13T11:17:42.000Z","dependencies_parsed_at":"2022-08-19T09:11:40.107Z","dependency_job_id":"a7e02cc0-a89c-4c25-8d88-8d3845ad62dc","html_url":"https://github.com/imadcn/idworker","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/imadcn/idworker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imadcn%2Fidworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imadcn%2Fidworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imadcn%2Fidworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imadcn%2Fidworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imadcn","download_url":"https://codeload.github.com/imadcn/idworker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imadcn%2Fidworker/sbom","scorecard":{"id":484711,"data":{"date":"2025-08-11","repo":{"name":"github.com/imadcn/idworker","commit":"b5045d74c48b49a2764efdc58b36b33d6ad63d2f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"24 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-78wr-2p64-hpwj","Warn: Project is vulnerable to: GHSA-9vjp-v76f-g363","Warn: Project is vulnerable to: GHSA-grg4-wf29-r9vv","Warn: Project is vulnerable to: GHSA-389x-839f-4rhx","Warn: Project is vulnerable to: GHSA-xq3w-v528-46rv","Warn: Project is vulnerable to: GHSA-6mjq-h674-j845","Warn: Project is vulnerable to: GHSA-mm9x-g8pc-w292","Warn: Project is vulnerable to: GHSA-2qrg-x229-3v8q","Warn: Project is vulnerable to: GHSA-65fg-84f6-3jq3","Warn: Project is vulnerable to: GHSA-f7vh-qwp3-x37m","Warn: Project is vulnerable to: GHSA-fp5r-v3w9-4333","Warn: Project is vulnerable to: GHSA-w9p3-5cr8-m3jj","Warn: Project is vulnerable to: GHSA-7286-pgfv-vxvh","Warn: Project is vulnerable to: GHSA-36p3-wjmg-h94x","Warn: Project is vulnerable to: GHSA-hh26-6xwr-ggv7","Warn: Project is vulnerable to: GHSA-4gc7-5j7h-4qph","Warn: Project is vulnerable to: GHSA-4wp7-92pw-q264","Warn: Project is vulnerable to: GHSA-g5mm-vmx4-3rg7","Warn: Project is vulnerable to: GHSA-558x-2xjg-6232","Warn: Project is vulnerable to: GHSA-564r-hj7v-mcr5","Warn: Project is vulnerable to: GHSA-9cmq-m9j5-mvww","Warn: Project is vulnerable to: GHSA-wxqc-pxw9-g2p8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T17:29:53.682Z","repository_id":37451181,"created_at":"2025-08-19T17:29:53.682Z","updated_at":"2025-08-19T17:29:53.682Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["algorithm","distributed","idgenerator","java","snowflake","uniqueid","zookeeper"],"created_at":"2025-11-16T03:00:36.826Z","updated_at":"2026-01-14T03:36:47.055Z","avatar_url":"https://github.com/imadcn.png","language":"Java","readme":"## idworker - 基于zookeeper，snowflake的分布式统一ID生成工具\n\n[![Build Status](https://app.travis-ci.com/imadcn/idworker.svg?branch=master)](https://app.travis-ci.com/imadcn/idworker)\n[![Coverage Status](https://coveralls.io/repos/imadcn/idworker/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/imadcn/idworker?branch=master)\n[![Maven Central](https://img.shields.io/maven-central/v/com.imadcn.framework/idworker.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.imadcn.framework/idworker)\n[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\n\n### 是什么\nidworker 是一个基于zookeeper和snowflake算法的分布式统一ID生成工具，通过zookeeper自动注册机器（最多1024台），无需手动指定workerId和dataCenterId\n\n### 怎么用\n#### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.imadcn.framework\u003c/groupId\u003e\n  \u003cartifactId\u003eidworker\u003c/artifactId\u003e\n  \u003cversion\u003e${latest.version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### XML\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cbeans xmlns=\"http://www.springframework.org/schema/beans\"\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xmlns:idworker=\"http://code.imadcn.com/schema/idworker\"\n    xsi:schemaLocation=\"\n        http://www.springframework.org/schema/beans \n        http://www.springframework.org/schema/beans/spring-beans.xsd\n        http://code.imadcn.com/schema/idworker\n        http://code.imadcn.com/schema/idworker/idworker.xsd\"\u003e\n        \n    \u003cidworker:registry id=\"zkRegistryCenter\" server-lists=\"host1:port1,host2:port2\"/\u003e\n    \u003cidworker:generator id=\"snowflakeGenerator\" registry-center-ref=\"zkRegistryCenter\" /\u003e\n\u003c/beans\u003e\n\n```\n\n#### API\n\n```java\n@Autowired\npublic IdGenerator generator;\n\npublic void id() {\n    long id = generator.nextId(); // Long型ID(64进制UUID不支持)，随着时间推移，ID长度为7-19位\n    long[] ids = generator.nextId(100_000); // 批量Long型ID(64进制UUID不支持)，最多10w个\n\t\n    String strId = generator.nextStringId(); // 字符串格式ID\n    String fixedId = generator.nextFixedStringId(); // 固定19位长度字符串Id\n}\n\n```\n\n### 配置参考\n#### \u003cidworker:registry /\u003e 注册中心配置，如zookeeper（64进制UUID策略可不配置注册中心）\n\n|属性|类型|必填|缺省值|兼容版本|描述|\n|:------|:------|:------|:------|:------|:------|\n|id|String|是| |1.0.0+|Spring容器中的ID|\n|server-lists|String|是| |1.0.0+|连接Zookeeper服务器的列表\u003cbr/\u003e包括IP地址和端口号\u003cbr/\u003e多个地址用逗号分隔\u003cbr/\u003e如: host1:2181,host2:2181|\n|namespace|String|否|idworker|1.0.0+|Zookeeper的命名空间|\n|base-sleep-time-milliseconds|int|否|1000|1.0.0+|等待重试的间隔时间的初始值\u003cbr/\u003e单位：毫秒|\n|max-sleep-time-milliseconds|int|否|3000|1.0.0+|等待重试的间隔时间的最大值\u003cbr/\u003e单位：毫秒|\n|max-retries|int|否|3|1.0.0+|最大重试次数|\n|session-timeout-milliseconds|int|否|60000|1.0.0+|会话超时时间\u003cbr/\u003e单位：毫秒|\n|connection-timeout-milliseconds|int|否|15000|1.0.0+|连接超时时间\u003cbr/\u003e单位：毫秒|\n|digest|String|否| |1.0.0+|连接Zookeeper的权限令牌\u003cbr/\u003e缺省为不需要权限验证|\n\n#### \u003cidworker:generator /\u003e ID生成策略配置\n\n|属性|类型|必填|缺省值|兼容版本|描述|\n|:------|:------|:------|:------|:------|:------|\n|id|String|是| |1.0.0+|Spring容器中的ID|\n|strategy|String|是|snowflake|1.2.0+|ID生成[snowflake, compress_uuid]，当策略为64进制uuid时，registry-center-ref可不用配置|\n|registry-center-ref|String|否| |1.0.0+|注册中心SpringBeanRef，当生成策略为snowflake时，必填|\n|group|String|否|default|1.0.0+|分组名，可以为不同业务分配分组，独立注册|\n|registry-file|String|否|./tmp/idworker/GROUPNAME.cache|1.3.0+|注册信息缓存文件地址，默认在程序所在目录 ./tmp/idworker/GROUPNAME.cache|\n|durable|boolean|否|false|1.4.0+|节点注册信息是否持久化存储(持久化存储会依赖于本地缓存文件，容器环境建议使用非持久化)|\n|serialize|String|否|fastjson|1.6.0+|序列化方式，可选值：fastjson, jackson|\n|cacheable|boolean|否|true|1.6.0+|是否使用本地缓存（如果不依赖本地缓存，那么每次都会申请一个新的workerId）。需要注意的是，如果不依赖本地缓存，且开启了节点持久化存储。会在一定次数以后耗尽可用节点信息。|\n\n#### \u003cgenerator:snowflake /\u003e 生成策略 : snowflake模式\n\n|属性|类型|必填|缺省值|兼容版本|描述|\n|:------|:------|:------|:------|:------|:------|\n|id|String|是| |1.2.0+|Spring容器中的ID|\n|registry-center-ref|String|是| |1.2.0+|注册中心SpringBeanRef|\n|group|String|否|default|1.2.0+|分组名，可以为不同业务分配分组，独立注册|\n|registry-file|String|否|./tmp/idworker/GROUPNAME.cache|1.3.0+|注册信息缓存文件地址，默认在程序所在目录 ./tmp/idworker/GROUPNAME.cache|\n|durable|String|否|false|1.4.0+|节点注册信息是否持久化存储(持久化存储会依赖于本地缓存文件，容器环境建议使用非持久化)|\n|serialize|String|否|fastjson|1.6.0+|序列化方式，可选值：fastjson, jackson|\n|cacheable|boolean|否|true|1.6.0+|是否使用本地缓存（如果不依赖本地缓存，那么每次都会申请一个新的workerId）。需要注意的是，如果不依赖本地缓存，且开启了节点持久化存储。会在一定次数以后耗尽可用节点信息。|\n\n#### \u003cgenerator:compress-uuid /\u003e 生成策略 : 64进制UUID模式\n\n|属性|类型|必填|缺省值|兼容版本|描述|\n|:------|:------|:------|:------|:------|:------|\n|id|String|是| |1.2.0+|Spring容器中的ID|\n","funding_links":[],"categories":["分布式开发"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimadcn%2Fidworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimadcn%2Fidworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimadcn%2Fidworker/lists"}