Clean and fix

This commit is contained in:
2025-03-05 22:11:24 +01:00
parent d84e8359c9
commit 99f0760d3c
11 changed files with 110 additions and 92 deletions

View File

@@ -1,11 +1,14 @@
package eventDemo.configuration
import eventDemo.app.command.GameCommandHandler
import eventDemo.app.event.GameEventBus
import eventDemo.app.event.GameEventStream
import eventDemo.app.eventListener.GameEventPlayerNotificationListener
import eventDemo.libs.event.EventBusInMemory
import eventDemo.libs.event.EventStreamInMemory
import io.ktor.server.application.Application
import io.ktor.server.application.install
import org.koin.core.module.dsl.singleOf
import org.koin.dsl.module
import org.koin.ktor.plugin.Koin
import org.koin.logger.slf4jLogger
@@ -19,10 +22,15 @@ fun Application.configureKoin() {
val appKoinModule =
module {
single {
GameEventBus(EventBusInMemory())
}
single {
GameEventStream(get(), EventStreamInMemory())
}
single {
GameEventBus(EventBusInMemory())
GameCommandHandler(get())
}
singleOf(::GameEventPlayerNotificationListener)
}

View File

@@ -1,16 +1,16 @@
package eventDemo.configuration
import eventDemo.app.command.GameCommandHandler
import eventDemo.app.command.gameSocket
import eventDemo.app.event.GameEventBus
import eventDemo.app.event.GameEventStream
import eventDemo.app.eventListener.GameEventPlayerNotificationListener
import io.ktor.server.application.Application
import io.ktor.server.routing.routing
fun Application.declareWebSocketsGameRoute(
eventStream: GameEventStream,
eventBus: GameEventBus,
playerNotificationListener: GameEventPlayerNotificationListener,
commandHandler: GameCommandHandler,
) {
routing {
gameSocket(eventStream, eventBus)
gameSocket(playerNotificationListener, commandHandler)
}
}