Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ on:
jobs:
test:
uses: ./.github/workflows/test.yml
test-crdb:
Comment thread
devhawk marked this conversation as resolved.
uses: ./.github/workflows/test_crdb.yml
test-demo-apps:
uses: ./.github/workflows/test_demo_apps.yml
2 changes: 2 additions & 0 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
test:
uses: ./.github/workflows/test.yml
test-crdb:
uses: ./.github/workflows/test_crdb.yml
publish:
needs: test
uses: ./.github/workflows/publish.yml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:
run: ./gradlew clean build
env:
PGPASSWORD: dbos
JDKVERSION: ${{ matrix.jdk-version }}
SCALE_TEST: "true"

- name: Test Summary
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/test_crdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test (CockroachDB)

on:
workflow_call:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # fetch-depth 0 needed for version calculation

- name: Set up JDK temurin 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5

- name: Run tests
run: ./gradlew clean build
env:
PGPASSWORD: dbos
DBOS_TEST_USE_COCKROACH_DB: 'true'

- name: Test Summary
uses: test-summary/action@v2
with:
paths: "transact/build/test-results/test/TEST-*.xml"
show: "fail, skip"
if: always()

- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: test-results-crdb-temurin-25
path: |
Comment thread
devhawk marked this conversation as resolved.
transact/build/reports/tests/
transact/build/test-results/
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" }
junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" }
junit-pioneer = { module = "org.junit-pioneer:junit-pioneer", version.ref = "junit-pioneer" }
junit-platform-engine = { module = "org.junit.platform:junit-platform-engine" }
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher" }
kryo = { module = "com.esotericsoftware:kryo", version.ref = "kryo" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
Expand All @@ -70,6 +71,7 @@ spring-boot4-dependencies = { module = "org.springframework.boot:spring-boot-dep
spring-boot4-test = { module = "org.springframework.boot:spring-boot-test", version.ref = "spring-boot4" }
sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite-jdbc" }
system-stubs-jupiter = { module = "uk.org.webcompere:system-stubs-jupiter", version.ref = "system-stubs" }
testcontainers-cockroachdb = { module = "org.testcontainers:testcontainers-cockroachdb", version.ref = "testcontainers" }
testcontainers-postgresql = { module = "org.testcontainers:testcontainers-postgresql", version.ref = "testcontainers" }

[bundles]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public Integer call() throws Exception {
out.format(" System Database: %s\n", dbOptions.url());
out.format(" System Database User: %s\n", dbOptions.user());

// TODO: add option for useListenNotify
MigrationManager.runMigrations(
dbOptions.url(), dbOptions.user(), dbOptions.password(), dbOptions.schema());
dbOptions.url(), dbOptions.user(), dbOptions.password(), dbOptions.schema(), true);
grantDBOSSchemaPermissions(out, dbOptions.schema());
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private DBOSConfig buildConfig(DBOSProperties props, String springAppName) {
config = config.withAdminServer(props.getAdminServer().isEnabled());
config = config.withAdminServerPort(props.getAdminServer().getPort());
config = config.withMigrate(props.getDatasource().isMigrate());
config = config.withUseListenNotify(props.getDatasource().isUseListenNotify());
config = config.withEnablePatching(props.isEnablePatching());

List<String> listenQueues = props.getListenQueues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ public static class Datasource {
/** Whether to run database migrations on startup. Defaults to {@code true}. */
private boolean migrate = true;

/**
* Whether to use PostgreSQL LISTEN/NOTIFY for event delivery. Defaults to {@code true}. Set to
* {@code false} to use polling instead
*/
private boolean useListenNotify = true;

public String getUrl() {
return url;
}
Expand Down Expand Up @@ -172,6 +178,14 @@ public boolean isMigrate() {
public void setMigrate(boolean migrate) {
this.migrate = migrate;
}

public boolean isUseListenNotify() {
return useListenNotify;
}

public void setUseListenNotify(boolean useListenNotify) {
this.useListenNotify = useListenNotify;
}
}

public Application getApplication() {
Expand Down
2 changes: 2 additions & 0 deletions transact/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.pioneer)
testImplementation(libs.system.stubs.jupiter)
testImplementation(libs.junit.platform.engine)
testRuntimeOnly(libs.junit.platform.launcher)

testImplementation(libs.java.websocket)
Expand All @@ -48,6 +49,7 @@ dependencies {
testImplementation(libs.rest.assured)
testImplementation(libs.kryo)
testImplementation(libs.maven.artifact)
testImplementation(libs.testcontainers.cockroachdb)
testImplementation(libs.testcontainers.postgresql)
}

Expand Down
16 changes: 13 additions & 3 deletions transact/src/main/java/dev/dbos/transact/DBOSClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public T getResult() throws E {
* @param password System database credential / password
*/
public DBOSClient(@NonNull String url, @NonNull String user, @NonNull String password) {
this(url, user, password, null, null);
this(url, user, password, null, null, true);
}

/**
Expand All @@ -95,7 +95,7 @@ public DBOSClient(
@NonNull String user,
@NonNull String password,
@Nullable String schema) {
this(url, user, password, schema, null);
this(url, user, password, schema, null, true);
}

/**
Expand All @@ -113,8 +113,18 @@ public DBOSClient(
@NonNull String password,
@Nullable String schema,
@Nullable DBOSSerializer serializer) {
this(url, user, password, schema, serializer, true);
}

public DBOSClient(
@NonNull String url,
@NonNull String user,
@NonNull String password,
@Nullable String schema,
@Nullable DBOSSerializer serializer,
boolean useListenNotify) {
this.serializer = serializer;
systemDatabase = new SystemDatabase(url, user, password, schema, serializer);
systemDatabase = new SystemDatabase(url, user, password, schema, serializer, useListenNotify);
}

/**
Expand Down
Loading