diff --git a/dependencies.gradle b/dependencies.gradle index 6e1c919..6a6e8e9 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,13 +1,18 @@ dependencies { // Mongo - api 'org.litote.kmongo:kmongo:5.1.0' + api('org.litote.kmongo:kmongo:5.1.0') { + exclude group: "org.mongodb", module: "mongodb-driver-sync" + exclude group: "org.mongodb", module: "mongodb-driver-core" + } + api 'org.mongodb:mongodb-driver-core:5.1.4' + api 'org.mongodb:mongodb-driver-sync:5.1.4' // LSD api 'io.github.lsd-consulting:lsd-distributed-connector:2.0.8' implementation 'io.github.lsd-consulting:lsd-logging-library:1.0.14' // Spring - compileOnly 'org.springframework.boot:spring-boot-autoconfigure:3.2.5' + compileOnly 'org.springframework.boot:spring-boot-autoconfigure:3.3.3' // Other implementation 'org.apache.httpcomponents:httpcore:4.4.16' // Needed for DB connection security diff --git a/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/config/LibraryConfig.kt b/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/config/LibraryConfig.kt index 372ae36..18919c3 100644 --- a/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/config/LibraryConfig.kt +++ b/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/config/LibraryConfig.kt @@ -34,7 +34,7 @@ open class LibraryConfig { @Value("\${lsd.dist.connectionString}") dbConnectionString: String, @Value("\${lsd.dist.db.trustStoreLocation:#{null}}") trustStoreLocation: String?, @Value("\${lsd.dist.db.trustStorePassword:#{null}}") trustStorePassword: String?, - @Value("\${lsd.dist.db.connectionTimeout.millis:#{" + DEFAULT_TIMEOUT_MILLIS + "}}") connectionTimeout: Int, + @Value("\${lsd.dist.db.connectionTimeout.millis:#{" + DEFAULT_TIMEOUT_MILLIS + "}}") connectionTimeout: Long, @Value("\${lsd.dist.db.collectionSizeLimit.megabytes:#{" + DEFAULT_COLLECTION_SIZE_LIMIT_MBS + "}}") collectionSizeLimit: Long, ): InterceptedInteractionCollectionBuilder = InterceptedInteractionCollectionBuilder( dbConnectionString, diff --git a/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/repository/InterceptedInteractionCollectionBuilder.kt b/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/repository/InterceptedInteractionCollectionBuilder.kt index 8b25ba5..dd781c7 100644 --- a/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/repository/InterceptedInteractionCollectionBuilder.kt +++ b/src/main/kotlin/io/lsdconsulting/lsd/distributed/mongo/repository/InterceptedInteractionCollectionBuilder.kt @@ -29,7 +29,7 @@ const val DEFAULT_COLLECTION_SIZE_LIMIT_MBS = 1000 * 10L // 10Gb class InterceptedInteractionCollectionBuilder( private val dbConnectionString: String, private val trustStoreLocation: String?, - private val trustStorePassword: String?, private val connectionTimeout: Int, + private val trustStorePassword: String?, private val connectionTimeout: Long, private val collectionSizeLimit: Long ) { val pojoCodecRegistry: CodecRegistry = CodecRegistries.fromRegistries( @@ -45,7 +45,7 @@ class InterceptedInteractionCollectionBuilder( b.readTimeout(connectionTimeout, MILLISECONDS) } .applyToClusterSettings { b: ClusterSettings.Builder -> - b.serverSelectionTimeout(connectionTimeout.toLong(), MILLISECONDS) + b.serverSelectionTimeout(connectionTimeout, MILLISECONDS) } .applyConnectionString(ConnectionString(dbConnectionString)) if (!trustStoreLocation.isNullOrBlank() && !trustStorePassword.isNullOrBlank()) { @@ -112,7 +112,7 @@ class InterceptedInteractionCollectionBuilder( } constructor( - dbConnectionString: String, connectionTimeout: Int, + dbConnectionString: String, connectionTimeout: Long, collectionSizeLimit: Long ) : this(dbConnectionString, null, null, connectionTimeout, collectionSizeLimit) } diff --git a/src/test/kotlin/io/lsdconsulting/lsd/distributed/mongo/integration/InterceptedDocumentMongoRepositoryResiliencyIT.kt b/src/test/kotlin/io/lsdconsulting/lsd/distributed/mongo/integration/InterceptedDocumentMongoRepositoryResiliencyIT.kt index 524fe70..d313b89 100644 --- a/src/test/kotlin/io/lsdconsulting/lsd/distributed/mongo/integration/InterceptedDocumentMongoRepositoryResiliencyIT.kt +++ b/src/test/kotlin/io/lsdconsulting/lsd/distributed/mongo/integration/InterceptedDocumentMongoRepositoryResiliencyIT.kt @@ -131,7 +131,7 @@ internal class InterceptedDocumentMongoRepositoryResiliencyIT { } companion object { - private const val DB_CONNECTION_TIMEOUT = 500 + private const val DB_CONNECTION_TIMEOUT = 500L const val DB_COLLECTION_SIZE_LIMIT = 1024 * 100L @JvmStatic