{"id":15019336,"url":"https://github.com/onevroad/snowflake-plus","last_synced_at":"2026-01-18T22:07:36.920Z","repository":{"id":45532941,"uuid":"197144761","full_name":"onevroad/snowflake-plus","owner":"onevroad","description":"An id producer of snowflake for spring boot","archived":false,"fork":false,"pushed_at":"2022-11-16T09:26:48.000Z","size":65,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-09T18:15:02.948Z","etag":null,"topics":["java","snowflake","spring-boot","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/onevroad.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}},"created_at":"2019-07-16T07:37:41.000Z","updated_at":"2020-08-28T05:53:26.000Z","dependencies_parsed_at":"2023-01-22T07:00:24.941Z","dependency_job_id":null,"html_url":"https://github.com/onevroad/snowflake-plus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevroad%2Fsnowflake-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevroad%2Fsnowflake-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevroad%2Fsnowflake-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevroad%2Fsnowflake-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onevroad","download_url":"https://codeload.github.com/onevroad/snowflake-plus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135126,"owners_count":20889420,"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","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":["java","snowflake","spring-boot","zookeeper"],"created_at":"2024-09-24T19:53:21.306Z","updated_at":"2026-01-18T22:07:31.886Z","avatar_url":"https://github.com/onevroad.png","language":"Java","readme":"# snowflake-plus [![License](http://img.shields.io/:license-apache-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)\n\nThis is an id generator which use the snowflake algorithm. It's developed by spring-boot. This component works without configuring work-id. The idea of this component came from Meituan tech who designed the snowflake id with zookeeper.\n\n## Work Type\nThere are three types for the component.\n- local: The work-id will be got from your local application's properties file.\n- zookeeper: The work-id will be registered to your zookeeper server.\n- ip: The work-id will be got by the last part of your local server's IP. For example: If your IP is 192.168.1.200, the work-id is 200.\n\n## Quick Start\n- add maven dependency\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.onevroad\u003c/groupId\u003e\n    \u003cartifactId\u003esnowflake-plus-core\u003c/artifactId\u003e\n    \u003cversion\u003e0.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n- add zookeeper's dependency(if your work-type is zookeeper)\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.apache.curator\u003c/groupId\u003e\n    \u003cartifactId\u003ecurator-recipes\u003c/artifactId\u003e\n    \u003cversion\u003e4.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n- add config\n```yaml\nsnowflake:\n  plus:\n    #local，zookeeper，ip. Default is local.\n    work-type: zookeeper\n    #initial start time, default: 2019-08-01 00:00:00 (UTC)\n    start-time: 1564617600000\n    #the number of bit for worker id, default: 8bit\n    worker-id-bits: 8\n    #the number of bit for sequence, default: 12bit\n    sequence-bits: 12\n    #If your work-type is local, you need configure the work-id\n    worker-id: 1\n    #If your work-type is zookeeper, you need configure the following parameters\n    #application's registered name\n    name: snowflake-plus-sample\n    #application's registered port\n    port: 8001\n    #the zookeeper address\n    zk-address: localhost:2181\n```\n\n- get ID\n```java\n@RestController\npublic class SnowflakeIdController {\n\n    @Autowired\n    private SnowflakeService snowflakeService;\n\n    @GetMapping(\"/snowflake/id/get\")\n    public long getId() {\n        return snowflakeService.getId();\n    }\n}\n```\n\n## Feature\n- support other work-type\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonevroad%2Fsnowflake-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonevroad%2Fsnowflake-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonevroad%2Fsnowflake-plus/lists"}