Kotlin/JVM coroutine-based distributed locks.
Like ShedLock
but kotlin-first.
Available from maven central.
First, create lock table (please note that name has to be primary key)
-- PostgreSQL
CREATE TABLE kotlocks(name VARCHAR(64) NOT NULL, lock_until TIMESTAMPTZ NOT NULL,
locked_at TIMESTAMPTZ NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name));
Add dependency
dependencies {
implementation("io.github.darkxanter:kotlock-sql-exposed:$kotlockVersion")
}
dependencies {
implementation("io.github.darkxanter:kotlock-mongo-reactive-streams:$kotlockVersion")
}