Created
November 22, 2011 14:55
-
-
Save anonymous/1385842 to your computer and use it in GitHub Desktop.
UserRegistrationSaga
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserRegistrationSaga { | |
private RegistrationStep registrationStep; | |
... // Other stuff | |
@SagaStart | |
@SagaEventHandler(UserCreated event){ | |
commandBus.dispatch(new SendAConfirmationEmailToUser()); | |
registrationStep = RegistrationStep.INACTIVE_ACCOUNT_CREATED; | |
} | |
@SagaEventHandler(UserConfirmedEmailAddress event){ | |
commandBus.dispatch(new ActivateUserAccount()); | |
registrationStep = RegistrationStep.EMAIL_CONFIRMED; | |
} | |
@SagaEventHandler(UserAskedToResendTheConfirmedEmailAddress event){ | |
commandBus.dispatch(new ResendTheConfirmationEmail()); | |
registrationStep = RegistrationStep.CONFIRMATION_EMAIL_RESENT; | |
} | |
@EndSaga | |
@SagaEventHandler(UserAccountActivated event){ | |
commandBus.dispatch(new SendAConfirmationEmailToUser()); | |
registrationStep = RegistrationStep.COMPLETE; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment