Skip to content
New issue

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

A command should be registered only by one handler #8

Open
chkoar opened this issue Jan 20, 2025 · 0 comments
Open

A command should be registered only by one handler #8

chkoar opened this issue Jan 20, 2025 · 0 comments

Comments

@chkoar
Copy link

chkoar commented Jan 20, 2025

In the context of CQRS, a command should typically be handled by only one command handler per bounded context/module. However, it seems that this is not the case in the current implementation. Is this intentional? Ideally I would expect to raise an error on the registration.

from lato import Application, ApplicationModule, Command


class C(Command): ...


app = Application(name="App")
module_a = ApplicationModule("Module A")
app.include_submodule(module_a)


@module_a.handler(C)
def handler_a1(cmd: C):
    print("module_a1")


@module_a.handler(C)
def handler_a2(cmd: C):
    print("module_a2")

Prints:

module_a1
module_a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant