Note that there are some explanatory texts on larger screens.

plurals
  1. POEDA: "Cascading" Events or Explicit commands?
    text
    copied!<h2>Scenario</h2> <p>Lets say I have three major components of a system:</p> <ol> <li><p><strong>UI</strong> - Collects input from the user and creates a <em>LoginUserCommand</em> that is sent over a message bus. The user interface then listens to this message bus for <em>MessageReceivedEvent(s)</em>.</p></li> <li><p><strong>User Service</strong> - receives a <em>LoginUserCommand</em> and raises a <em>UserLoggedInEvent</em>. The critical part here is that <strong>Message Service</strong> needs to be told to begin receiving messages.</p></li> <li><p><strong>Message Service</strong> - raises <em>MessageReceivedEvent(s)</em> for logged in users.</p></li> </ol> <h2>Options</h2> <p>The design question I have is regarding the interaction between the <strong>User Service</strong> and the <strong>Message Service</strong>.</p> <p>When a user logs in a number of things need to happen - the services need to coordinate so that the UI begins to receive messages.</p> <p>Should I...</p> <ul> <li>Have the <strong>User Service</strong> raise a <em>UserLoggedInEvent</em> and have the <strong>Message Service</strong> listen to this event and perform the work required for the user to receive messages?</li> </ul> <p>...or...</p> <ul> <li>Have the <strong>User Service</strong> raise a <em>UserLoggedInEvent</em> BUT then create a command - <em>StartMessageReceivingCommand</em> and explicitly send this to the <strong>Message Service</strong>?</li> </ul> <h2>Question</h2> <p>What are the Pros/Cons of each approach? (cascading events vs. explicit commands). Are there any other options?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload