Answer the question
In order to leave comments, you need to log in
Is the handler of domain event considered a CQRS pattern handler?
CQRS we have command / query, but what about events?
For a team or a Queri, we have a user case, but is an event considered a user case because it lies and belongs to another layer altogether, Domain? While CQRS is Application.
So, conditionally, I make a handler that listens to the UserRegistered Domain event, where should I put this handler? All handlers are the Infrastructure ES layer, but at the same time it is the handler of the conditional command. After all, the differences between the team and the event are minimal. They carry a minimum of data, they talk about events. The command that should happen, the event that has already happened, both will dispatch the event bass only different interfaces and middleware.
Now the structure is
Application -> CQRS -> Command / Query -> UseCase / Handler -> RegisterUser / RegsterUserHandler
Domain -> Entity -> Event -> UserRegisteredEvent
Infrastructure -> EventSourcing -> Bus -> Handlers -> UserRegisteredEventHandler / EmailVerifiedEventHandler ...
Infrastructure -> EventSourcing -> EventDispatcher -> Listeners -> UserRegisteredListener
Infrastructure -> EventSourcing -> EventDispatcher -> Subscribers -> UserRegisteredSubscriber
Answer the question
In order to leave comments, you need to log in
one.
For a team or Queri, we have a user case, but is an event considered a user case because it lies and belongs to another layer altogether, Domain? While CQRS is Application.Event cannot be Use Case. Event is what happened and Use Case is what needs to be done (use cases).
All handlers are the Infrastructure ES layer, but at the same time it is the handler of the conditional command.Not a correct statement. Infrastructure is what comes from the framework. Take the Slim Framework and you will understand how empty it is). Everything else can be abstracted into their own classes.
Application
Command
Query
Domain
Entity
class Id
interface UserRepository
Service
interface PasswordHasher
interface Flusher
Infrastructure
Entity
class IdType
class DoctrineUserRepository implements UserRepository
Service
class CryptPasswordHasher implements PasswordHasher
class DoctrineFlusher implements Flusher
Symphony tag is important because we have both EventDispatcher and EventBus, i.e. 2 foldersWhen you start designing for DDD, the Framework is usually omitted. The bare minimum is used, and everything else is isolated. At the same time, you are not prohibited from using symphony components or other framework-independent components. But if it's a bundle, you won't go far)
In general, what is your opinion, where to put the Domain event handler that was dispatched through the bus event like commands / queries?See Clause 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question