design patterns - .net implementation of communication between aggregate roots in different bounded context -


this first time applying ddd concepts real world problem.

i started 1 bounded context project relatively small. found myself classes identical i.e. similar names, similar properties different behaviour. starting think belong in different bounded contexts entities same , have different meaning in different context. supported fact application has 2 different user groups.

i have done bit of reading on how 2 entities in different bounded context can communicate each other. think understand concept... have no idea how implement? there .net example somewhere? i.e. aggregate root in 1 bounded context publishing event aggregate root in bounded context? , aggregate root calling aggregate root in bounded context.

and should each bounded context have own: service layer? repository , data layer?

this may quote implementing domain driven design vaughn vernon.

"perhaps common use of domain events when aggregate creates event , publishes it. publisher resides in module of model, doesn't model aspect. rather, provides simple service aggregates need notify subscribers of events."

events published using service , implementation of handler depends on acceptable time rest of model brought consistent. particular requirements acceptable small delay in time. domain events published queue using msmq in external process read queue , preform work. design allows me offload work external host , free iis. use same mechanism persist changes storage. when transaction on aggregate complete publish committed event msmq , have 2 queues on multicast. 1 queue handling additional work , other persistence.

if haven't read highly recommend book. sure design bring criticism implementation depend on requirements , how comfortable using eventual consistency.

hope helps , if decide use msmq here link started. http://msdn.microsoft.com/en-us/library/aa480407.aspx

here implementation of domain event publisher.

public class domaineventpublisher {     string domaineeventmessagequeue = @"formatname:multicast=234.1.1.1:8001";      public void publishevent(domainevent domainevent, string correlationid)     {         messagequeue eventqueue;          eventqueue = new messagequeue(domaineeventmessagequeue);          message message = domaineventmessage.createdomaineventmessage(domainevent);          message.correlationid = correlationid;          eventqueue.send(message);     }  } 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -