Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'd recommend you have a look at the <a href="https://github.com/mspnp/cqrs-journey-doc/" rel="nofollow">Microsoft Patterns &amp; Practices team's guidance on CQRS</a>. Although this is still work-in-progress they have given one solution to the issue you've raised. </p> <p>Their approach for commands requiring feedback is to submit the command asynchronously, redirect to another controller action and then poll the read model for the expected change or a time-out occurs. This is using the Post-Redirect-Get pattern which works better with the browser's forward and back navigation buttons, and gives the infrastructure more time to process the command before the MVC controller starts polling.</p> <p>Example code from the <a href="https://github.com/mspnp/cqrs-journey-code/blob/dev/source/Conference/Conference.Web.Public/Controllers/RegistrationController.cs" rel="nofollow">RegistrationController</a> using ASP.NET MVC 4 asynchronous controllers.</p> <pre><code>[HttpGet] [OutputCache(Duration = 0, NoStore = true)] public Task&lt;ActionResult&gt; SpecifyRegistrantAndPaymentDetails(Guid orderId, int orderVersion) { return this.WaitUntilOrderIsPriced(orderId, orderVersion) .ContinueWith&lt;ActionResult&gt;( ... ); } ... private Task&lt;PricedOrder&gt; WaitUntilOrderIsPriced(Guid orderId, int lastOrderVersion) { return TimerTaskFactory.StartNew&lt;PricedOrder&gt;( () =&gt; this.orderDao.FindPricedOrder(orderId), order =&gt; order != null &amp;&amp; order.OrderVersion &gt; lastOrderVersion, PricedOrderPollPeriodInMilliseconds, DateTime.Now.AddSeconds(PricedOrderWaitTimeoutInSeconds)); } </code></pre> <p>I'd probably use AJAX polling instead of having a blocked web request at the server.</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