How can I create a domain object using data obtained from another bounded context?

I have a scenario where I am getting information from another bounded context via a message queue, I need to construct a domain object using the information obtained from the message queue (the design of the object can vary depending on the information). Now I need to create a domain object at the infrastructure level and modify at the domain level? (or) Do I need to bring message queue data to domain level services and create domain objects using message queue data information.


source to share

2 answers

I would probably have a subscriber in a message queue that has a domain event containing data retrieved from another bounded context. The event handler for this event will then create an appropriate object for this context.

If needed, I can potentially fire another event to let this bounded context know that the object has been created.



At the infrastructure level where the queue job is running, instead of raising a domain event as suggested by jett, sending a command to create an Aggregate seems more sensible in my mind. Once created, AR then fires a domain event



All Articles