I’ve already seen other topics about event order inside an aggregate, but in my case, it is about event handler in read side part.
It is an Event Sourcing architecture:
I have a command
CreateUserCommand(String username, String password)
Inside UserCommandHandler class :
User user = new User(createUserCommand.getUsername());
Where passwordHasherService is a domain service which generate hash for password.
User constructor raises UserCreatedEvent(String username);
User changePassword method raises UserPasswordChangedEvent(String username, String hashedPassword);
Inside UserQueryListener, i handle UserCreatedEvent and UserPasswordChangedEvent.
How to be sure that UserCreatedEvent is completed before UserPasswordChangedEvent is called in my read side listener ?