Skip to content

Commit

Permalink
feat: updating versions (ydb-platform#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov authored Nov 19, 2024
1 parent c49e92b commit 4be1703
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 17 deletions.
20 changes: 13 additions & 7 deletions jdbc/shedlock/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>tech.ydb.jdbc.examples</groupId>
Expand All @@ -12,8 +13,9 @@
<properties>
<maven.compiler.release>17</maven.compiler.release>
<kotlin.version>1.9.22</kotlin.version>
<shed.lock.ydb>0.1.0</shed.lock.ydb>
<shed.lock.ydb>0.3.0</shed.lock.ydb>
<spring.boot.version>3.1.2</spring.boot.version>
<liquibase.ydb.dialect.version>1.1.0</liquibase.ydb.dialect.version>
</properties>
<dependencyManagement>
<dependencies>
Expand All @@ -32,10 +34,6 @@
<artifactId>shedlock-spring</artifactId>
<version>4.27.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
Expand All @@ -48,6 +46,15 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>tech.ydb.dialects</groupId>
<artifactId>liquibase-ydb-dialect</artifactId>
<version>${liquibase.ydb.dialect.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
Expand All @@ -70,7 +77,6 @@
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
10 changes: 5 additions & 5 deletions jdbc/shedlock/src/main/kotlin/tech/ydb/shaded/lock/JobHandler.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package tech.ydb.shaded.lock

import jakarta.annotation.PostConstruct
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component
import tech.ydb.lock.provider.YdbCoordinationServiceLockProvider


/**
* @author Kirill Kurdyukov
Expand All @@ -15,12 +11,16 @@ import tech.ydb.lock.provider.YdbCoordinationServiceLockProvider
class JobHandler {

@Scheduled(cron = "* * * * * *")
@SchedulerLock(name = "YDB Some Job", lockAtLeastFor = "15S", lockAtMostFor = "20S")
@SchedulerLock(name = "YDB Some Job", lockAtMostFor = "10S")
fun awesomeJob() {
println("PID LEADER: " + ProcessHandle.current().pid())

for (i in 0..4) {
println("Processing {$i}")

Thread.sleep(1_000)
}

println("STOP LEADER")
}
}
3 changes: 2 additions & 1 deletion jdbc/shedlock/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
spring.datasource.url=jdbc:ydb:grpc://localhost:2136/local
spring.datasource.driver-class-name=tech.ydb.jdbc.YdbDriver
server.port=81

spring.liquibase.change-log=classpath:changelog.xml
23 changes: 23 additions & 0 deletions jdbc/shedlock/src/main/resources/changelog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

<changeSet author="KurdyukovKirill" id="1">
<createTable tableName="shedlock">
<column name="name" type="VARCHAR(64)">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="lock_until" type="TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="locked_at" type="TIMESTAMP">
<constraints nullable="false"/>
</column>
<column name="locked_by" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>

</databaseChangeLog>
2 changes: 1 addition & 1 deletion jdbc/spring-data-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<properties>
<maven.compiler.release>17</maven.compiler.release>
<kotlin.version>1.9.22</kotlin.version>
<spring.data.jdbc.ydb.version>0.9.1</spring.data.jdbc.ydb.version>
<spring.data.jdbc.ydb.version>1.0.0</spring.data.jdbc.ydb.version>
<spring.boot.version>3.2.1</spring.boot.version>
<flyway.version>10.7.1</flyway.version>
</properties>
Expand Down
2 changes: 1 addition & 1 deletion jdbc/spring-data-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<maven.compiler.release>17</maven.compiler.release>
<kotlin.version>1.9.22</kotlin.version>
<hibernate.ydb.dialect.version>1.0.0</hibernate.ydb.dialect.version>
<hibernate.ydb.dialect.version>1.4.0</hibernate.ydb.dialect.version>
<spring.boot.version>3.2.1</spring.boot.version>
</properties>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions jdbc/spring-liquibase-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<kotlin.version>1.9.22</kotlin.version>
<hibernate.ydb.dialect.version>0.9.2</hibernate.ydb.dialect.version>
<spring.boot.version>3.2.1</spring.boot.version>
<liquibase.ydb.dialect.version>0.9.1</liquibase.ydb.dialect.version>
<liquibase.ydb.dialect.version>1.1.0</liquibase.ydb.dialect.version>
<liquibase.core.version>4.24.0</liquibase.core.version>
</properties>
<dependencies>
Expand Down Expand Up @@ -50,7 +50,7 @@
<dependency>
<groupId>tech.ydb.dialects</groupId>
<artifactId>liquibase-ydb-dialect</artifactId>
<version>0.9.7</version>
<version>${liquibase.ydb.dialect.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
Expand Down

0 comments on commit 4be1703

Please sign in to comment.