TransWikia.com

call another microservice after a domain event occurs in DDD

Stack Overflow Asked on November 20, 2021

I have an API for register users in "user service" after creating a user happen an event for send a welcome email. This requires the "user service" to call "the notification service". I have 3 layers in my project (Application – Domain – Infrastructure), in the user register API first application layer call domain layer and "create User Event" Occurs within the domain.

Should be the domain return the event to the application layer that sends to the application layer and application layer send this event to the infrastructure layer and infrastructure layer call notification service?

or should be the domain send the event directly to the infrastructure layer?

Which layer should be call the infrastructure layer for send data to the notification service?

One Answer

I would make the Application layer in charge of calling Infra for notification, so your Domain don't have to bother about notifying what, when, how, etc.

And the less Domain has reponsabilities, the better, I think.

Answered by Pierre Sevrain on November 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP