Adding Email to the Registration Process

Next, we’ll teach the identity Component to send a welcome email when users register. Backhere you wrote Registered events in the identity Component. We’ll use those events as the trigger to send a registration email. Yes, when we’re done, identity will respond to its own messages. There is absolutely nothing wrong with that.

We also need to introduce a new event owned by the identity Component. Since we’re going to send emails in response to messages, we’ll need a way to project an identity and know if the email has already been sent. To that end, we introduce the RegistrationEmailSent event:

 {
 "id"​: ​"2ea97206-10a4-46ac-aa4a-ba48e0cdd450"​,
 "type"​: ​"RegistrationEmailSent"​,
 "data"​: { ...

Get Practical Microservices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.