Sunday, 2 June 2013

Are commands always tasks in DDD?

Are commands always tasks in DDD?

The results of a command can return fast as well as slow. The user waits for an order to complete which should be quick. That is a UI expectation. But in the Domain, is it an expectation? Do a Bounded Context have to wait for another Bounded Context to return a status to immediately return the same status to the client (UI in this example)?
In my opinion, all commands in the Bounded Context of a DDD can be a task. Because it is a task, it is never expected to return immediately. Through this approach, the UI has to poll the status of the order every 15 minutes or so. The UI can't expect the Domain service to return any status immediately.
With this approach, the behaviors of processing an order can be done in many ways. An order which is placed can return the status as success if the inventory available. If there is no inventory, the user is informed that the system is processing the order. When the inventory is available the next day, the order will be placed and the status is returned to the user (as email also).

No comments:

Post a Comment