title: Validation within a asynchronous SAGA pattern - CQRS & DDD
body: <p>Let's consider the flow below:</p>
  
  <ul>
  <li>API client calls [POST] <code>/api/v1/invitation/:InvitationId/confirm</code></li>
  <li>Confirm the invitation within a SAGA</li>
  <li>Eventually raise an <code>InvitationConfirmed</code> event to indicate success</li>
  </ul>
  
  <p>We are some troubles finding a good place to validate the "event" we pass to the SAGA. For instance, we want to make sure that:
  - The specified <code>InvitationId</code> exists
  - The corresponding invitation is not expired or already processed</p>
  
  <p>We tried a couple of things:</p>
  
  <ol>
  <li><p>Fire a command:</p>
  
  <ul>
  <li>Fire a command <code>RequestInvitationConfirmation</code></li>
  <li>Handle <strong>synchronously</strong> this command and return an error if the command is not valid OR otherwise raise the <code>InvitationConfirmationRequested</code> event.</li>
  </ul></li>
  </ol>
  
  <p>The rest of the flow is the same</p>
  
  <p>CONS:
  - Requires us to follow a "request/response" pattern (synchronous within the HTTP request lifetime)</p>
  
  <ol start="2">
  <li><p>Raise an event:</p>
  
  <ul>
  <li>Raise an event <code>InvitationConfirmationRequested</code></li>
  <li>Within the SAGA, query the <code>Invitation</code> service and perform the validations. If the command is not valid, we publish an event <code>InvitationConfirmationFailed</code> 
  (...)</li>
  </ul></li>
  </ol>
  
  <p>CONS:
  - As far as I understand SAGA should be used to orchestrate the flow. Here we are introducing the concept of "validation". I'm not sure it's the recommended approach.</p>
  
  <p>Validation is a very common concept. How would you handle it in a distributed fully asynchronous system?</p>