问题描述
前提:
建议在 CQRS + DDD + ES 样式的应用程序中使用基于任务的屏幕,这些屏幕可指导用户并捕获意图。
这些任务屏幕也可以称为归纳用户界面。 UI设计指南的一些示例可以帮助您创建更现代,用户友好的应用程序:
;但要大胆-将从用户收集的数据视为事件(FormSubmitted),而不是命令。脱机设备是跟踪用户离线时所做操作的权限;但是不可用的服务器仍然是那些事件后果的授权者。因此,当客户端重新连接时,服务器负责合并。
确切的详细信息可能因一个域而异,例如在一个仓库系统中,脱机设备一直在收集有关库存的信息,您可以通过引发异常报告来处理服务器在合并期间观察到的不一致情况(该设备将这个包裹注册离开仓库,但我们没有进入仓库的记录)。
Premise:
It is recommended that in CQRS+DDD+ES style applications use task based screens, these screens guide the user and capture intent.
These task screens can also be referred to as Inductive User Interface. Some examples of UI design guidelines that can help you create mondern, user-friendly apps:
Microsoft Inductive User Interface Guidelines and,
The way I understand it, the tasks, generally speaking, should line up with Commands or Functions waiting on the Server.
For example, if the User makes a change to the Customer's [first name], generally speaking this should be an isolated task where a pop-up window or the like provides a mechanism for this event, and this event only.
Questions:
Part-1:
In the situation where the User is not just making a change to a Customer's [first name], but actually creating a new Customer. Surely the User will not go from [first name] => to [last name] => to [address] => to [email], etc. -- in a wizard like style, where each wizard screen maps to a Command.
a) How are the screens laid out when it's just not practical to isolate a single task? For example when creating a new Customer or Inventory Item.
b) What does the code and/or logic flow related to the Commands look like on the Client and Server in this situation, keeping in mind the obvious pull to stay consistent with the "normal" task based flow of the rest of the system? After all, these all just translate to Activities or Events in the Event Source.
Part-2:
What if the User is not just making a change to a Customer's [first name], but their [last name], [address], and [phone number] -- all the while they User is off-line.
I think ultimately, the User should still be able to do real work on multiple tasks in different areas of the application, while off-line, and perform robust conflict resolution when coming back online.
a) What is the code and/or logic flow and/or artifacts related to the Commands on the Client side while the User is off-line while handling these events locally (IndexDb, queues, etc.)? and
b) What does the connection look like and how does it act when off-line (retries)?
c) What is the code and/or logic flow and/or artifacts related to the Commands on the Client and Server side, when the User comes back on-line?
d) What does the connection look like and how does it act when coming back on-line (reestablish of connection, if it is determined that the Client side ViewModel is stale, WebSockets, etc.)?
Reference diagram:
Or sometimes events, but the basic idea is right.
No, we usually want a coarser grain than that. Some tasks do only require a single property, but several properties is a common case.
By grouping together cohesive units; consider the Amazon order workflow -- there are actually several different sets of data collected (the order itself, the selection of payment, specifying new methods of payment, specifying the delivery address, specifying the shipping priority....).
See CQRS, not just for server systems; but in broad strokes - treat the data collected from the user as events (FormSubmitted) rather than commands. The offline device is the authority for tracking what the user did while off line; but the unavailable server is still the authority for the consequences of those events. So the server is responsible for the merge when the client reconnects.
The precise details might vary from one domain to another -- for instance, in a warehousing system, where the offline device has been collecting information about inventory, you might handle the inconsistencies that the server observes during the merge by raising exception reports (the device registered this package leaving the warehouse, but we have no record of it entering the warehouse).
这篇关于偶尔连接的CQRS系统-客户端和服务器命令-基于任务的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!