Skip to content
A distributed id generation solution based on zookeeper and Twitter Snowflake
Java
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
spring-boot-starter-id-generator-zookeeper
.gitignore
LICENSE
README.md
pom.xml

README.md

dependency

  • zookeeper 3.4.10

Usage

Install or deploy to private Repository

  • mvn clean install or mvn clean deploy

id generator

  • add dependency to maven
<dependency>
    <groupId>io.github.goudai</groupId>
    <artifactId>spring-boot-starter-id-generator-zookeeper</artifactId>
    <version>1.0.2</version>
</dependency>
  • using on spring boot
# application.yml
goudai:
  id:
    generator:
      zookeeper:
        zookeeper-servers: ${ZOO_SERVERS:localhost:2181}
public class XxxController {

    @Autowired
    IdGenerator idGenerator;

    @GetMapping("idString")
    public String idString() {
        return idGenerator.nextIdAsString();
    }

    @GetMapping("idLong")
    public Long idLong() {
        return idGenerator.nextIdAsLong();
    }
}
You can’t perform that action at this time.