Send Success notification when Command is executed

extract Action of the Commands
simplify somme classes
This commit is contained in:
2025-03-16 00:17:06 +01:00
parent a2f93d4edd
commit ca95344ca9
26 changed files with 498 additions and 310 deletions

View File

@@ -9,7 +9,8 @@ import eventDemo.app.event.GameEventStore
import eventDemo.app.event.projection.GameStateRepository
import eventDemo.app.event.projection.SnapshotConfig
import eventDemo.app.eventListener.PlayerNotificationEventListener
import eventDemo.libs.command.CommandStreamChannelBuilder
import eventDemo.libs.command.CommandRunnerController
import eventDemo.libs.command.CommandStreamChannel
import eventDemo.libs.event.EventBusInMemory
import eventDemo.libs.event.EventStoreInMemory
import eventDemo.libs.event.VersionBuilder
@@ -41,12 +42,20 @@ val appKoinModule =
GameStateRepository(get(), get(), snapshotConfig = SnapshotConfig())
}
single {
CommandStreamChannelBuilder<GameCommand>()
CommandStreamChannel<GameCommand>(get())
}
single {
CommandRunnerController<GameCommand>()
}
single {
GameCommandHandler(get(), get(), get(), get())
}
singleOf(::VersionBuilderLocal) bind VersionBuilder::class
singleOf(::GameEventHandler)
singleOf(::GameCommandActionRunner)
singleOf(::GameCommandHandler)
singleOf(::PlayerNotificationEventListener)
// Actions
configureActions()
}

View File

@@ -0,0 +1,18 @@
package eventDemo.configuration
import eventDemo.app.command.action.ICantPlay
import eventDemo.app.command.action.IWantToJoinTheGame
import eventDemo.app.command.action.IWantToPlayCard
import eventDemo.app.command.action.IamReadyToPlay
import org.koin.core.module.Module
import org.koin.core.module.dsl.singleOf
/**
* Configure all actions
*/
fun Module.configureActions() {
singleOf(::IWantToPlayCard)
singleOf(::IamReadyToPlay)
singleOf(::IWantToJoinTheGame)
singleOf(::ICantPlay)
}