Asynchronous Affairs Process The [design] synchronizes on-the-spot processing and returns the results of the processing, asynchronously after the return. How to solve?

Source: Internet
Author: User

For example 1: The money has 100, the couple had agreed to leave 90, the husband saw 100, spend 10 yuan, after the completion of the event asynchronous, inconsistent data, at this time the wife refresh the page also see 100, then spend 10 yuan. That was finally 80 yuan. Does not meet the expectations of the user. How to solve this problem?

See http://www.jdon.com/46473#23145064
Async requires an asynchronous callback. (or implement a notification interface.) rather than a callback to achieve the beauty.) Asynchronous requires event async requires retry mechanism
yesterday consulted the next of our high T.He felt like this: the scene in foreign banks is not common, there are couples cards abroad.
Let's talk about how the asynchronous event framework implementation is consistent.The husband shows 100 yuan, carries on the consumption, the back end transmits the aggregation to follow the objectversion 1, the normal deduction money 10. The objectversion value of the pass aggregation followed by +1 becomes 2.The wife because also shows 100 yuan, carries on the consumption, therefore the recursive aggregation heel's objectversion is also 1, will do the business check before you call the method, because the version objectversion does not match, the wife will get the error. The page refreshes again, showing 90 yuan. The wife will not continue to spend.
Besides, the asynchronous event schema:The husband showed $100 for consumption, and. becomes event 1 stored. Normal returns to the front end. But it's not really money. Instead, let the user know that "the background is processing, please wait".wife because also shows 100 yuan, carries on the consumption, the same becomes the event 2 storage. Normal return to the front end. The same does not pay, inform the user "backstage is processing, please wait".in this case, there are two events generated in the background queue. The order of the above two transactions commits. Overtime Husband Event 1 is first run. Check the aggregation with the objectversion, Success. A new interface informs the front end that the money has been deducted. Wife's event 2 after running, check aggregation followed by objectversion, failed. A new interface informs the front-end that money cannot be deducted and cannot be consumed.Synchronous architecture with asynchronous architecture, the entire business process has changed. You need to add an interface to the new one. Asynchronous event runs can be accidental exception due to network and other reasons. There is a mechanism to retry . Summary: synchronous processes are used asynchronously. It's more complicated for both developers and product managers. for Developers: 1. Save Event 2. Retry mechanism 3. Add a new interface (that is, the callback interface in the asynchronous framework) 4. Inform the product manager that the process has become asynchronousFor the product Manager: The original synchronization process needs to be thought of as multiple processes.
           So who's going to affect who?

          development and product managers are mutually determined.   On the one hand when the product manager is in the user experience perspective, it is possible to proactively split a synchronization process into multiple asynchronous processes. Add steps and Interfaces. This time the developer pits are not willing, due to the added workload.   There is one other aspect developers are in performance, concurrency, and may change a synchronous call to asynchronous for PM thinking. At this time the product manager needs to know that there is a new page to remind the user "background processing", the process has changed.
     CQRS   The domain generated by multiple transactions in the schema event who runs first who runs after?  
Two entities teacher, student 
Transaction 1 generates events, TEACHEREVENT1,STUDENTEVENT1, transaction 2 generates event TeacherEvent2, StudentEvent2.
How these events are logged, and whether you need to bind n domain events and transaction IDs so that they can be run later in a transactional order. To ensure that the overall event succeeds or fails, the overall event transaction is rolled back. To ensure the correctness of the data? The

[asynchronous] [transaction] [process] [design] synchronizes on-the-spot processing and returns the processing result, and then how to return it asynchronously. How to solve?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.