-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jdbc): clean more eagerly some queues based on configuration
- Loading branch information
1 parent
9d717ca
commit 13ac335
Showing
6 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
jdbc-h2/src/main/java/io/kestra/runner/h2/H2JdbcCleanerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.kestra.runner.h2; | ||
|
||
import io.kestra.jdbc.repository.AbstractJdbcRepository; | ||
import io.kestra.jdbc.runner.JdbcCleanerService; | ||
import jakarta.inject.Singleton; | ||
import org.jooq.Condition; | ||
|
||
@Singleton | ||
@H2QueueEnabled | ||
public class H2JdbcCleanerService implements JdbcCleanerService { | ||
@Override | ||
public Condition buildTypeCondition(String type) { | ||
return AbstractJdbcRepository.field("type").eq(type); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
jdbc-mysql/src/main/java/io/kestra/runner/mysql/MysqlJdbcCleanerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.kestra.runner.mysql; | ||
|
||
import io.kestra.jdbc.repository.AbstractJdbcRepository; | ||
import io.kestra.jdbc.runner.JdbcCleanerService; | ||
import jakarta.inject.Singleton; | ||
import org.jooq.Condition; | ||
|
||
@Singleton | ||
@MysqlQueueEnabled | ||
public class MysqlJdbcCleanerService implements JdbcCleanerService { | ||
@Override | ||
public Condition buildTypeCondition(String type) { | ||
return AbstractJdbcRepository.field("type").eq(type); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
jdbc-postgres/src/main/java/io/kestra/runner/postgres/PostgresJdbcCleanerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.kestra.runner.postgres; | ||
|
||
import io.kestra.jdbc.runner.JdbcCleanerService; | ||
import jakarta.inject.Singleton; | ||
import org.jooq.Condition; | ||
import org.jooq.impl.DSL; | ||
|
||
@Singleton | ||
@PostgresQueueEnabled | ||
public class PostgresJdbcCleanerService implements JdbcCleanerService { | ||
@Override | ||
public Condition buildTypeCondition(String type) { | ||
return DSL.condition("type = CAST(? AS queue_type)", type); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
jdbc/src/main/java/io/kestra/jdbc/runner/JdbcCleanerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.kestra.jdbc.runner; | ||
|
||
import org.jooq.Condition; | ||
|
||
/** | ||
* This service is used solely by the {@link JdbcCleaner} to handle database-specific queries. | ||
*/ | ||
public interface JdbcCleanerService { | ||
/** | ||
* Build the condition for the <code>types</code> column of the <code>queues</code> table. | ||
*/ | ||
Condition buildTypeCondition(String type); | ||
} |