snowflake

java edition of Twitter Snowflake: a network service for generating unique ID numbers at high scale with some simple guarantees

License

License

GroupId

GroupId

com.moonsinfo
ArtifactId

ArtifactId

snowflake
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

snowflake
java edition of Twitter Snowflake: a network service for generating unique ID numbers at high scale with some simple guarantees
Source Code Management

Source Code Management

http://github.com/iTriumph/snowflake

Download snowflake

How to add to project

<!-- https://jarcasting.com/artifacts/com.moonsinfo/snowflake/ -->
<dependency>
    <groupId>com.moonsinfo</groupId>
    <artifactId>snowflake</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.moonsinfo/snowflake/
implementation 'com.moonsinfo:snowflake:1.1'
// https://jarcasting.com/artifacts/com.moonsinfo/snowflake/
implementation ("com.moonsinfo:snowflake:1.1")
'com.moonsinfo:snowflake:jar:1.1'
<dependency org="com.moonsinfo" name="snowflake" rev="1.1">
  <artifact name="snowflake" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.moonsinfo', module='snowflake', version='1.1')
)
libraryDependencies += "com.moonsinfo" % "snowflake" % "1.1"
[com.moonsinfo/snowflake "1.1"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.4

Project Modules

There are no modules declared in this project.

Snowflake

java edition of Twitter Snowflake, a network service for generating unique ID numbers at high scale with some simple guarantees.

QuickStart

  • import maven dependency
<dependency>
  <groupId>xyz.downgoon</groupId>
  <artifactId>snowflake</artifactId>
  <version>1.0.0</version>
</dependency>
  • sample code
// datacenter: 2; workerId: 5
Snowflake snowflake = new Snowflake(2, 5);
long id1 = snowflake.nextId();
long id2 = snowflake.nextId();

snowflake.formatId(id1);

for more details, please read SnowflakeDemo2.java.

snowflake tutorial

Versions

Version
1.1
1.0