Merge branch 'refs/heads/develop' into timeline

This commit is contained in:
usbharu 2024-07-29 22:52:42 +09:00
commit 96be4e5577
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
65 changed files with 169 additions and 160 deletions

View File

@ -65,7 +65,7 @@ jobs:
java-version: '21' java-version: '21'
distribution: 'temurin' distribution: 'temurin'
- name: Build - name: Build
uses: gradle/gradle-build-action@v3.4.2 uses: gradle/gradle-build-action@v3.5.0
with: with:
arguments: :hideout-core:testClasses arguments: :hideout-core:testClasses
@ -117,7 +117,7 @@ jobs:
distribution: 'temurin' distribution: 'temurin'
- name: Unit Test - name: Unit Test
uses: gradle/gradle-build-action@v3.4.2 uses: gradle/gradle-build-action@v3.5.0
with: with:
arguments: :hideout-core:test arguments: :hideout-core:test
@ -177,7 +177,7 @@ jobs:
- name: Run Kover - name: Run Kover
uses: gradle/gradle-build-action@v3.4.2 uses: gradle/gradle-build-action@v3.5.0
with: with:
arguments: :hideout-core:koverXmlReport --rerun-tasks arguments: :hideout-core:koverXmlReport --rerun-tasks
@ -260,7 +260,7 @@ jobs:
distribution: 'temurin' distribution: 'temurin'
- name: Build with Gradle - name: Build with Gradle
uses: gradle/gradle-build-action@66535aaf56f831b35e3a8481c9c99b665b84dd45 uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1
with: with:
arguments: :hideout-core:detektMain arguments: :hideout-core:detektMain

View File

@ -1,6 +1,6 @@
org.gradle.parallel=true org.gradle.parallel=true
org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED org.gradle.jvmargs=-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED -XX:TieredStopAtLevel=1 -noverify
org.gradle.configuration-cache=true org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn org.gradle.configuration-cache.problems=warn

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

5
gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

2
gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") version "1.9.24" kotlin("jvm") version "1.9.25"
} }
group = "dev.usbharu" group = "dev.usbharu"

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

View File

@ -92,7 +92,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-thymeleaf") implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
implementation("org.springframework.boot:spring-boot-starter-log4j2") implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-validation")
annotationProcessor("org.springframework:spring-context-indexer")
implementation(libs.blurhash) implementation(libs.blurhash)
implementation(libs.aws.s3) implementation(libs.aws.s3)
@ -133,7 +133,7 @@ dependencies {
testImplementation(libs.coroutines.test) testImplementation(libs.coroutines.test)
testImplementation(libs.ktor.client.mock) testImplementation(libs.ktor.client.mock)
testImplementation(libs.h2db) testImplementation(libs.h2db)
testImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1") testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
testImplementation("org.mockito:mockito-inline:5.2.0") testImplementation("org.mockito:mockito-inline:5.2.0")
testImplementation("nl.jqno.equalsverifier:equalsverifier:3.16.1") testImplementation("nl.jqno.equalsverifier:equalsverifier:3.16.1")
testImplementation("com.jparams:to-string-verifier:1.4.8") testImplementation("com.jparams:to-string-verifier:1.4.8")

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

View File

@ -18,6 +18,8 @@ hideout:
spring: spring:
jmx:
enabled: false
jackson: jackson:
serialization: serialization:
WRITE_DATES_AS_TIMESTAMPS: false WRITE_DATES_AS_TIMESTAMPS: false

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

View File

@ -11,7 +11,7 @@ serialization = "1.7.1"
kjob = "0.6.0" kjob = "0.6.0"
tika = "2.9.2" tika = "2.9.2"
owl = "0.0.1" owl = "0.0.1"
jackson = "2.15.4" jackson = "2.17.2"
[libraries] [libraries]
@ -69,9 +69,9 @@ jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-
blurhash = { module = "io.trbl:blurhash", version = "1.0.0" } blurhash = { module = "io.trbl:blurhash", version = "1.0.0" }
aws-s3 = { module = "software.amazon.awssdk:s3", version = "2.26.12" } aws-s3 = { module = "software.amazon.awssdk:s3", version = "2.26.25" }
jsoup = { module = "org.jsoup:jsoup", version = "1.17.2" } jsoup = { module = "org.jsoup:jsoup", version = "1.18.1" }
owasp-java-html-sanitizer = { module = "com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer", version = "20240325.1" } owasp-java-html-sanitizer = { module = "com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer", version = "20240325.1" }
@ -82,9 +82,9 @@ imageio-webp = { module = "com.twelvemonkeys.imageio:imageio-webp", version = "3
thumbnailator = { module = "net.coobird:thumbnailator", version = "0.4.20" } thumbnailator = { module = "net.coobird:thumbnailator", version = "0.4.20" }
flyway-core = { module = "org.flywaydb:flyway-core" } flyway-core = { module = "org.flywaydb:flyway-core" }
flyway-postgresql = { module = "org.flywaydb:flyway-database-postgresql", version = "10.15.0" } flyway-postgresql = { module = "org.flywaydb:flyway-database-postgresql", version = "10.17.0" }
h2db = { module = "com.h2database:h2", version = "2.2.224" } h2db = { module = "com.h2database:h2", version = "2.3.230" }
kotlin-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } kotlin-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
@ -106,9 +106,9 @@ jackson = ["jackson-databind", "jackson-module-kotlin"]
[plugins] [plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
spring-boot = { id = "org.springframework.boot", version = "3.3.1" } spring-boot = { id = "org.springframework.boot", version = "3.3.2" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.8.2" } kover = { id = "org.jetbrains.kotlinx.kover", version = "0.8.3" }
openapi-generator = { id = "org.openapi.generator", version = "7.6.0" } openapi-generator = { id = "org.openapi.generator", version = "7.7.0" }
license-report = { id = "com.github.jk1.dependency-license-report", version = "2.8" } license-report = { id = "com.github.jk1.dependency-license-report", version = "2.8" }

View File

@ -1,6 +1,5 @@
plugins { plugins {
// alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jvm)
id("org.jetbrains.kotlin.jvm") version "1.9.24"
} }
@ -19,7 +18,7 @@ subprojects {
plugin("org.jetbrains.kotlin.jvm") plugin("org.jetbrains.kotlin.jvm")
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }
dependencies { dependencies {

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

5
owl/gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

2
owl/gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

View File

@ -1,12 +1,6 @@
plugins { plugins {
// alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jvm)
kotlin("jvm")
id("com.google.protobuf") version "0.9.4" id("com.google.protobuf") version "0.9.4"
id("com.google.devtools.ksp") version "1.9.24-1.0.20"
}
apply {
plugin("com.google.devtools.ksp")
} }
@ -19,24 +13,21 @@ repositories {
dependencies { dependencies {
implementation("io.grpc:grpc-kotlin-stub:1.4.1") implementation("io.grpc:grpc-kotlin-stub:1.4.1")
implementation("io.grpc:grpc-protobuf:1.65.0") implementation("io.grpc:grpc-protobuf:1.65.1")
implementation("com.google.protobuf:protobuf-kotlin:4.27.2") implementation("com.google.protobuf:protobuf-kotlin:4.27.2")
implementation("io.grpc:grpc-netty:1.65.0") implementation("io.grpc:grpc-netty:1.65.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation(project(":owl-common")) implementation(project(":owl-common"))
implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.23.1") implementation("org.apache.logging.log4j:log4j-slf4j2-impl:2.23.1")
implementation(platform("io.insert-koin:koin-bom:3.5.6")) implementation(platform("io.insert-koin:koin-bom:3.5.6"))
implementation(platform("io.insert-koin:koin-annotations-bom:1.3.1"))
implementation("io.insert-koin:koin-core") implementation("io.insert-koin:koin-core")
compileOnly("io.insert-koin:koin-annotations")
ksp("io.insert-koin:koin-ksp-compiler:1.3.1")
} }
tasks.test { tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }
protobuf { protobuf {
@ -45,7 +36,7 @@ protobuf {
} }
plugins { plugins {
create("grpc") { create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.65.0" artifact = "io.grpc:protoc-gen-grpc-java:1.65.1"
} }
create("grpckt") { create("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar" artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar"

View File

@ -1,11 +1,6 @@
plugins { plugins {
application application
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
id("com.google.devtools.ksp") version "1.9.24-1.0.20"
}
apply {
plugin("com.google.devtools.ksp")
} }
group = "dev.usbharu" group = "dev.usbharu"
@ -16,21 +11,19 @@ repositories {
} }
dependencies { dependencies {
implementation("org.mongodb:mongodb-driver-kotlin-coroutine:5.1.1") implementation("org.mongodb:mongodb-driver-kotlin-coroutine:5.1.2")
implementation(project(":owl-broker")) implementation(project(":owl-broker"))
implementation(project(":owl-common")) implementation(project(":owl-common"))
implementation(platform("io.insert-koin:koin-bom:3.5.6")) implementation(platform("io.insert-koin:koin-bom:3.5.6"))
implementation(platform("io.insert-koin:koin-annotations-bom:1.3.1")) implementation(platform("io.insert-koin:koin-annotations-bom:1.3.1"))
implementation("io.insert-koin:koin-core") implementation("io.insert-koin:koin-core")
compileOnly("io.insert-koin:koin-annotations")
ksp("io.insert-koin:koin-ksp-compiler:1.3.1")
} }
tasks.test { tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }
application { application {

View File

@ -1,25 +0,0 @@
/*
* Copyright (C) 2024 usbharu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.usbharu.owl.broker.mongodb
import org.koin.core.annotation.ComponentScan
import org.koin.core.annotation.Module
@Module
@ComponentScan("dev.usbharu.owl.broker.mongodb")
class MongoModule

View File

@ -20,15 +20,20 @@ import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings import com.mongodb.MongoClientSettings
import com.mongodb.kotlin.client.coroutine.MongoClient import com.mongodb.kotlin.client.coroutine.MongoClient
import dev.usbharu.owl.broker.ModuleContext import dev.usbharu.owl.broker.ModuleContext
import dev.usbharu.owl.broker.domain.model.consumer.ConsumerRepository
import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository
import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTaskRepository
import dev.usbharu.owl.broker.domain.model.task.TaskRepository
import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinitionRepository
import dev.usbharu.owl.broker.domain.model.taskresult.TaskResultRepository
import org.bson.UuidRepresentation import org.bson.UuidRepresentation
import org.koin.core.module.Module import org.koin.core.module.Module
import org.koin.dsl.module import org.koin.dsl.module
import org.koin.ksp.generated.module
class MongoModuleContext : ModuleContext { class MongoModuleContext : ModuleContext {
override fun module(): Module { override fun module(): Module {
val module = MongoModule().module
module.includes(module { return module {
single { single {
val clientSettings = val clientSettings =
MongoClientSettings.builder() MongoClientSettings.builder()
@ -46,7 +51,12 @@ class MongoModuleContext : ModuleContext {
MongoClient.create(clientSettings) MongoClient.create(clientSettings)
.getDatabase(System.getProperty("owl.broker.mongo.database", "mongo-test")) .getDatabase(System.getProperty("owl.broker.mongo.database", "mongo-test"))
} }
}) single<ConsumerRepository> { MongodbConsumerRepository(get()) }
return module single<ProducerRepository> { MongodbProducerRepository(get()) }
single<QueuedTaskRepository> { MongodbQueuedTaskRepository(get(), get()) }
single<TaskDefinitionRepository> { MongodbTaskDefinitionRepository(get()) }
single<TaskRepository> { MongodbTaskRepository(get(), get()) }
single<TaskResultRepository> { MongodbTaskResultRepository(get(), get()) }
}
} }
} }

View File

@ -27,10 +27,8 @@ import kotlinx.coroutines.withContext
import org.bson.BsonType import org.bson.BsonType
import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonId
import org.bson.codecs.pojo.annotations.BsonRepresentation import org.bson.codecs.pojo.annotations.BsonRepresentation
import org.koin.core.annotation.Singleton
import java.util.* import java.util.*
@Singleton
class MongodbConsumerRepository(database: MongoDatabase) : ConsumerRepository { class MongodbConsumerRepository(database: MongoDatabase) : ConsumerRepository {
private val collection = database.getCollection<ConsumerMongodb>("consumers") private val collection = database.getCollection<ConsumerMongodb>("consumers")

View File

@ -23,11 +23,9 @@ import dev.usbharu.owl.broker.domain.model.producer.Producer
import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.koin.core.annotation.Singleton
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@Singleton
class MongodbProducerRepository(database: MongoDatabase) : ProducerRepository { class MongodbProducerRepository(database: MongoDatabase) : ProducerRepository {
private val collection = database.getCollection<ProducerMongodb>("producers") private val collection = database.getCollection<ProducerMongodb>("producers")

View File

@ -36,11 +36,9 @@ import kotlinx.coroutines.withContext
import org.bson.BsonType import org.bson.BsonType
import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonId
import org.bson.codecs.pojo.annotations.BsonRepresentation import org.bson.codecs.pojo.annotations.BsonRepresentation
import org.koin.core.annotation.Singleton
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@Singleton
class MongodbQueuedTaskRepository( class MongodbQueuedTaskRepository(
private val propertySerializerFactory: PropertySerializerFactory, private val propertySerializerFactory: PropertySerializerFactory,
database: MongoDatabase database: MongoDatabase

View File

@ -27,9 +27,7 @@ import kotlinx.coroutines.withContext
import org.bson.BsonType import org.bson.BsonType
import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonId
import org.bson.codecs.pojo.annotations.BsonRepresentation import org.bson.codecs.pojo.annotations.BsonRepresentation
import org.koin.core.annotation.Singleton
@Singleton
class MongodbTaskDefinitionRepository(database: MongoDatabase) : TaskDefinitionRepository { class MongodbTaskDefinitionRepository(database: MongoDatabase) : TaskDefinitionRepository {
private val collection = database.getCollection<TaskDefinitionMongodb>("task_definition") private val collection = database.getCollection<TaskDefinitionMongodb>("task_definition")

View File

@ -33,11 +33,10 @@ import kotlinx.coroutines.withContext
import org.bson.BsonType import org.bson.BsonType
import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonId
import org.bson.codecs.pojo.annotations.BsonRepresentation import org.bson.codecs.pojo.annotations.BsonRepresentation
import org.koin.core.annotation.Singleton
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@Singleton
class MongodbTaskRepository(database: MongoDatabase, private val propertySerializerFactory: PropertySerializerFactory) : class MongodbTaskRepository(database: MongoDatabase, private val propertySerializerFactory: PropertySerializerFactory) :
TaskRepository { TaskRepository {

View File

@ -31,10 +31,8 @@ import kotlinx.coroutines.withContext
import org.bson.BsonType import org.bson.BsonType
import org.bson.codecs.pojo.annotations.BsonId import org.bson.codecs.pojo.annotations.BsonId
import org.bson.codecs.pojo.annotations.BsonRepresentation import org.bson.codecs.pojo.annotations.BsonRepresentation
import org.koin.core.annotation.Singleton
import java.util.* import java.util.*
@Singleton
class MongodbTaskResultRepository( class MongodbTaskResultRepository(
database: MongoDatabase, database: MongoDatabase,
private val propertySerializerFactory: PropertySerializerFactory private val propertySerializerFactory: PropertySerializerFactory

View File

@ -16,18 +16,73 @@
package dev.usbharu.owl.broker package dev.usbharu.owl.broker
import dev.usbharu.owl.broker.interfaces.grpc.*
import dev.usbharu.owl.broker.service.*
import dev.usbharu.owl.broker.service.ProducerService
import dev.usbharu.owl.broker.service.TaskPublishService
import dev.usbharu.owl.common.property.PropertySerializerFactory
import dev.usbharu.owl.common.retry.DefaultRetryPolicyFactory import dev.usbharu.owl.common.retry.DefaultRetryPolicyFactory
import dev.usbharu.owl.common.retry.ExponentialRetryPolicy import dev.usbharu.owl.common.retry.ExponentialRetryPolicy
import dev.usbharu.owl.common.retry.RetryPolicyFactory import dev.usbharu.owl.common.retry.RetryPolicyFactory
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import org.koin.core.context.startKoin import org.koin.core.context.startKoin
import org.koin.dsl.module import org.koin.dsl.module
import org.koin.ksp.generated.defaultModule
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.util.* import java.util.*
val logger = LoggerFactory.getLogger("MAIN") val logger = LoggerFactory.getLogger("MAIN")
val mainModule = module {
single<AssignQueuedTaskDecider> {
AssignQueuedTaskDeciderImpl(get(), get())
}
single<TaskScanner> { TaskScannerImpl(get()) }
single<TaskPublishService> { TaskPublishServiceImpl(get(), get(), get()) }
single<TaskManagementService> {
TaskManagementServiceImpl(
taskScanner = get(),
queueStore = get(),
taskDefinitionRepository = get(),
assignQueuedTaskDecider = get(),
retryPolicyFactory = get(),
taskRepository = get(),
queueScanner = get(),
taskResultRepository = get()
)
}
single<RegisterTaskService> { RegisterTaskServiceImpl(get()) }
single<QueueStore> { QueueStoreImpl(get()) }
single<QueueScanner> { QueueScannerImpl(get()) }
single<QueuedTaskAssigner> { QueuedTaskAssignerImpl(get(), get()) }
single<ProducerService> { ProducerServiceImpl(get()) }
single<PropertySerializerFactory> { DefaultPropertySerializerFactory() }
single<ConsumerService> { ConsumerServiceImpl(get()) }
single {
OwlBrokerApplication(
assignmentTaskService = get(),
definitionTaskService = get(),
producerService = get(),
subscribeTaskService = get(),
taskPublishService = get(),
taskManagementService = get(),
taskResultSubscribeService = get(),
taskResultService = get()
)
}
single { AssignmentTaskService(queuedTaskAssigner = get(), propertySerializerFactory = get()) }
single { DefinitionTaskService(registerTaskService = get()) }
single { dev.usbharu.owl.broker.interfaces.grpc.ProducerService(producerService = get()) }
single { SubscribeTaskService(consumerService = get()) }
single {
dev.usbharu.owl.broker.interfaces.grpc.TaskPublishService(
taskPublishService = get(),
propertySerializerFactory = get()
)
}
single { TaskResultService(taskManagementService = get(), propertySerializerFactory = get()) }
single { TaskResultSubscribeService(taskManagementService = get(), propertySerializerFactory = get()) }
}
fun main() { fun main() {
val moduleContexts = ServiceLoader.load(ModuleContext::class.java) val moduleContexts = ServiceLoader.load(ModuleContext::class.java)
@ -43,8 +98,9 @@ fun main() {
single<RetryPolicyFactory> { single<RetryPolicyFactory> {
DefaultRetryPolicyFactory(mapOf("" to ExponentialRetryPolicy())) DefaultRetryPolicyFactory(mapOf("" to ExponentialRetryPolicy()))
} }
} }
modules(defaultModule, module, moduleContext.module()) modules(mainModule, module, moduleContext.module())
} }
val application = koin.koin.get<OwlBrokerApplication>() val application = koin.koin.get<OwlBrokerApplication>()

View File

@ -24,9 +24,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.koin.core.annotation.Singleton
@Singleton
class OwlBrokerApplication( class OwlBrokerApplication(
private val assignmentTaskService: AssignmentTaskService, private val assignmentTaskService: AssignmentTaskService,
private val definitionTaskService: DefinitionTaskService, private val definitionTaskService: DefinitionTaskService,

View File

@ -29,12 +29,11 @@ import io.grpc.StatusException
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flatMapMerge import kotlinx.coroutines.flow.flatMapMerge
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class AssignmentTaskService( class AssignmentTaskService(
coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineContext: CoroutineContext = EmptyCoroutineContext,
private val queuedTaskAssigner: QueuedTaskAssigner, private val queuedTaskAssigner: QueuedTaskAssigner,

View File

@ -22,11 +22,9 @@ import dev.usbharu.owl.DefinitionTask.TaskDefined
import dev.usbharu.owl.DefinitionTaskServiceGrpcKt.DefinitionTaskServiceCoroutineImplBase import dev.usbharu.owl.DefinitionTaskServiceGrpcKt.DefinitionTaskServiceCoroutineImplBase
import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinition import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinition
import dev.usbharu.owl.broker.service.RegisterTaskService import dev.usbharu.owl.broker.service.RegisterTaskService
import org.koin.core.annotation.Singleton
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class DefinitionTaskService(coroutineContext: CoroutineContext = EmptyCoroutineContext,private val registerTaskService: RegisterTaskService) : class DefinitionTaskService(coroutineContext: CoroutineContext = EmptyCoroutineContext,private val registerTaskService: RegisterTaskService) :
DefinitionTaskServiceCoroutineImplBase(coroutineContext) { DefinitionTaskServiceCoroutineImplBase(coroutineContext) {
override suspend fun register(request: DefinitionTask.TaskDefinition): TaskDefined { override suspend fun register(request: DefinitionTask.TaskDefinition): TaskDefined {

View File

@ -21,11 +21,10 @@ import dev.usbharu.owl.ProducerServiceGrpcKt.ProducerServiceCoroutineImplBase
import dev.usbharu.owl.broker.external.toUUID import dev.usbharu.owl.broker.external.toUUID
import dev.usbharu.owl.broker.service.ProducerService import dev.usbharu.owl.broker.service.ProducerService
import dev.usbharu.owl.broker.service.RegisterProducerRequest import dev.usbharu.owl.broker.service.RegisterProducerRequest
import org.koin.core.annotation.Singleton
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class ProducerService( class ProducerService(
coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineContext: CoroutineContext = EmptyCoroutineContext,
private val producerService: ProducerService private val producerService: ProducerService

View File

@ -21,11 +21,9 @@ import dev.usbharu.owl.SubscribeTaskServiceGrpcKt.SubscribeTaskServiceCoroutineI
import dev.usbharu.owl.broker.external.toUUID import dev.usbharu.owl.broker.external.toUUID
import dev.usbharu.owl.broker.service.ConsumerService import dev.usbharu.owl.broker.service.ConsumerService
import dev.usbharu.owl.broker.service.RegisterConsumerRequest import dev.usbharu.owl.broker.service.RegisterConsumerRequest
import org.koin.core.annotation.Singleton
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class SubscribeTaskService( class SubscribeTaskService(
coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineContext: CoroutineContext = EmptyCoroutineContext,
private val consumerService: ConsumerService private val consumerService: ConsumerService

View File

@ -27,12 +27,10 @@ import dev.usbharu.owl.common.property.PropertySerializeUtils
import dev.usbharu.owl.common.property.PropertySerializerFactory import dev.usbharu.owl.common.property.PropertySerializerFactory
import io.grpc.Status import io.grpc.Status
import io.grpc.StatusException import io.grpc.StatusException
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class TaskPublishService( class TaskPublishService(
coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineContext: CoroutineContext = EmptyCoroutineContext,
private val taskPublishService: TaskPublishService, private val taskPublishService: TaskPublishService,

View File

@ -30,13 +30,11 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.util.* import java.util.*
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class TaskResultService( class TaskResultService(
coroutineContext: CoroutineContext = EmptyCoroutineContext, coroutineContext: CoroutineContext = EmptyCoroutineContext,
private val taskManagementService: TaskManagementService, private val taskManagementService: TaskManagementService,

View File

@ -23,11 +23,9 @@ import dev.usbharu.owl.common.property.PropertySerializeUtils
import dev.usbharu.owl.common.property.PropertySerializerFactory import dev.usbharu.owl.common.property.PropertySerializerFactory
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import org.koin.core.annotation.Singleton
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext import kotlin.coroutines.EmptyCoroutineContext
@Singleton
class TaskResultSubscribeService( class TaskResultSubscribeService(
private val taskManagementService: TaskManagementService, private val taskManagementService: TaskManagementService,
private val propertySerializerFactory: PropertySerializerFactory, private val propertySerializerFactory: PropertySerializerFactory,

View File

@ -23,12 +23,10 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.emitAll
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.take
import org.koin.core.annotation.Singleton
import java.util.* import java.util.*
interface AssignQueuedTaskDecider { interface AssignQueuedTaskDecider {
fun findAssignableQueue(consumerId: UUID, numberOfConcurrent: Int): Flow<QueuedTask> fun findAssignableQueue(consumerId: UUID, numberOfConcurrent: Int): Flow<QueuedTask>
} }
@Singleton
class AssignQueuedTaskDeciderImpl( class AssignQueuedTaskDeciderImpl(
private val consumerRepository: ConsumerRepository, private val consumerRepository: ConsumerRepository,
private val queueStore: QueueStore private val queueStore: QueueStore

View File

@ -18,7 +18,6 @@ package dev.usbharu.owl.broker.service
import dev.usbharu.owl.broker.domain.model.consumer.Consumer import dev.usbharu.owl.broker.domain.model.consumer.Consumer
import dev.usbharu.owl.broker.domain.model.consumer.ConsumerRepository import dev.usbharu.owl.broker.domain.model.consumer.ConsumerRepository
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.util.* import java.util.*
@ -26,7 +25,6 @@ interface ConsumerService {
suspend fun registerConsumer(registerConsumerRequest: RegisterConsumerRequest): UUID suspend fun registerConsumer(registerConsumerRequest: RegisterConsumerRequest): UUID
} }
@Singleton
class ConsumerServiceImpl(private val consumerRepository: ConsumerRepository) : ConsumerService { class ConsumerServiceImpl(private val consumerRepository: ConsumerRepository) : ConsumerService {
override suspend fun registerConsumer(registerConsumerRequest: RegisterConsumerRequest): UUID { override suspend fun registerConsumer(registerConsumerRequest: RegisterConsumerRequest): UUID {
val id = UUID.randomUUID() val id = UUID.randomUUID()

View File

@ -17,9 +17,7 @@
package dev.usbharu.owl.broker.service package dev.usbharu.owl.broker.service
import dev.usbharu.owl.common.property.* import dev.usbharu.owl.common.property.*
import org.koin.core.annotation.Singleton
@Singleton(binds = [PropertySerializerFactory::class])
class DefaultPropertySerializerFactory : class DefaultPropertySerializerFactory :
CustomPropertySerializerFactory( CustomPropertySerializerFactory(
setOf( setOf(

View File

@ -18,16 +18,15 @@ package dev.usbharu.owl.broker.service
import dev.usbharu.owl.broker.domain.model.producer.Producer import dev.usbharu.owl.broker.domain.model.producer.Producer
import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
interface ProducerService { interface ProducerService {
suspend fun registerProducer(producer: RegisterProducerRequest):UUID suspend fun registerProducer(producer: RegisterProducerRequest): UUID
} }
@Singleton
class ProducerServiceImpl(private val producerRepository: ProducerRepository) : ProducerService { class ProducerServiceImpl(private val producerRepository: ProducerRepository) : ProducerService {
override suspend fun registerProducer(producer: RegisterProducerRequest): UUID { override suspend fun registerProducer(producer: RegisterProducerRequest): UUID {
@ -43,11 +42,11 @@ class ProducerServiceImpl(private val producerRepository: ProducerRepository) :
producerRepository.save(saveProducer) producerRepository.save(saveProducer)
logger.info("Register a new Producer. name: {} hostname: {}",saveProducer.name,saveProducer.hostname) logger.info("Register a new Producer. name: {} hostname: {}", saveProducer.name, saveProducer.hostname)
return id return id
} }
companion object{ companion object {
private val logger = LoggerFactory.getLogger(ProducerServiceImpl::class.java) private val logger = LoggerFactory.getLogger(ProducerServiceImpl::class.java)
} }
} }

View File

@ -23,14 +23,13 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.emitAll
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import org.koin.core.annotation.Singleton
import java.time.Instant import java.time.Instant
interface QueueScanner { interface QueueScanner {
fun startScan(): Flow<QueuedTask> fun startScan(): Flow<QueuedTask>
} }
@Singleton
class QueueScannerImpl(private val queueStore: QueueStore) : QueueScanner { class QueueScannerImpl(private val queueStore: QueueStore) : QueueScanner {
override fun startScan(): Flow<QueuedTask> { override fun startScan(): Flow<QueuedTask> {
return flow { return flow {

View File

@ -19,7 +19,6 @@ package dev.usbharu.owl.broker.service
import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask
import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTaskRepository import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTaskRepository
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import org.koin.core.annotation.Singleton
import java.time.Instant import java.time.Instant
interface QueueStore { interface QueueStore {
@ -33,7 +32,7 @@ interface QueueStore {
fun findByQueuedAtBeforeAndIsActiveIsTrue(instant: Instant): Flow<QueuedTask> fun findByQueuedAtBeforeAndIsActiveIsTrue(instant: Instant): Flow<QueuedTask>
} }
@Singleton
class QueueStoreImpl(private val queuedTaskRepository: QueuedTaskRepository) : QueueStore { class QueueStoreImpl(private val queuedTaskRepository: QueuedTaskRepository) : QueueStore {
override suspend fun enqueue(queuedTask: QueuedTask) { override suspend fun enqueue(queuedTask: QueuedTask) {
queuedTaskRepository.save(queuedTask) queuedTaskRepository.save(queuedTask)

View File

@ -19,7 +19,6 @@ package dev.usbharu.owl.broker.service
import dev.usbharu.owl.broker.domain.exception.service.QueueCannotDequeueException import dev.usbharu.owl.broker.domain.exception.service.QueueCannotDequeueException
import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask import dev.usbharu.owl.broker.domain.model.queuedtask.QueuedTask
import kotlinx.coroutines.flow.* import kotlinx.coroutines.flow.*
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@ -28,7 +27,7 @@ interface QueuedTaskAssigner {
fun ready(consumerId: UUID, numberOfConcurrent: Int): Flow<QueuedTask> fun ready(consumerId: UUID, numberOfConcurrent: Int): Flow<QueuedTask>
} }
@Singleton
class QueuedTaskAssignerImpl( class QueuedTaskAssignerImpl(
private val taskManagementService: TaskManagementService, private val taskManagementService: TaskManagementService,
private val queueStore: QueueStore private val queueStore: QueueStore

View File

@ -19,7 +19,6 @@ package dev.usbharu.owl.broker.service
import dev.usbharu.owl.broker.domain.exception.service.IncompatibleTaskException import dev.usbharu.owl.broker.domain.exception.service.IncompatibleTaskException
import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinition import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinition
import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinitionRepository import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinitionRepository
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
interface RegisterTaskService { interface RegisterTaskService {
@ -28,7 +27,7 @@ interface RegisterTaskService {
suspend fun unregisterTask(name:String) suspend fun unregisterTask(name:String)
} }
@Singleton
class RegisterTaskServiceImpl(private val taskDefinitionRepository: TaskDefinitionRepository) : RegisterTaskService { class RegisterTaskServiceImpl(private val taskDefinitionRepository: TaskDefinitionRepository) : RegisterTaskService {
override suspend fun registerTask(taskDefinition: TaskDefinition) { override suspend fun registerTask(taskDefinition: TaskDefinition) {
val definedTask = taskDefinitionRepository.findByName(taskDefinition.name) val definedTask = taskDefinitionRepository.findByName(taskDefinition.name)

View File

@ -27,7 +27,6 @@ import dev.usbharu.owl.broker.domain.model.taskresult.TaskResultRepository
import dev.usbharu.owl.common.retry.RetryPolicyFactory import dev.usbharu.owl.common.retry.RetryPolicyFactory
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.flow.* import kotlinx.coroutines.flow.*
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@ -43,7 +42,6 @@ interface TaskManagementService {
fun subscribeResult(producerId: UUID): Flow<TaskResults> fun subscribeResult(producerId: UUID): Flow<TaskResults>
} }
@Singleton
class TaskManagementServiceImpl( class TaskManagementServiceImpl(
private val taskScanner: TaskScanner, private val taskScanner: TaskScanner,
private val queueStore: QueueStore, private val queueStore: QueueStore,

View File

@ -22,7 +22,6 @@ import dev.usbharu.owl.broker.domain.model.task.TaskRepository
import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinitionRepository import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinitionRepository
import dev.usbharu.owl.common.property.PropertyValue import dev.usbharu.owl.common.property.PropertyValue
import dev.usbharu.owl.common.retry.RetryPolicyFactory import dev.usbharu.owl.common.retry.RetryPolicyFactory
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
@ -43,7 +42,6 @@ data class PublishedTask(
val id: UUID val id: UUID
) )
@Singleton
class TaskPublishServiceImpl( class TaskPublishServiceImpl(
private val taskRepository: TaskRepository, private val taskRepository: TaskRepository,
private val taskDefinitionRepository: TaskDefinitionRepository, private val taskDefinitionRepository: TaskDefinitionRepository,

View File

@ -24,7 +24,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.emitAll
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import org.koin.core.annotation.Singleton
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.time.Instant import java.time.Instant
@ -33,7 +32,6 @@ interface TaskScanner {
fun startScan(): Flow<Task> fun startScan(): Flow<Task>
} }
@Singleton
class TaskScannerImpl(private val taskRepository: TaskRepository) : class TaskScannerImpl(private val taskRepository: TaskRepository) :
TaskScanner { TaskScanner {

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
} }
group = "dev.usbharu" group = "dev.usbharu"
@ -17,5 +17,5 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
} }
group = "dev.usbharu" group = "dev.usbharu"
@ -19,5 +19,5 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
id("com.google.protobuf") version "0.9.4" id("com.google.protobuf") version "0.9.4"
} }
@ -13,9 +13,9 @@ repositories {
dependencies { dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test") testImplementation("org.jetbrains.kotlin:kotlin-test")
implementation("io.grpc:grpc-kotlin-stub:1.4.1") implementation("io.grpc:grpc-kotlin-stub:1.4.1")
implementation("io.grpc:grpc-protobuf:1.65.0") implementation("io.grpc:grpc-protobuf:1.65.1")
implementation("com.google.protobuf:protobuf-kotlin:4.27.2") implementation("com.google.protobuf:protobuf-kotlin:4.27.2")
implementation("io.grpc:grpc-netty:1.65.0") implementation("io.grpc:grpc-netty:1.65.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation(project(":owl-common")) implementation(project(":owl-common"))
protobuf(files(project(":owl-broker").dependencyProject.projectDir.toString() + "/src/main/proto")) protobuf(files(project(":owl-broker").dependencyProject.projectDir.toString() + "/src/main/proto"))
@ -25,7 +25,7 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }
protobuf { protobuf {
@ -34,7 +34,7 @@ protobuf {
} }
plugins { plugins {
create("grpc") { create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.65.0" artifact = "io.grpc:protoc-gen-grpc-java:1.65.1"
} }
create("grpckt") { create("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar" artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar"

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
} }
group = "dev.usbharu" group = "dev.usbharu"
@ -17,5 +17,5 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
id("com.google.protobuf") version "0.9.4" id("com.google.protobuf") version "0.9.4"
} }
@ -14,9 +14,9 @@ dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test") testImplementation("org.jetbrains.kotlin:kotlin-test")
api(project(":owl-producer:owl-producer-api")) api(project(":owl-producer:owl-producer-api"))
implementation("io.grpc:grpc-kotlin-stub:1.4.1") implementation("io.grpc:grpc-kotlin-stub:1.4.1")
implementation("io.grpc:grpc-protobuf:1.65.0") implementation("io.grpc:grpc-protobuf:1.65.1")
implementation("com.google.protobuf:protobuf-kotlin:4.27.2") implementation("com.google.protobuf:protobuf-kotlin:4.27.2")
implementation("io.grpc:grpc-netty:1.65.0") implementation("io.grpc:grpc-netty:1.65.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
implementation(project(":owl-common")) implementation(project(":owl-common"))
protobuf(files(project(":owl-broker").dependencyProject.projectDir.toString() + "/src/main/proto")) protobuf(files(project(":owl-broker").dependencyProject.projectDir.toString() + "/src/main/proto"))
@ -26,7 +26,7 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }
protobuf { protobuf {
@ -35,7 +35,7 @@ protobuf {
} }
plugins { plugins {
create("grpc") { create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.65.0" artifact = "io.grpc:protoc-gen-grpc-java:1.65.1"
} }
create("grpckt") { create("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar" artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar"

View File

@ -1,5 +1,5 @@
plugins { plugins {
kotlin("jvm") alias(libs.plugins.kotlin.jvm)
} }
group = "dev.usbharu" group = "dev.usbharu"
@ -22,5 +22,5 @@ tasks.test {
useJUnitPlatform() useJUnitPlatform()
} }
kotlin { kotlin {
jvmToolchain(17) jvmToolchain(21)
} }

View File

@ -17,6 +17,7 @@
package dev.usbharu.owl.producer.embedded package dev.usbharu.owl.producer.embedded
import dev.usbharu.owl.broker.OwlBrokerApplication import dev.usbharu.owl.broker.OwlBrokerApplication
import dev.usbharu.owl.broker.mainModule
import dev.usbharu.owl.common.retry.RetryPolicyFactory import dev.usbharu.owl.common.retry.RetryPolicyFactory
import dev.usbharu.owl.common.task.PublishedTask import dev.usbharu.owl.common.task.PublishedTask
import dev.usbharu.owl.common.task.Task import dev.usbharu.owl.common.task.Task
@ -25,7 +26,6 @@ import dev.usbharu.owl.producer.api.OwlProducer
import org.koin.core.Koin import org.koin.core.Koin
import org.koin.core.context.GlobalContext.startKoin import org.koin.core.context.GlobalContext.startKoin
import org.koin.dsl.module import org.koin.dsl.module
import org.koin.ksp.generated.defaultModule
class EmbeddedGrpcOwlProducer( class EmbeddedGrpcOwlProducer(
private val config: EmbeddedGrpcOwlProducerConfig, private val config: EmbeddedGrpcOwlProducerConfig,
@ -42,7 +42,7 @@ class EmbeddedGrpcOwlProducer(
config.retryPolicyFactory config.retryPolicyFactory
} }
} }
modules(module, defaultModule, config.moduleContext.module()) modules(mainModule, module, config.moduleContext.module())
}.koin }.koin
application.get<OwlBrokerApplication>().start(config.port.toInt()) application.get<OwlBrokerApplication>().start(config.port.toInt())

View File

@ -19,6 +19,7 @@ package dev.usbharu.owl.producer.embedded
import dev.usbharu.owl.broker.OwlBrokerApplication import dev.usbharu.owl.broker.OwlBrokerApplication
import dev.usbharu.owl.broker.domain.exception.InvalidRepositoryException import dev.usbharu.owl.broker.domain.exception.InvalidRepositoryException
import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository
import dev.usbharu.owl.broker.mainModule
import dev.usbharu.owl.broker.service.* import dev.usbharu.owl.broker.service.*
import dev.usbharu.owl.common.property.PropertySerializerFactory import dev.usbharu.owl.common.property.PropertySerializerFactory
import dev.usbharu.owl.common.retry.RetryPolicyFactory import dev.usbharu.owl.common.retry.RetryPolicyFactory
@ -30,7 +31,6 @@ import org.koin.core.Koin
import org.koin.core.context.GlobalContext import org.koin.core.context.GlobalContext
import org.koin.core.context.GlobalContext.startKoin import org.koin.core.context.GlobalContext.startKoin
import org.koin.dsl.module import org.koin.dsl.module
import org.koin.ksp.generated.defaultModule
import java.time.Instant import java.time.Instant
import java.util.* import java.util.*
import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinition as BrokerTaskDefinition import dev.usbharu.owl.broker.domain.model.taskdefinition.TaskDefinition as BrokerTaskDefinition
@ -60,7 +60,7 @@ class EmbeddedOwlProducer(
embeddedOwlProducerConfig.propertySerializerFactory embeddedOwlProducerConfig.propertySerializerFactory
} }
} }
modules(defaultModule, module, embeddedOwlProducerConfig.moduleContext.module()) modules(mainModule, module, embeddedOwlProducerConfig.moduleContext.module())
}.koin }.koin
application.getOrNull<ProducerRepository>() application.getOrNull<ProducerRepository>()