https://github.com/brainpoint/febs-identify-spring-cloud-starter
spring-cloud-starter of febs-identify
https://github.com/brainpoint/febs-identify-spring-cloud-starter
distributed-id distributed-id-generator distributed-identity febs spring-boot-starter spring-cloud-starter
Last synced: 3 months ago
JSON representation
spring-cloud-starter of febs-identify
- Host: GitHub
- URL: https://github.com/brainpoint/febs-identify-spring-cloud-starter
- Owner: brainpoint
- License: mit
- Created: 2020-07-02T15:15:28.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T02:58:26.000Z (over 4 years ago)
- Last Synced: 2024-12-30T07:11:50.446Z (5 months ago)
- Topics: distributed-id, distributed-id-generator, distributed-identity, febs, spring-boot-starter, spring-cloud-starter
- Language: Java
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# febs-identify-spring-cloud-starter
[](https://maven-badges.herokuapp.com/maven-central/cn.brainpoint/febs-identify-spring-cloud-starter/)
[](https://opensource.org/licenses/MIT)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.
```html
cn.brainpoint
febs-identify-spring-cloud-starter
0.0.5```
## config
bootstrap.properties
```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:
```java
import cn.brainpoint.febs.identify.Identify;// create next id.
Identify.nextId();// validate id.
assert Identify.isValid(id);
```Following to make a new machine id:
```java
import cn.brainpoint.febs.identify.Identify;// Generate a new machine id.
Identify.generateNewMachineId()
```