febs-identify-spring-cloud-starter

SpringCloudStarter of febs-identify.

License

License

Categories

Categories

IDE Development Tools
GroupId

GroupId

cn.brainpoint
ArtifactId

ArtifactId

febs-identify-spring-cloud-starter
Last Version

Last Version

0.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

febs-identify-spring-cloud-starter
SpringCloudStarter of febs-identify.
Project URL

Project URL

https://github.com/brainpoint/febs-identify-spring-cloud-starter.git
Source Code Management

Source Code Management

https://github.com/brainpoint/febs-identify-spring-cloud-starter.git

Download febs-identify-spring-cloud-starter

How to add to project

<!-- https://jarcasting.com/artifacts/cn.brainpoint/febs-identify-spring-cloud-starter/ -->
<dependency>
    <groupId>cn.brainpoint</groupId>
    <artifactId>febs-identify-spring-cloud-starter</artifactId>
    <version>0.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/cn.brainpoint/febs-identify-spring-cloud-starter/
implementation 'cn.brainpoint:febs-identify-spring-cloud-starter:0.0.5'
// https://jarcasting.com/artifacts/cn.brainpoint/febs-identify-spring-cloud-starter/
implementation ("cn.brainpoint:febs-identify-spring-cloud-starter:0.0.5")
'cn.brainpoint:febs-identify-spring-cloud-starter:jar:0.0.5'
<dependency org="cn.brainpoint" name="febs-identify-spring-cloud-starter" rev="0.0.5">
  <artifact name="febs-identify-spring-cloud-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.brainpoint', module='febs-identify-spring-cloud-starter', version='0.0.5')
)
libraryDependencies += "cn.brainpoint" % "febs-identify-spring-cloud-starter" % "0.0.5"
[cn.brainpoint/febs-identify-spring-cloud-starter "0.0.5"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-configuration-processor jar 2.2.7.RELEASE
org.springframework.cloud : spring-cloud-starter jar 2.2.3.RELEASE
org.springframework.cloud : spring-cloud-bus jar 2.2.0.RELEASE
cn.brainpoint : febs-identify jar 0.0.5

provided (2)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.12
org.slf4j : slf4j-api jar 1.7.30

Project Modules

There are no modules declared in this project.

febs-identify-spring-cloud-starter

Maven Central License

Distributed Unique Identify.

  • like objectId, a process can generator id 2^24-1 per second.
  • Container 20 chars in id
  • Use database to assign unique machineId.

How to use

maven config.

<dependency>
    <groupId>cn.brainpoint</groupId>
    <artifactId>febs-identify-spring-cloud-starter</artifactId>
    <version>0.0.5</version>
</dependency>

config

bootstrap.properties

febs.identify.db.type = mysql
febs.identify.db.url = localhost:3306/xx
febs.identify.db.username = username
febs.identify.db.password = password
febs.identify.db.tablename = machine_id # db table use to store meachine id.
febs.identify.db.retryCount = 1
febs.identify.db.connectTimeout = 5000  # connectTimeout connect timeout in milliseconds.

febs.identify.createMachineIdSelf = false # create a machine id in this instance.

usage:

If configured have createMachineIdSelf=true, then can do the following:

import cn.brainpoint.febs.identify.Identify;

// create next id.
Identify.nextId();

// validate id.
assert Identify.isValid(id);

Following to make a new machine id:

import cn.brainpoint.febs.identify.Identify;

// Generate a new machine id.
Identify.generateNewMachineId()

Versions

Version
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1