Flake4J ID Generator

A Java implementation of the Flake decentralized, k-ordered ID generation algorithm by Boundary

License

License

GroupId

GroupId

com.github.charithe
ArtifactId

ArtifactId

flake4j
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Flake4J ID Generator
A Java implementation of the Flake decentralized, k-ordered ID generation algorithm by Boundary
Project URL

Project URL

https://github.com/charithe/flake4j
Source Code Management

Source Code Management

https://github.com/charithe/flake4j

Download flake4j

How to add to project

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

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
com.googlecode.junit-toolbox : junit-toolbox jar 2.2

Project Modules

There are no modules declared in this project.

Flake4J - Flake ID generator for Java

This is an implementation of the Flake decentralized, k-ordered ID generation algorithm by Boundary.

There is no server implementation yet. To avoid non-unique IDs, it is the programmer's responsibility to ensure that only one instance of the ID generator is active in a single node (if the MAC address based node identification is used).

This implementation generates 128-bit IDs.

Usage

Artifacts are available on Maven Central.

Gradle:

compile group: 'com.github.charithe', name: 'flake4j', version: '1.0.2'
// Create an ID generator that uses the machine's MAC address for node identification
Flake4J f4j = Flake4J.newInstance();

// Use a custom node identifier instead of the MAC address
NodeIdentifier nodeIdentifier = () -> uniqueNodeIdentifier // long value
Flake4J f4j = Flake4J.newInstance(nodeIdentifier);

Versions

Version
1.0.2
1.0.1
1.0.0