Per-message event handling
After the basket has received the command to add a product in it, the web application will not yet be updated with the new basket information.
In terms of responsibility, it is correct that a command handler does not update the UI. Instead it has the responsibility of notifying that a product was added into the basket, and that the total and the content have changed.
This is an important concept for evolutional software. Events are a great way of decoupling, not only on actual features, but also with future, hypothetical features. If in future there is a need for another feature depending on how the basket updated, then none of the existing code would be affected as just another worker would be necessary to generate another ...
Get Mastering Cloud Development using Microsoft Azure now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.