We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One idea would be to force the use of commands. This would allow one to do:
module { commands { c -> when(c) { is SomeCommand1 -> SomeDomainModel.handle(c.id, c) is SomeCommand2 -> SomeDomainModel.handle(c.id, c) } } }
This would also work if the DM doesn't use commands:
module { commands { c -> when(c) { is SomeCommand1 -> SomeDomainModel.handle(c.id, c.thing1, c.thing2) is SomeCommand2 -> SomeDomainModel.handle(c.id, c.thing3) } } }
It would also be possible to do:
module { commands(MyCommand::id, SomeDomainModle::handle) }
if the DM handles all command types. Or if you have two different commands handlers (aggregates):
module { commands<GameCommand>(GameCommand::gameId, Game::handle) commands<PlayerCommand>(PlayerCommand::playerId, Player::handle) }
Alternatively, if commands should only be defined once:
commands
module { commands { command<GameCommand>(GameCommand::gameId, Game::handle) command<PlayerCommand>(PlayerCommand::playerId, Player::handle) } }
An alternative. that is probably better, would be to pass the "aggregate id finder functions" to commands:
fun findId(cmd : Command) = when(cmd) { is GameCommand -> cmd.gameId is PlayerCommand -> cmd.playerId } module { commands(::findId) { command<GameCommand>(Game::handle) command<PlayerCommand>(Player::handle) } }
Or maybe a combination? I.e. that you can pass "aggregate id finder functions" both to commands and command where command has precedence.
command
Note that module DSL should be lazy! Don't use subscription DSL etc directly in the module! (and interface would be ok!)
You compose modules into an Application, e.g.:
Application
interface AllStartedGamesQuery : Query<AllStartedGamesDTO> val module1 = module { .. } val module2 = module { .. } val applicationService = .. val subscriptionDsl = .. val domainQueryDsl = val application = application(module1, module2).start(applicationService, subscriptionDsl, domainQueryDsl) application.dispatch(PlayGameCommand("gameId", Shape.Hand)) val allStartedGames = application.query<AllStartedGamesQuery>()
The text was updated successfully, but these errors were encountered:
How to handle integration events????
Sorry, something went wrong.
No branches or pull requests
One idea would be to force the use of commands. This would allow one to do:
This would also work if the DM doesn't use commands:
It would also be possible to do:
if the DM handles all command types. Or if you have two different commands handlers (aggregates):
Alternatively, if
commands
should only be defined once:An alternative. that is probably better, would be to pass the "aggregate id finder functions" to
commands
:Or maybe a combination? I.e. that you can pass "aggregate id finder functions" both to
commands
andcommand
wherecommand
has precedence.Note that module DSL should be lazy! Don't use subscription DSL etc directly in the module! (and interface would be ok!)
You compose modules into an
Application
, e.g.:The text was updated successfully, but these errors were encountered: