From 1f3aeedd9fba59b7837b333be0a6ce0063bb3f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Kobyli=C5=84ski?= Date: Fri, 5 Jun 2026 14:14:04 +0200 Subject: [PATCH 1/2] fix(core): supply transactionRunner in two OutboxPurger tests Repairs a broken main from a semantic merge collision between #55 and #54. #55 added two OutboxPurger tests while transactionRunner was still nullable; #54 (merged separately) made transactionRunner required but never saw those two tests. Each PR was green against its own base, but the merged result fails :okapi-core:compileTestKotlin ("No value passed for parameter 'transactionRunner'"). Adds the missing transactionRunner = noOpTransactionRunner() to both call sites. --- .../test/kotlin/com/softwaremill/okapi/core/OutboxPurgerTest.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/okapi-core/src/test/kotlin/com/softwaremill/okapi/core/OutboxPurgerTest.kt b/okapi-core/src/test/kotlin/com/softwaremill/okapi/core/OutboxPurgerTest.kt index 45057d1..f28b7b2 100644 --- a/okapi-core/src/test/kotlin/com/softwaremill/okapi/core/OutboxPurgerTest.kt +++ b/okapi-core/src/test/kotlin/com/softwaremill/okapi/core/OutboxPurgerTest.kt @@ -153,6 +153,7 @@ class OutboxPurgerTest : FunSpec({ try { val purger = OutboxPurger( outboxStore = store, + transactionRunner = noOpTransactionRunner(), config = OutboxPurgerConfig(interval = ofMillis(50), batchSize = 100), clock = fixedClock, ) @@ -192,6 +193,7 @@ class OutboxPurgerTest : FunSpec({ try { val purger = OutboxPurger( outboxStore = store, + transactionRunner = noOpTransactionRunner(), config = OutboxPurgerConfig(interval = ofMillis(50), batchSize = 100), clock = fixedClock, ) From 12c7438e64f648c0044e02f3319c90a6cf6e93c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Kobyli=C5=84ski?= Date: Fri, 5 Jun 2026 14:14:04 +0200 Subject: [PATCH 2/2] chore(store): remove dead clock constructor param from Postgres/Mysql stores clock became unused after #58 (the lag-gauge fix replaced the per-status clock.instant() pre-seed with an empty map); the stores derive no timestamps from a clock. Removes the parameter and its java.time.Clock import from both adapters, drops the now-pointless clock pass-through from the two okapi-spring-boot store bean factories, and updates all store construction sites (benchmarks + integration tests) to the single-arg form. clock that still feeds OutboxPublisher / OutboxEntryProcessor / OutboxProcessor / MicrometerOutboxMetrics is left untouched. Breaking change (direct constructor users who passed an explicit clock) documented in CHANGELOG. --- CHANGELOG.md | 6 ++++++ .../okapi/benchmarks/HttpThroughputBenchmark.kt | 2 +- .../okapi/benchmarks/KafkaThroughputBenchmark.kt | 2 +- .../okapi/test/concurrency/MysqlConcurrentClaimTest.kt | 5 +---- .../okapi/test/concurrency/PostgresConcurrentClaimTest.kt | 5 +---- .../com/softwaremill/okapi/test/e2e/HttpEndToEndTest.kt | 2 +- .../com/softwaremill/okapi/test/e2e/KafkaEndToEndTest.kt | 2 +- .../softwaremill/okapi/test/e2e/MysqlHttpEndToEndTest.kt | 2 +- .../okapi/test/e2e/ObservabilityEndToEndTest.kt | 8 ++++---- .../softwaremill/okapi/test/store/MysqlOutboxStoreTest.kt | 4 ---- .../okapi/test/store/PostgresOutboxStoreTest.kt | 4 ---- .../okapi/test/transaction/ConnectionLeakProofTest.kt | 2 +- .../test/transaction/ExposedSpringBridgeEndToEndTest.kt | 3 +-- .../test/transaction/JpaTransactionManagerFailFastTest.kt | 2 +- .../JpaTransactionManagerMatchedDataSourceTest.kt | 2 +- .../test/transaction/MultiDataSourceTransactionTest.kt | 2 +- .../test/transaction/MysqlConnectionLeakProofTest.kt | 2 +- .../transaction/WrongPtmMultiDataSourceFailFastTest.kt | 6 +++--- .../com/softwaremill/okapi/mysql/MysqlOutboxStore.kt | 2 -- .../softwaremill/okapi/postgres/PostgresOutboxStore.kt | 2 -- .../okapi/springboot/OutboxAutoConfiguration.kt | 6 ++---- .../okapi/springboot/OutboxMysqlEndToEndTest.kt | 2 +- 22 files changed, 29 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 452f812..5469230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ Until `1.0.0`, breaking changes may appear in any release and are flagged with * ### Changed (BREAKING) +- **`PostgresOutboxStore` / `MysqlOutboxStore` no longer take a `clock` constructor + parameter.** It became unused after the lag-gauge fix ([#58](https://github.com/softwaremill/okapi/pull/58)) — + the stores derive no timestamps from a clock. Code that passed an explicit clock + (`PostgresOutboxStore(connectionProvider, clock)`) must drop the second argument; + the usual `PostgresOutboxStore(connectionProvider)` form is unchanged. Spring Boot + users are unaffected. - **Outbox domain table renamed `outbox` → `okapi_outbox`.** Indexes follow the rename (`idx_outbox_*` → `idx_okapi_outbox_*`). Host applications with a pre-existing `outbox` table are no longer affected — okapi creates its own table under the `okapi_` prefix. diff --git a/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/HttpThroughputBenchmark.kt b/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/HttpThroughputBenchmark.kt index 6cb6810..05dd7a5 100644 --- a/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/HttpThroughputBenchmark.kt +++ b/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/HttpThroughputBenchmark.kt @@ -79,7 +79,7 @@ open class HttpThroughputBenchmark { ) val clock = Clock.systemUTC() - val store = PostgresOutboxStore(postgres.jdbc, clock) + val store = PostgresOutboxStore(postgres.jdbc) publisher = OutboxPublisher(store, clock) val urlResolver = ServiceUrlResolver { "http://localhost:${wiremock.port()}" } val deliverer = HttpMessageDeliverer(urlResolver) diff --git a/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/KafkaThroughputBenchmark.kt b/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/KafkaThroughputBenchmark.kt index ac546db..c5c9950 100644 --- a/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/KafkaThroughputBenchmark.kt +++ b/okapi-benchmarks/src/jmh/kotlin/com/softwaremill/okapi/benchmarks/KafkaThroughputBenchmark.kt @@ -58,7 +58,7 @@ open class KafkaThroughputBenchmark { topic = "bench-${UUID.randomUUID()}" val clock = Clock.systemUTC() - val store = PostgresOutboxStore(postgres.jdbc, clock) + val store = PostgresOutboxStore(postgres.jdbc) publisher = OutboxPublisher(store, clock) val deliverer = KafkaMessageDeliverer(producer) val entryProcessor = OutboxEntryProcessor(deliverer, RetryPolicy(maxRetries = 0), clock) diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/MysqlConcurrentClaimTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/MysqlConcurrentClaimTest.kt index f2cb4a5..3d3de49 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/MysqlConcurrentClaimTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/MysqlConcurrentClaimTest.kt @@ -3,9 +3,6 @@ package com.softwaremill.okapi.test.concurrency import com.softwaremill.okapi.mysql.MysqlOutboxStore import com.softwaremill.okapi.test.support.MysqlTestSupport import io.kotest.core.spec.style.FunSpec -import java.time.Clock -import java.time.Instant -import java.time.ZoneOffset class MysqlConcurrentClaimTest : FunSpec({ val db = MysqlTestSupport() @@ -13,7 +10,7 @@ class MysqlConcurrentClaimTest : FunSpec({ concurrentClaimTests( dbName = "mysql", jdbcProvider = { db.jdbc }, - storeFactory = { MysqlOutboxStore(db.jdbc, Clock.fixed(Instant.parse("2024-01-01T00:00:00Z"), ZoneOffset.UTC)) }, + storeFactory = { MysqlOutboxStore(db.jdbc) }, startDb = { db.start() }, stopDb = { db.stop() }, truncate = { db.truncate() }, diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/PostgresConcurrentClaimTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/PostgresConcurrentClaimTest.kt index 19710bc..0dc84f5 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/PostgresConcurrentClaimTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/concurrency/PostgresConcurrentClaimTest.kt @@ -3,9 +3,6 @@ package com.softwaremill.okapi.test.concurrency import com.softwaremill.okapi.postgres.PostgresOutboxStore import com.softwaremill.okapi.test.support.PostgresTestSupport import io.kotest.core.spec.style.FunSpec -import java.time.Clock -import java.time.Instant -import java.time.ZoneOffset class PostgresConcurrentClaimTest : FunSpec({ val db = PostgresTestSupport() @@ -13,7 +10,7 @@ class PostgresConcurrentClaimTest : FunSpec({ concurrentClaimTests( dbName = "postgres", jdbcProvider = { db.jdbc }, - storeFactory = { PostgresOutboxStore(db.jdbc, Clock.fixed(Instant.parse("2024-01-01T00:00:00Z"), ZoneOffset.UTC)) }, + storeFactory = { PostgresOutboxStore(db.jdbc) }, startDb = { db.start() }, stopDb = { db.stop() }, truncate = { db.truncate() }, diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/HttpEndToEndTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/HttpEndToEndTest.kt index 81633e5..7505a22 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/HttpEndToEndTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/HttpEndToEndTest.kt @@ -44,7 +44,7 @@ class HttpEndToEndTest : FunSpec({ fun buildPipeline(maxRetries: Int = 3): Triple { val clock = Clock.systemUTC() - val store = PostgresOutboxStore(db.jdbc, clock) + val store = PostgresOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val urlResolver = ServiceUrlResolver { "http://localhost:${wiremock.port()}" } val entryProcessor = OutboxEntryProcessor( diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/KafkaEndToEndTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/KafkaEndToEndTest.kt index 3fa9c9f..6c1e377 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/KafkaEndToEndTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/KafkaEndToEndTest.kt @@ -42,7 +42,7 @@ class KafkaEndToEndTest : FunSpec({ test("full pipeline: publish to outbox -> processNext -> message on Kafka topic") { val clock = Clock.systemUTC() - val store = PostgresOutboxStore(db.jdbc, clock) + val store = PostgresOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val deliverer = KafkaMessageDeliverer(producer!!) val entryProcessor = OutboxEntryProcessor(deliverer, RetryPolicy(maxRetries = 3), clock) diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/MysqlHttpEndToEndTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/MysqlHttpEndToEndTest.kt index 41c5056..5ae7880 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/MysqlHttpEndToEndTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/MysqlHttpEndToEndTest.kt @@ -44,7 +44,7 @@ class MysqlHttpEndToEndTest : FunSpec({ fun buildPipeline(): Triple { val clock = Clock.systemUTC() - val store = MysqlOutboxStore(db.jdbc, clock) + val store = MysqlOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val urlResolver = ServiceUrlResolver { "http://localhost:${wiremock.port()}" } val entryProcessor = OutboxEntryProcessor( diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/ObservabilityEndToEndTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/ObservabilityEndToEndTest.kt index 48ee38f..8d14bf5 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/ObservabilityEndToEndTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/e2e/ObservabilityEndToEndTest.kt @@ -56,7 +56,7 @@ class ObservabilityEndToEndTest : FunSpec({ test("full pipeline: publish, deliver, verify Micrometer counters and gauges") { val registry = SimpleMeterRegistry() - val store = PostgresOutboxStore(db.jdbc, clock) + val store = PostgresOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val listener = MicrometerOutboxListener(registry) val metrics = MicrometerOutboxMetrics(store, registry, transactionRunner = jdbcTransactionRunner, clock = clock) @@ -109,7 +109,7 @@ class ObservabilityEndToEndTest : FunSpec({ test("permanent failure: HTTP 400 → Failed counter incremented, gauge reflects FAILED") { val registry = SimpleMeterRegistry() - val store = PostgresOutboxStore(db.jdbc, clock) + val store = PostgresOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val listener = MicrometerOutboxListener(registry) val metrics = MicrometerOutboxMetrics(store, registry, transactionRunner = jdbcTransactionRunner, clock = clock) @@ -135,7 +135,7 @@ class ObservabilityEndToEndTest : FunSpec({ test("batch duration timer records realistic delivery time") { val registry = SimpleMeterRegistry() - val store = PostgresOutboxStore(db.jdbc, clock) + val store = PostgresOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val listener = MicrometerOutboxListener(registry) @@ -158,7 +158,7 @@ class ObservabilityEndToEndTest : FunSpec({ test("lag gauge reflects real time difference for pending entries") { val registry = SimpleMeterRegistry() - val store = PostgresOutboxStore(db.jdbc, clock) + val store = PostgresOutboxStore(db.jdbc) val publisher = OutboxPublisher(store, clock) val metrics = MicrometerOutboxMetrics(store, registry, transactionRunner = jdbcTransactionRunner, clock = clock) diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/MysqlOutboxStoreTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/MysqlOutboxStoreTest.kt index 8576fd4..0ecfce0 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/MysqlOutboxStoreTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/MysqlOutboxStoreTest.kt @@ -3,9 +3,6 @@ package com.softwaremill.okapi.test.store import com.softwaremill.okapi.mysql.MysqlOutboxStore import com.softwaremill.okapi.test.support.MysqlTestSupport import io.kotest.core.spec.style.FunSpec -import java.time.Clock -import java.time.Instant -import java.time.ZoneOffset class MysqlOutboxStoreTest : FunSpec({ val db = MysqlTestSupport() @@ -15,7 +12,6 @@ class MysqlOutboxStoreTest : FunSpec({ storeFactory = { MysqlOutboxStore( connectionProvider = db.jdbc, - clock = Clock.fixed(Instant.parse("2024-01-01T00:00:00Z"), ZoneOffset.UTC), ) }, jdbcProvider = { db.jdbc }, diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/PostgresOutboxStoreTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/PostgresOutboxStoreTest.kt index 0f2d051..45a8c68 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/PostgresOutboxStoreTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/store/PostgresOutboxStoreTest.kt @@ -3,9 +3,6 @@ package com.softwaremill.okapi.test.store import com.softwaremill.okapi.postgres.PostgresOutboxStore import com.softwaremill.okapi.test.support.PostgresTestSupport import io.kotest.core.spec.style.FunSpec -import java.time.Clock -import java.time.Instant -import java.time.ZoneOffset class PostgresOutboxStoreTest : FunSpec({ val db = PostgresTestSupport() @@ -15,7 +12,6 @@ class PostgresOutboxStoreTest : FunSpec({ storeFactory = { PostgresOutboxStore( connectionProvider = db.jdbc, - clock = Clock.fixed(Instant.parse("2024-01-01T00:00:00Z"), ZoneOffset.UTC), ) }, jdbcProvider = { db.jdbc }, diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ConnectionLeakProofTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ConnectionLeakProofTest.kt index 78b7877..6406586 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ConnectionLeakProofTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ConnectionLeakProofTest.kt @@ -42,7 +42,7 @@ class ConnectionLeakProofTest : FunSpec({ } runLiquibase(container) counter = CountingDataSource(raw) - store = PostgresOutboxStore(SpringConnectionProvider(counter), clock) + store = PostgresOutboxStore(SpringConnectionProvider(counter)) } afterSpec { diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ExposedSpringBridgeEndToEndTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ExposedSpringBridgeEndToEndTest.kt index c022721..31a10d1 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ExposedSpringBridgeEndToEndTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/ExposedSpringBridgeEndToEndTest.kt @@ -23,7 +23,6 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner import org.springframework.transaction.PlatformTransactionManager import org.springframework.transaction.support.TransactionTemplate import org.testcontainers.containers.PostgreSQLContainer -import java.time.Clock import java.util.concurrent.CompletableFuture import java.util.concurrent.CyclicBarrier import java.util.concurrent.Executors @@ -69,7 +68,7 @@ class ExposedSpringBridgeEndToEndTest : FunSpec({ .withBean(MessageDeliverer::class.java, { recorder }) .withBean(PlatformTransactionManager::class.java, { SpringTransactionManager(counter) }) .withBean(PostgresOutboxStore::class.java, { - PostgresOutboxStore(SpringConnectionProvider(counter), Clock.systemUTC()) + PostgresOutboxStore(SpringConnectionProvider(counter)) }) test("publish inside Spring TX driven by Exposed-bridge PTM uses a single physical connection") { diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerFailFastTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerFailFastTest.kt index d618ce5..3af3608 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerFailFastTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerFailFastTest.kt @@ -65,7 +65,7 @@ class JpaTransactionManagerFailFastTest : FunSpec({ .withBean("jpaTmA", PlatformTransactionManager::class.java, { JpaTransactionManager(emf) }) .withBean(MessageDeliverer::class.java, { JpaTestStubDeliverer }) .withBean(PostgresOutboxStore::class.java, { - PostgresOutboxStore(SpringConnectionProvider(dsB), java.time.Clock.systemUTC()) + PostgresOutboxStore(SpringConnectionProvider(dsB)) }) .withPropertyValues("okapi.liquibase.enabled=false") .run { ctx -> diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerMatchedDataSourceTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerMatchedDataSourceTest.kt index 9100229..f0f82d1 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerMatchedDataSourceTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/JpaTransactionManagerMatchedDataSourceTest.kt @@ -63,7 +63,7 @@ class JpaTransactionManagerMatchedDataSourceTest : FunSpec({ .withBean("jpaTm", PlatformTransactionManager::class.java, { jpaPtm }) .withBean(MessageDeliverer::class.java, { JpaMatchStubDeliverer }) .withBean(PostgresOutboxStore::class.java, { - PostgresOutboxStore(SpringConnectionProvider(ds), java.time.Clock.systemUTC()) + PostgresOutboxStore(SpringConnectionProvider(ds)) }) .withPropertyValues("okapi.liquibase.enabled=false") .run { ctx -> diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MultiDataSourceTransactionTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MultiDataSourceTransactionTest.kt index 3638954..c11f1ab 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MultiDataSourceTransactionTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MultiDataSourceTransactionTest.kt @@ -67,7 +67,7 @@ class MultiDataSourceTransactionTest : FunSpec({ val otherTxManager = DataSourceTransactionManager(otherDataSource) otherTxTemplate = TransactionTemplate(otherTxManager) - store = PostgresOutboxStore(SpringConnectionProvider(outboxDataSource), clock) + store = PostgresOutboxStore(SpringConnectionProvider(outboxDataSource)) val corePublisher = OutboxPublisher(store, clock) publisher = SpringOutboxPublisher(delegate = corePublisher, dataSource = outboxDataSource) } diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MysqlConnectionLeakProofTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MysqlConnectionLeakProofTest.kt index b91fd55..99e3f50 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MysqlConnectionLeakProofTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/MysqlConnectionLeakProofTest.kt @@ -39,7 +39,7 @@ class MysqlConnectionLeakProofTest : FunSpec({ } runLiquibase(container) counter = CountingDataSource(raw) - store = MysqlOutboxStore(SpringConnectionProvider(counter), clock) + store = MysqlOutboxStore(SpringConnectionProvider(counter)) } afterSpec { diff --git a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/WrongPtmMultiDataSourceFailFastTest.kt b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/WrongPtmMultiDataSourceFailFastTest.kt index 5de957c..d08926b 100644 --- a/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/WrongPtmMultiDataSourceFailFastTest.kt +++ b/okapi-integration-tests/src/test/kotlin/com/softwaremill/okapi/test/transaction/WrongPtmMultiDataSourceFailFastTest.kt @@ -38,7 +38,7 @@ class WrongPtmMultiDataSourceFailFastTest : FunSpec({ .withBean("exposedTmA", PlatformTransactionManager::class.java, { SpringTransactionManager(dsA) }) .withBean(MessageDeliverer::class.java, { RecordingMessageDeliverer() }) .withBean(PostgresOutboxStore::class.java, { - PostgresOutboxStore(SpringConnectionProvider(dsB), java.time.Clock.systemUTC()) + PostgresOutboxStore(SpringConnectionProvider(dsB)) }) .withPropertyValues("okapi.processor.enabled=false", "okapi.liquibase.enabled=false") .run { ctx -> @@ -61,7 +61,7 @@ class WrongPtmMultiDataSourceFailFastTest : FunSpec({ .withBean("exposedTmA", PlatformTransactionManager::class.java, { SpringTransactionManager(dsA) }) .withBean(MessageDeliverer::class.java, { RecordingMessageDeliverer() }) .withBean(PostgresOutboxStore::class.java, { - PostgresOutboxStore(SpringConnectionProvider(dsB), java.time.Clock.systemUTC()) + PostgresOutboxStore(SpringConnectionProvider(dsB)) }) .withPropertyValues( "okapi.processor.enabled=false", @@ -90,7 +90,7 @@ class WrongPtmMultiDataSourceFailFastTest : FunSpec({ .withBean("exposedTmA", PlatformTransactionManager::class.java, { SpringTransactionManager(dsA) }) .withBean(MessageDeliverer::class.java, { RecordingMessageDeliverer() }) .withBean(PostgresOutboxStore::class.java, { - PostgresOutboxStore(SpringConnectionProvider(dsB), java.time.Clock.systemUTC()) + PostgresOutboxStore(SpringConnectionProvider(dsB)) }) .withPropertyValues( "okapi.processor.enabled=false", diff --git a/okapi-mysql/src/main/kotlin/com/softwaremill/okapi/mysql/MysqlOutboxStore.kt b/okapi-mysql/src/main/kotlin/com/softwaremill/okapi/mysql/MysqlOutboxStore.kt index dcdcbfc..bde5871 100644 --- a/okapi-mysql/src/main/kotlin/com/softwaremill/okapi/mysql/MysqlOutboxStore.kt +++ b/okapi-mysql/src/main/kotlin/com/softwaremill/okapi/mysql/MysqlOutboxStore.kt @@ -7,14 +7,12 @@ import com.softwaremill.okapi.core.OutboxStatus import com.softwaremill.okapi.core.OutboxStore import java.sql.ResultSet import java.sql.Timestamp -import java.time.Clock import java.time.Instant import java.util.UUID /** MySQL [OutboxStore] implementation using plain JDBC. */ class MysqlOutboxStore( private val connectionProvider: ConnectionProvider, - private val clock: Clock = Clock.systemUTC(), ) : OutboxStore { override fun persist(entry: OutboxEntry): OutboxEntry { diff --git a/okapi-postgres/src/main/kotlin/com/softwaremill/okapi/postgres/PostgresOutboxStore.kt b/okapi-postgres/src/main/kotlin/com/softwaremill/okapi/postgres/PostgresOutboxStore.kt index a1af83c..4bff6d3 100644 --- a/okapi-postgres/src/main/kotlin/com/softwaremill/okapi/postgres/PostgresOutboxStore.kt +++ b/okapi-postgres/src/main/kotlin/com/softwaremill/okapi/postgres/PostgresOutboxStore.kt @@ -7,14 +7,12 @@ import com.softwaremill.okapi.core.OutboxStatus import com.softwaremill.okapi.core.OutboxStore import java.sql.ResultSet import java.sql.Timestamp -import java.time.Clock import java.time.Instant import java.util.UUID /** PostgreSQL [OutboxStore] implementation using plain JDBC. */ class PostgresOutboxStore( private val connectionProvider: ConnectionProvider, - private val clock: Clock = Clock.systemUTC(), ) : OutboxStore { override fun persist(entry: OutboxEntry): OutboxEntry { diff --git a/okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt b/okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt index a79b704..e575aa6 100644 --- a/okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt +++ b/okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt @@ -239,9 +239,8 @@ class OutboxAutoConfiguration( ) { @Bean @ConditionalOnMissingBean(OutboxStore::class) - fun outboxStore(clock: ObjectProvider): PostgresOutboxStore = PostgresOutboxStore( + fun outboxStore(): PostgresOutboxStore = PostgresOutboxStore( connectionProvider = SpringConnectionProvider(resolveDataSource(dataSources, primaryDataSource, okapiProperties)), - clock = clock.getIfAvailable { Clock.systemUTC() }, ) } @@ -255,9 +254,8 @@ class OutboxAutoConfiguration( ) { @Bean @ConditionalOnMissingBean(OutboxStore::class) - fun outboxStore(clock: ObjectProvider): MysqlOutboxStore = MysqlOutboxStore( + fun outboxStore(): MysqlOutboxStore = MysqlOutboxStore( connectionProvider = SpringConnectionProvider(resolveDataSource(dataSources, primaryDataSource, okapiProperties)), - clock = clock.getIfAvailable { Clock.systemUTC() }, ) } diff --git a/okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/OutboxMysqlEndToEndTest.kt b/okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/OutboxMysqlEndToEndTest.kt index 6362096..7b73bff 100644 --- a/okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/OutboxMysqlEndToEndTest.kt +++ b/okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/OutboxMysqlEndToEndTest.kt @@ -56,7 +56,7 @@ class OutboxMysqlEndToEndTest : connection.close() val clock = Clock.systemUTC() - store = MysqlOutboxStore(jdbc, clock) + store = MysqlOutboxStore(jdbc) publisher = OutboxPublisher(store, clock) val urlResolver = ServiceUrlResolver { "http://localhost:${wiremock.port()}" }