Resource data updating method and device, electronic equipment and storage medium
By creating an update transaction in the transaction message server and passing the global result type through, the problem of inconsistent resource data updates in the product supply business is solved, the recovery and consistency of resource data is achieved, and the reliability of the business is improved.
Patent Information
- Application Number
- CN202310530317.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2043-05-11
AI Technical Summary
In product supply business, due to inconsistent update results when resource data is updated, various resource data associated with target products are inconsistent, and there is a lack of effective solutions to ensure the consistency of resource data.
By creating update transactions in the transaction message server, the update transactions are sent to the resource server for resource data updates. After receiving the update result, the transaction message server passes through the global result type to ensure that the resource server can receive the failed message for Data recovery to maintain consistency of resource data.
It effectively solves the problem of inconsistency in resource data. Through the characteristics of the transaction message server, the global result type is guaranteed to be received by the resource server, thereby realizing the recovery and consistency of resource data and improving the reliability of product supply services.
Smart Images

Figure CN118939663A_ABST
Abstract
Description
Background Art
[0002] With the rapid development of Internet technology, it has become a new trend for both clients and servers to realize product supply business online. When launching product supply business online, the server displays various products to the client, and after the client selects the target product from various products, it initiates a product acquisition request to the server. The server responds to the product acquisition request and creates the corresponding product supply information. Based on the product supply information, the client provides the corresponding specified resources to the server and can obtain the required target product.
[0003] In the process of executing the above-mentioned product supply business, before creating product supply information, the server will update the resource data associated with the target product in sequence according to the supply quantity of the target product corresponding to the product acquisition request, such as deducting product inventory, deducting deduction vouchers, deducting activity qualifications, and deducting points.
[0004] When a resource data update fails, the subsequent update operations of various resources will not be able to continue. In this case, if there is a resource data update failure during the resource data update process, resulting in both successful and failed resource data updates in various resource data, it will cause inconsistency in various resource data associated with the target product.
[0005] Therefore, there is an urgent need for a resource data update solution that can ensure the consistency between the resource data when updating the resource data bound to the target product. Summary of the invention
[0006] The embodiments of the present application provide a resource data updating method, device, electronic device and storage medium, which are used to solve the problem of inconsistency of resource data caused by inconsistent update results of each resource data when updating each resource data bound to a target product in a product supply business scenario.
[0007] On the one hand, an embodiment of the present application provides a method for updating resource data, the method comprising:
[0008] In response to a product acquisition request triggered for a target product, creating corresponding update transactions in a transaction message server for at least two resource data associated with the target product;
[0009] According to the resource types corresponding to the at least two resource data, the corresponding update transaction is sent to the associated resource server to update the resource data, and at least two update results are returned;
[0010] When there is at least one failed update result indicating an update failure and at least one successful update result indicating an update success in the at least two update results, sending a global result type indicating a resource data update failure to the transaction message server;
[0011] For the at least one successful update result, the following operations are performed respectively: the transaction failure message returned by the transaction message server is sent to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
[0012] On the one hand, an embodiment of the present application provides a resource data updating device, the device comprising:
[0013] A creation module, configured to, in response to a product acquisition request triggered for a target product, create corresponding update transactions in a transaction message server for at least two resource data associated with the target product;
[0014] An update module, configured to send a corresponding update transaction to an associated resource server to update the resource data according to the resource types corresponding to the at least two resource data, and receive at least two returned update results;
[0015] A first forwarding module is used to send a global result type indicating a failure to update resource data to the transaction message server when there is at least one failed update result indicating a failed update and at least one successful update result indicating a successful update among the at least two update results;
[0016] The recovery module is used to perform the following operations for the at least one successful update result: sending the transaction failure message returned by the transaction message server to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
[0017] Optionally, the creation module is specifically used for:
[0018] In response to the product acquisition request triggered for the target product, determining at least two resource data associated with the target product;
[0019] Based on the resource types corresponding to the at least two resource data, update transactions corresponding to the at least two resource data are determined, and corresponding update transactions are respectively created in the transaction message server.
[0020] Optionally, the update module is specifically used for:
[0021] According to the resource types corresponding to the at least two resource data, the corresponding update transactions are sent to the associated resource servers in sequence to update the resource data;
[0022] Whenever an update result returned by a resource server is received, determining whether the update result is a failed update result indicating that the update has failed;
[0023] If so, stop sending the next update transaction to the associated resource server;
[0024] If not, the next update transaction is sent to the associated resource server to update the resource data, and the returned update result is received.
[0025] Optionally, the first forwarding module is specifically used to:
[0026] When there is at least one failed update result indicating that the update failed and at least one successful update result indicating that the update was successful in the at least two update results, determining that the resource data update failed based on the at least one failed update result and the at least one successful update result, and obtaining a global result type indicating that the resource data update failed;
[0027] The global result type is sent to the transaction message server.
[0028] Optionally, the first forwarding module is further used for:
[0029] When receiving the transaction exception message sent by the transaction message server, query the update status of the at least two resource data respectively, and send the query results to the transaction message server; the transaction exception message is sent by the transaction message server when the global result type is not received within a preset time period;
[0030] When the transaction failure message returned by the transaction message server for the query result is received, the transaction failure message is sent to a resource server corresponding to a successful update result.
[0031] Optionally, the device further comprises:
[0032] A second forwarding module, configured to send a global result type indicating successful update of resource data to the transaction message server when the at least two update results are both successful update results;
[0033] The no-operation module is used to perform the following operations respectively for the at least two update results: sending the transaction success message returned by the transaction message server to a resource server corresponding to an update result, so that the resource server performs a no-operation based on the transaction success message.
[0034] Optionally, the device further comprises:
[0035] A return module, configured to return a product supply message to the target object triggering the product acquisition request upon receiving the transaction operation message returned by each resource server; wherein the transaction operation message indicates that the corresponding empty operation of each resource server is successfully executed;
[0036] A confirmation module is used to send a corresponding confirmation transaction to an associated resource server for resource data confirmation according to the resource type corresponding to the at least two resource data after receiving the specified resource provision result provided based on the product supply message; the specified resource provision result is triggered after the target object provides the specified resource based on the product supply information.
[0037] Optionally, the confirmation module is specifically used for:
[0038] According to the resource types corresponding to the at least two resource data, the corresponding confirmation transactions are sent to the associated resource servers in sequence to confirm the resource data, and the returned confirmation results are received;
[0039] When the confirmation result is a successful confirmation result indicating a confirmation failure, each confirmation transaction is resent to the associated resource server for resource data confirmation until each confirmation result is a successful confirmation result indicating a confirmation success.
[0040] On the one hand, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of any one of the above-mentioned resource data updating methods.
[0041] On the one hand, the present application provides a computer-readable storage medium, which includes a program code. When the storage medium is run on an electronic device, the program code is used to enable the electronic device to execute the steps of any one of the above-mentioned resource data updating methods.
[0042] On the one hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; when a processor of an electronic device reads the computer instructions from the computer-readable storage medium, the processor executes the computer instructions, so that the electronic device performs the steps of any one of the above-mentioned resource data updating methods.
[0043] The beneficial effects of this application are as follows:
[0044] The embodiments of the present application provide a resource data update method, device, electronic device and storage medium. When there are both successful update results and failed update results in the update results returned for at least two resource data bound to the target product, the global result type representing the failure of the resource data update is transparently transmitted to the corresponding resource server through the transaction message server, so that the resource server can restore the resource data corresponding to the successful update result. Since the transaction message server has the following characteristics: sending a message through the transaction message server can ensure that the sent message will be received. Therefore, by transparently transmitting the global result type to the corresponding resource server through the transaction message server, it can be ensured that the global result type can be received by the resource server. Compared with sending directly through the product server, transparent transmission through the transaction message server can ensure that the corresponding resource server can receive the global result type when the product server fails, and restore the resource data that has been successfully updated according to the global result type, thereby ensuring the consistency between the resource data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0046] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;
[0047] Figure 2 A flowchart of a resource data updating method provided in an embodiment of the present application;
[0048] Figure 3 A system architecture diagram for executing product supply business provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of an update transaction creation scenario provided in an embodiment of the present application;
[0050] Figure 5A An example diagram of a parallel solution for each update transaction provided in an embodiment of the present application;
[0051] Figure 5B An example diagram of a serial solution for each update transaction provided in an embodiment of the present application;
[0052] Figure 6 An example diagram of a scenario for sending a transaction failure message provided in an embodiment of the present application;
[0053] Figure 7 Another example diagram of a scenario of sending a transaction failure message provided in an embodiment of the present application;
[0054] Figure 8 An example diagram of a scenario in which a transaction success message is sent according to an embodiment of the present application;
[0055] Fig. 9 A schematic diagram of a scenario for confirming the start of a transaction provided in an embodiment of the present application;
[0056] Fig. 10A This is an example diagram of a normal ordering scenario provided in an embodiment of the present application;
[0057] Fig. 10B An example diagram of resource data changes provided in an embodiment of the present application;
[0058] Fig. 10C A detailed example diagram of a normal order placement process provided in an embodiment of the present application;
[0059] Fig.11A An example diagram of an abnormal ordering scenario provided in an embodiment of the present application;
[0060] Fig. 11B Another example diagram of resource data changes provided in an embodiment of the present application;
[0061] Fig. 11C A detailed example diagram of an abnormal order placement process provided in an embodiment of the present application;
[0062] Fig. 12A An example diagram of an abnormal ordering scenario provided in an embodiment of the present application;
[0063] Fig. 12B A detailed example diagram of another abnormal order placement process provided in an embodiment of the present application;
[0064] Fig.13 An example diagram of a payment process provided in an embodiment of the present application;
[0065] Fig.14 A schematic diagram of the structure of a resource data updating device provided in an embodiment of the present application;
[0066] Fig.15 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0068] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.
[0069] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0070] Transaction: A transaction is a program execution unit that updates resource data. It consists of all operations performed between the start and end of a transaction, such as resource data deduction transactions and resource data recovery transactions. Among them, resource data deduction transactions can deduct inventory data, deduction voucher data, deduction activity qualification data, and deduction points data. Similarly, resource data recovery transactions can restore inventory data, restore deduction voucher data, restore activity qualification data, and deduction points data.
[0071] Resources: A general term for materials, energy and information that can be developed and utilized. In the embodiment of the present application, resources are information that is associated with the target product, such as inventory, discount vouchers, activity qualifications, points, etc. Among them, discount vouchers can be coupons in e-commerce scenarios, or lists of winners, etc. In the specific use process, points can also be classified as discount vouchers.
[0072] Resource data recovery: restore resource data to the state before the update. For example, when the resource server executes an update transaction, it updates the inventory resources from 100 to 50, so resource data recovery means adjusting the inventory resources from 50 to 100.
[0073] Transactional message server features: A notifying B can be defined as a message, which can be broken down into two steps: A sends a message + B receives the message. However, in the actual process, there may be a situation where A sends a message but B does not receive it. The transactional message server is used to solve this problem, ensuring that after A sends a message, B will definitely receive the message. This is the feature of the transactional message server.
[0074] The following is a brief introduction to the design concept of the embodiment of the present application:
[0075] In the process of executing the above-mentioned product supply business, before creating product supply information, the server will update the resource data associated with the target product in sequence according to the supply quantity of the target product corresponding to the product acquisition request, such as deducting product inventory, deducting deduction vouchers, deducting activity qualifications, and deducting points.
[0076] When a resource data update fails, the subsequent update operations of various resources will not be able to continue. In this case, if there is a resource data update failure during the resource data update process, resulting in both successful and failed resource data updates in various resource data, it will cause inconsistency in various resource data associated with the target product.
[0077] Therefore, there is an urgent need for a resource data update solution that can ensure the consistency between the resource data when updating the resource data bound to the target product.
[0078] In view of this, an embodiment of the present application provides a resource data update method, device, electronic device and storage medium. In response to a product acquisition request triggered for a target product, a product server creates corresponding update transactions in a transaction message server for each resource data associated with the target product, and registers each update transaction in the transaction message server. Then, the product server sends the corresponding update transaction to the associated resource server to update the resource data according to the resource type of each resource data, and receives the returned update result. When there is at least one failed update result representing a failed update and at least one successful update result representing a successful update in each update result, the global result type representing the failed resource data update is sent to the transaction message server. In this way, it is helpful to forward the global result type through the transaction message server, thereby ensuring that the forwarded transaction message is necessarily received.
[0079] Furthermore, for at least one successful update result, the following operations are performed respectively: the transaction failure message returned by the transaction message server is sent to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message. In this way, through the transaction failure message returned by the transaction message server, it can be ensured that each resource server can receive the global result type. Furthermore, each resource server can perform resource data recovery for at least one successful update result based on the obtained transaction failure message, thereby ensuring the consistency of each resource data corresponding to the target product.
[0080] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.
[0081] like Figure 1 As shown, a schematic diagram of an application scenario provided by an embodiment of the present application is shown. In the schematic diagram of the application scenario, a server cluster 101, a transaction message server 102, a terminal device 103, and a product server 104 are included; wherein the server cluster 101, the transaction message server 102, the terminal device 103, and the product server 104 communicate with each other through a communication network.
[0082] The server cluster 101 includes multiple resource servers, which are used to update the resource data bound to the target product or restore the resource data when processing the product supply business. Each resource server can be an independent server, including a microserver, or an edge server in the field of cloud computing, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, cloud functions, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. These resource servers can be set up separately or in an integrated manner.
[0083] The transaction message server 102 is used to send the global result type representing the failure of resource data update to each resource server based on the transaction message server feature: the message sent by the transaction message server must be received, so as to ensure that each resource server can receive the global result type, and based on the global result type, restore the resource data of the successfully updated resource data, so as to maintain the consistency between each resource data. The specific type of the transaction message server 102 can refer to the resource server, which will not be repeated here.
[0084] The terminal device 103 is used to initiate a product acquisition request to the product server 104. The product server 104 creates product supply information based on the product acquisition request and acts as a transaction coordination server between each resource server and the transaction message server 102. That is, the resource data processing information sent by each resource server to the transaction message server 102 and the transaction message sent by each transaction message server 102 to each resource server need to be coordinated by the product server 104. The specific type of the transaction message server 102 can refer to the resource server and will not be repeated here.
[0085] The number of the above-mentioned server clusters 101, transaction message servers 102, terminal devices 103 and product servers 104 is not limited here.
[0086] It should be noted that the resource data update method in the embodiment of the present application can be executed by the product server 104 alone, or can be executed by the product server 104 together with the server cluster 101, the transaction message server 102, and the terminal device 103. When the method is executed by the product server 104 together with the server cluster 101, the transaction message server 102, and the terminal device 103, the target object initiates a product acquisition request to the product server 104 through the terminal device 103 for the target product, and the product server 104 responds to the product acquisition request and creates a corresponding update transaction in the request to the transaction message server 102 for at least two resource data associated with the target product.
[0087] Further, the product server 104 sends the corresponding update transaction to the associated resource server to update the resource data according to the resource type corresponding to the at least two resource data, and the at least two resource servers return at least two update results to the product server. When there is at least one failed update result indicating the failure of the update and at least one successful update result indicating the success of the update in the at least two update results, the product server 104 sends the global result type indicating the failure of the resource data update to the transaction message server 102. At this time, the transaction message server 102 returns a transaction failure message to the product server 104 in response to the received information. In response to receiving the transaction failure message, the product server 104 performs the following operations respectively for at least one successful update result: sending the transaction failure message to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
[0088] The resource data updating method provided by the exemplary embodiment of the present application is described below in combination with the above-mentioned application scenarios with reference to the accompanying drawings. It should be noted that the above-mentioned application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this regard.
[0089] refer to Figure 2 , is an implementation flow chart of a resource data update method provided in an embodiment of the present application. Here, the product server is used as the execution subject for introduction. The specific implementation process of the method is as follows:
[0090] S201, in response to a product acquisition request triggered for a target product, creating corresponding update transactions in a transaction message server for at least two resource data associated with the target product;
[0091] In the embodiment of the present application, a system architecture diagram for executing a product supply business can be referred to as Figure 3 .exist Figure 3 There are four layers in the product supply layer, namely: business layer, business logic layer, basic service layer and storage layer. Based on these four layers, various transactions related to product supply business can be executed.
[0092] Among them, the business layer is a product supply business scenario encapsulated based on the logical functions of the business logic layer, including personal computers (PC), HTML5 (H5 for short) pages, applets, or applications (APP), etc. In the product supply business, the business layer serves as an interface for the target object to start the product supply business. For example, the target object can browse the various products provided by the product server through the APP, and after selecting the target product from the various products, the product supply business can be started and product supply information can be created. Of course, the target object can also start the product supply business through H5 pages, applets, PC terminals, etc., which are not specifically limited here.
[0093] The business logic layer includes product servers, transaction message servers, and resource exchange servers. Through the information interaction between the product server and the transaction message server, product supply information can be created; through the information interaction between the product server and the resource exchange server, the target product can be provided to the target object, and the specified resources provided by the target object can be obtained.
[0094] Among them, when creating product supply information, the product server can also mobilize various resource servers in the basic service layer to complete the update of various resource data bound to the target product, and pass the global result type of the various resource data updates to each resource server through the transaction message server, so that each resource server can execute the corresponding transaction based on the global result type, including: if the global result type is obtained when there are failed update results and successful update results in the update results of each resource data, then the resource data corresponding to the successful update result is restored; if the global result type is obtained when all update results are successful update results, or there is no successful update result, then a no operation is performed.
[0095] The basic service layer is composed of resource servers 1 to N, where the value of N is greater than or equal to the number of types of resources bound to the target product. For example, when the various resources bound to the target product are: product inventory, discount vouchers, activity qualifications, and points, there are 4 types of resources. At this time, the value of N is greater than or equal to 4. Different types of resource data are updated or restored by different resource servers. Each resource server here can be a microserver, which is used to provide support for the upstream business logic layer.
[0096] The storage layer is used to store the resource data bound to the target product. Different types of resource data are stored in different databases to achieve one-to-one storage between the database and the upstream basic service layer.
[0097] Based on the system architecture for implementing the above-mentioned product supply business, when executing the product supply business, it is generally necessary to go through the following process: the target object sends a product acquisition request to the product server for the target product, the product server responds to the product acquisition request, creates product supply information for the target product, and after the target object provides the corresponding designated resources based on the product supply information, the target product can be obtained.
[0098] When creating product supply information, each resource server needs to update the data of each resource associated with the target product, such as deducting product inventory, deducting deduction vouchers, deducting activity qualifications, and deducting points. If all resource data are updated successfully, the product supply information will be successfully created. At this time, the consistency between the resource data can also be maintained.
[0099] On the contrary, if there are resource data that fail to be updated in each resource data, the creation of product supply information will fail, which will lead to inconsistency between resource data. For example, the resource data associated with the target product are: product inventory quantity 100, deduction voucher quantity 100, activity qualification 100 times, and points 100. When deducting each resource data, the deduction quantity is 1 each time. If only the product inventory and deduction voucher are successfully deducted, then the resource data will become: product inventory quantity 99, deduction voucher quantity 99, activity qualification 100 times, and points 100. At this time, the various resource data are not unified, which is not conducive to the management of product information.
[0100] In the embodiment of the present application, the system architecture based on the above-mentioned product supply business implementation can solve the problem of inconsistent resource data when creating product information.
[0101] Before creating product information, the product server needs to request the transaction message server to create an update transaction for at least two resource data. Figure 4 The figure shows a schematic diagram of an update transaction creation scenario, which specifically includes the following steps:
[0102] Step 401: In response to a product acquisition request triggered for a target product, at least two resource data associated with the target product are determined, wherein different types of resource data are stored in different databases, and the resource type associated with each product is also set in advance by the product server;
[0103] Step 402: Based on the resource types corresponding to the at least two resource data, determining the update transactions corresponding to the at least two resource data, for example, when the at least two resource types are product inventory, deduction voucher, activity qualification and points, it can be determined that the update transactions are: deduction of product inventory, deduction of deduction voucher, deduction of activity qualification and deduction of points;
[0104] Step 403: In the transaction message server, corresponding update transactions are created respectively.
[0105] By creating a corresponding update transaction in the transaction message server, the global transaction identifier set by the transaction message server for all update transactions can be obtained, based on which the update time corresponding to different products can be distinguished.
[0106] S202, according to the resource types corresponding to the at least two resource data, sending the corresponding update transaction to the associated resource server to update the resource data, and receiving at least two returned update results;
[0107] In an embodiment of the present application, after creating a corresponding update transaction in the transaction message server, further, according to the resource type corresponding to the at least two resource data, at least two update transactions are sent to the associated resource server to update the resource data, and at least two update results are received back.
[0108] For example, when at least two resource types are product inventory, deduction voucher, activity qualification, and points, at least two update transactions are sent to the inventory server, deduction voucher server, activity qualification server, and points server, which are all resource servers. The inventory server is used to deduct product inventory; the deduction voucher server is used to deduct deduction vouchers; the activity qualification server is used to deduct activity qualifications; and the points server is used to deduct points. Then, the update results of each resource server for resource data are received.
[0109] In the above process, at least two update transactions are sent to the associated resource server to update resource data, and at least two update results are received back. There are two implementation schemes:
[0110] Solution 1: Parallel solution.
[0111] The product server sends at least two update tasks to the corresponding resource server at the same time, so that the corresponding resource server updates the resource data. In this way, at least two update transactions are processed in parallel by the corresponding resource servers. Therefore, when each resource server updates, it does not affect each other, and each resource server can generate the corresponding update results.
[0112] For example, refer to Figure 5A , is an example diagram of a parallel solution for each update transaction. Figure 5A In the figure, the product server sends four update transactions to four independent resource servers at time t1, and receives update results returned by the four resource servers at times t2, t3, t4, and t5, respectively. The number of update results is consistent with the number of update transactions, and the update result received at time t4 among the four update results is a failed update result indicating a failure to update the resource data.
[0113] Solution 2: Serial solution.
[0114] The product server sends at least two update transactions to the associated resource server in sequence according to the resource types corresponding to the at least two resource data to update the resource data; each time an update result returned by a resource server is received, it is determined whether the update result is a failed update result indicating an update failure; if so, the next update transaction is stopped from being sent to the associated resource server; if not, the next update transaction is continued to be sent to the associated resource server to update the resource data and the returned update result is received.
[0115] For example, refer to Figure 5B , is an example diagram of a serial solution for each update transaction. Figure 5B In the example, the product server sends update transaction 1 to resource server 1 at time T1, and after receiving the successful update result returned by resource server 1 indicating that the resource data was successfully updated, it sends update transaction 2 to resource server 2 at time T2, and receives the successful update result returned by resource server 2. Further, after sending update transaction 3 to resource server 3 at time T3, it receives the failed update result returned by resource server 3. At this point, the product server will no longer send the subsequent update transaction 4 to resource server 4.
[0116] The following is a comparative analysis of Scheme 1 and Scheme 2:
[0117] If you follow the plan 1, then refer to Figure 5A, resource server 3 returns a failed update result, while resource servers 1, 2, and 4 return successful update results. At this time, since there is a failure to update resource data, the resource data are inconsistent. Therefore, it is necessary to restore the resource data corresponding to each successful update result, that is, the resource data that needs to be restored is the resource data updated by resource servers 1, 2, and 4 respectively.
[0118] However, if you follow option 2, then refer to Figure 5B When the update result returned by resource server 3 is a failed update result, resource server 4 no longer executes the data update transaction. At this time, due to the failure of resource data update, the four resource data are inconsistent. Therefore, it is necessary to restore the resource data corresponding to each successful update result, that is, the resource data that needs to be restored is the resource data updated by resource servers 1 and 2 respectively.
[0119] As can be seen from the above, the resource data that needs to be restored in Solution 2 is less than the resource data that needs to be restored in Solution 1. Especially when the failed update result is returned at an early time, Solution 2 can obviously save data processing. Therefore, Solution 2 is selected as the preferred solution.
[0120] In the above process, each resource data bound to the product information is updated separately through different resource servers. Compared with using a single server, it not only has stronger data processing capabilities and can be applied to a larger number of scenarios for product supply business processing, but also because the update transactions of various resource data are independent of each other, when adding or adjusting update transactions, there is no need to adjust the processing logic of other update transactions, which is helpful for maintaining the product supply business.
[0121] S203, when there is at least one failed update result indicating an update failure and at least one successful update result indicating a successful update among the at least two update results, sending a global result type indicating a resource data update failure to a transaction message server;
[0122] In the embodiment of the present application, after obtaining the update results returned by at least two resource servers respectively, different processing schemes are adopted based on different result types in the at least two update results, including:
[0123] When there is at least one failed update result indicating an update failure and at least one successful update result indicating an update success in at least two update results, based on the at least one failed update result and the at least one successful update result, it is determined that the resource data update has failed, and a global result type indicating the resource data update has failed is obtained.
[0124] For example, in Figure 5AThere are 3 successful update results and 1 failed update result in Figure 5B There are 2 successful update results and 1 failed update result. As long as there is a failed update result, the resource data update for the target product is a failure for the global update result. Therefore, Figure 5A as well as Figure 5B The global result types in are all global result types that represent resource data update failures.
[0125] Further, a global result type indicating that the resource data update has failed is sent to the transaction message server.
[0126] It should be noted that the global result type representing the failure of resource data update is sent to the transaction message server here in order to utilize the characteristics of the transaction message server: A notifying B can be defined as a message, which can be broken down into two steps: A sending a message and B receiving a message. However, in the actual process, there may be a situation where A sends a message but B does not receive the message. The transaction message server is designed to solve such problems and ensure that B will receive the message after A sends the message. Based on this characteristic, the transaction message server can ensure that each resource server will receive the received information when sending it to the corresponding resource servers for data recovery, thereby ensuring the consistency of data resources.
[0127] As a comparison scheme, if the product server, upon receiving the global result type representing the failure to update resource data and the transaction identifier corresponding to at least one successful update result, directly sends the global result type representing the failure to update resource data to the corresponding resource server according to the transaction identifier corresponding to at least one successful update result, then when the product server fails, it cannot be ensured that the corresponding resource server will definitely receive the global result type representing the failure to update resource data, and further cannot ensure that data recovery can be performed for the successfully updated resource data, resulting in inconsistencies between the resource data.
[0128] From the above, it can be seen that in the embodiment of the present application, the global result type representing the failure of resource data update is sent to the transaction message server, and the timeout reverse check mechanism of the message server is used to help ensure the consistency between various resource data in the event of a product server failure.
[0129] S204, for at least one successful update result, perform the following operations respectively: send the transaction failure message returned by the transaction message server to a resource server corresponding to a successful update structure, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
[0130] In the embodiment of the present application, after receiving the global update result indicating the failure of resource data update, the transaction message server returns a transaction failure message to the resource server corresponding to at least one successful update result obtained based on the received information. When returning the transaction failure message, since the product server serves as the transaction coordinator in the embodiment of the present application, the transaction message server needs to first return the transaction failure message to the product server, and then return it to the corresponding resource server through the product server, so that the corresponding resource server can perform data recovery, thereby ensuring the consistency between the resource data.
[0131] For example, refer to Figure 6 , is an example diagram of a scenario in which a transaction failure message is sent. Figure 6 In the example, there are three resource servers, namely resource server 1, resource server 2 and resource server 3. After executing update transactions for resource data, resource server 1 and resource server 2 send successful update results to the product server, while resource server 3 sends a failed update result to the product server. At this time, the product server sends a global result type representing the failure of resource data update to the transaction message server based on the two successful update results and one failed update result received. The transaction message server returns a transaction failure message to the product server in response to the received global result type. After receiving the transaction failure message, the product server sends the transaction failure message to the corresponding resource server based on the unique identifiers corresponding to the two successful update results, so that resource server 1 and resource server 2 can perform resource data recovery on the corresponding resource data based on the received transaction failure message.
[0132] In a possible embodiment, if the product server does not send a global result type to the transaction message server within a preset time period after receiving the update result returned by each resource server, then in order to maintain the real-time consistency of each resource data, the transaction message server will return a transaction exception message to the product server. When the product server receives the transaction exception message sent by the transaction message server, it queries the update status of each resource data respectively, where the update status includes update success or update failure, and sends the query result to the transaction message server. When receiving the transaction failure message returned by the transaction message server for the query result, the transaction failure message is sent to at least one resource server corresponding to the successful update result, so that the corresponding resource server can restore the successfully updated resource data.
[0133] For example, refer to Figure 7 , is another example diagram of a scenario where a transaction failure message is sent. Figure 7In the example, there are three resource servers, namely resource server 1, resource server 2 and resource server 3. After executing the update transaction for resource data, resource server 1 and resource server 2 send successful update results to the product server, while resource server 3 sends a failed update result to the product server. At this time, the product server should send a global result type indicating the failure of resource data update to the transaction message server within a preset time period based on the two successful update results and one failed update result received, but the product server sends a timeout.
[0134] At this time, if the transaction message server does not receive any feedback message from the product server within the preset time period, it will send a transaction exception message to the product server. After receiving the transaction exception message, the product server will query the update status of each resource data and send the query result to the transaction message server, where the query result at least includes a global result type that indicates a failure to update the resource data. The transaction message server returns a transaction failure message to the product server for the received global result type, and the product server sends the received transaction failure message to the corresponding resource server 1 and resource server 2 respectively. After receiving the transaction failure message, resource server 1 and resource server 2 perform resource data recovery operations on the previously updated resource data to maintain the consistency of each resource data.
[0135] It should be noted that during the implementation of the resource data update method, in order to ensure that the global update transactions targeted by the transaction message server and the product server are consistent when information is exchanged, when the product server requests the transaction message server to create each update transaction, the transaction message server will set a global transaction identifier for each update transaction. Based on this, when the product server and the transaction message server exchange information, the information sent to each other will carry the global transaction identifier.
[0136] Similarly, during the interaction between the product server and each resource server, in order to ensure that the product server can send the information corresponding to each update transaction to the corresponding resource server, the product server will assign a corresponding unique identifier to each update transaction and associate the unique identifier with the corresponding resource server. For example, when updating inventory data, the product server assigns a unique identifier to the inventory update transaction and also associates the unique identifier with the inventory server.
[0137] In addition, the resource data update method is a resource data update method that ensures consistency between resource data when there is at least one failed update result indicating a failed update and at least one successful update result indicating a successful update in the update results of each resource data. In a possible application scenario, if at least one failed update result obtained by the product server is caused by an alarm message when the network is delayed or the inventory is insufficient, then the resource data corresponding to the failed update result has actually been successfully updated, and therefore data recovery is also required.
[0138] In a possible embodiment, if the update results of each resource data are all successful update results indicating successful update, in this case, the product server sends the global result type indicating successful update of the resource data to the transaction message server, and performs the following operations for each update result: Send the transaction success message returned by the transaction message server to a resource server corresponding to an update result, so that the resource server performs a no-operation based on the transaction success message.
[0139] For example, refer to Figure 8 , is an example diagram of a scenario in which a transaction success message is sent. Figure 8 In the example, there are three resource servers, namely resource server 1, resource server 2 and resource server 3. When executing data update transactions for each resource data, the update results obtained by these three servers are all successful update results indicating successful updates. After resource servers 1, 2 and 3 send each successful update result to the product server respectively, the product server sends the global result type indicating successful resource update to the transaction message server after receiving each update result. After receiving the global result type, the transaction message server returns a transaction success message to the product server. After receiving the transaction success message, the product server sends the transaction success message to resource server 1, resource server 2 and resource server 3 respectively. After receiving the transaction success message, these three servers perform no operations respectively.
[0140] After each resource server executes the empty operation respectively, it indicates that each resource server's update transaction for resource data has been successfully updated. At this time, each resource server returns a transaction operation message to the product server, wherein the transaction operation message indicates that each resource server's empty operation has been successfully executed. When the product server receives the transaction operation message returned by each resource server, it returns a product supply message to the target object that triggers the product acquisition request, wherein the product supply information includes the target product ID information, the product supply protocol ID, and the target object ID, etc. Based on the product supply information, the target object provides the specified resource to the resource exchange server, and then returns the specified resource provision result to the product server. After receiving the specified resource provision result, the product server sends the corresponding confirmation transaction to the associated resource server for resource data confirmation according to the resource type of each resource data.
[0141] For example, refer to Fig. 9 , is a schematic diagram of a scenario for confirming the start of a transaction. Fig. 9 In the example, resource server 1, resource server 2, and resource server 3 respectively send transaction operation information to the product server, indicating that a null operation is performed on each successfully updated resource data. After receiving each transaction operation information, the product server sends product supply information to the target object. After providing the specified resource, the target object returns the specified resource provision result to the product server, and the product server, in response to the specified resource provision result, sends confirmation transactions for confirming the resource data to resource servers 1, 2, and 3 respectively.
[0142] In the above process, when confirming resource data, there are also two implementation plans.
[0143] Solution 1: Parallel solution.
[0144] The product server sends the resource type of each resource data to the respective associated resource servers for data confirmation, and receives the confirmation results returned by each resource server.
[0145] Solution 2: Serial solution
[0146] The product server sends corresponding confirmation transactions to the associated resource servers for resource data confirmation in accordance with the resource types of each resource data, receives the returned confirmation results, and when the confirmation results are successful confirmation results indicating confirmation failure, resends each confirmation transaction to the associated resource server for resource data confirmation until each confirmation result is a successful confirmation result indicating successful confirmation.
[0147] Now let's compare and analyze the advantages and disadvantages of Option 1 and Option 2:
[0148] For solution one, it is possible to quickly find out which resource data has not been confirmed successfully, which can save time, but it requires the participation of all resource servers and increases the amount of data processing. For solution two, it is only necessary to confirm each resource data one by one, and when it is found that the resource data has not been confirmed successfully, stop the subsequent confirmation transaction. Compared with solution one, each confirmation only requires one resource server to participate, and the amount of data processing is small, but it cannot quickly find the resource data that failed to be confirmed.
[0149] Since both Scheme 1 and Scheme 2 have their own advantages and disadvantages, the corresponding resource data confirmation scheme can be selected according to the actual situation.
[0150] In summary, the embodiments of the present application provide a resource data update method, device, electronic device, and storage medium. When there are both successful update results and failed update results in the update results returned by independent resource servers for each resource data bound to a target product, the global result type representing the failure of resource data update is transparently transmitted to the corresponding resource server through the transaction message server, so that the resource server restores the resource data corresponding to the successful update result, thereby ensuring the consistency between the resource data.
[0151] On the one hand, by using different resource servers to update the resource data bound to the product information, compared with using a single server, not only is the data processing capability stronger, it can be applied to a larger number of scenarios for product supply business processing, but also because the update transactions of various resource data are independent of each other, when adding or adjusting update transactions, there is no need to adjust the processing logic of other update transactions, which helps to maintain the product supply business.
[0152] On the one hand, in the event of a failure to update resource data, based on the transaction message transaction server and product server, the transaction failure information can be obtained in a timely manner and sent to the corresponding resource server for data recovery, thereby ensuring the real-time consistency of each resource data.
[0153] On the one hand, due to the characteristics of the transactional message server, it can be guaranteed that the sent message will be received. Therefore, by transparently transmitting the global result type to the corresponding resource server through the transactional message server, it can be guaranteed that the global result type can be received by the resource server. Compared with sending directly through the product server, transparent transmission through the transactional message server can ensure that the corresponding resource server can receive the global result type when the product server fails, and restore the successfully updated resource data according to the global result type, thereby ensuring the consistency of each resource data and high reliability.
[0154] Based on the above embodiment, a specific e-commerce scenario is used below to elaborate on the resource data updating method in the embodiment of the present application. In the e-commerce scenario, if the target object wants to obtain the target product, it must go through the following two processes, one is the order process, and the other is the payment process.
[0155] Process 1: Order process.
[0156] The ordering process includes three situations: normal ordering and abnormal ordering.
[0157] refer to Fig. 10A , is an example of a normal ordering scenario. Fig. 10A In the process, the target object requests the product server to obtain the target product. In response to receiving the product acquisition request, the product server notifies the coupon server and the inventory server in turn to update the product, and both receive a successful update result indicating a successful update. Then, the product server notifies the transaction message server of the message type of global update success. In response to receiving the message type of global update success, the transaction message server notifies the inventory server and the coupon server through the product server to perform a no-op. In this process, the example diagram of the resource data changes associated with the target product can be referred to Fig. 10B .
[0158] refer to Fig. 10C , then Fig. 10A The following is a detailed example of a normal order placement process. Fig. 10C In the process, the target object initiates an order request (a product acquisition request) to the product server through the terminal device. After receiving the order request, the product server notifies the order server to create order information. The order information created at this time is invisible to the target object and cannot be used for payment. Further, the product server requests the transaction message server to register a distributed transaction, including coupon pre-deduction and inventory pre-deduction. After receiving the registration request, the transaction message server returns a distributed transaction ID to the product server. In response to the received distributed transaction ID, the product server notifies the coupon server and the inventory server in turn, and each executes the coupon pre-deduction transaction and the inventory pre-deduction transaction, and after the execution is completed, modifies the previously created order information so that the target object can make payments based on the order information.
[0159] Furthermore, the product server sends the global result type (commit) of the above coupon pre-deduction transaction and inventory pre-deduction transaction, carrying the distributed transaction ID, to the transaction message server, and sends the order information to the target object. After receiving the global result type, the transaction message server delivers a slave transaction message to the product server, so that the coupon server and the inventory server perform no operation.
[0160] refer to Fig.11A , is an example diagram of an abnormal ordering scenario. Fig.11A In the example, the target object requests the product server to obtain the target product. In response to receiving the product acquisition request, the product server notifies the coupon server and the inventory server in turn to update the product. The inventory server fails to update the resource data. Then, the product server notifies the transaction message server of the message type of global update failure. In response to receiving the message type of global update failure, the transaction message server notifies the coupon server through the product server to perform a no operation. In this process, the example diagram of the resource data changes associated with the target product can be referred to Fig. 11B .
[0161] refer to Fig. 11C , is a detailed example diagram of an abnormal order process. Fig. 11C In the example, after receiving the distributed transaction ID returned by the transaction message server, the product server calls the coupon server and the inventory server respectively to perform coupon pre-deduction and inventory pre-deduction in turn. However, the inventory server fails to execute the inventory pre-deduction transaction. At this time, the product server returns the global result type (rollback) to the transaction message server. Based on the received global result type (rollback), the transaction message server delivers a slave transaction message to the product server, thereby triggering the coupon server to execute the coupon data recovery transaction, and triggering the inventory server to execute the inventory data recovery transaction.
[0162] refer to Fig. 12A This is an example diagram of an abnormal ordering scenario. Fig. 12A In the example, the target object requests the product server to obtain the target product. In response to receiving the product acquisition request, the product server notifies the coupon server and the inventory server to update the product in turn. The inventory server fails to update the resource data, and the product server times out and sends a message type of global update failure to the transaction message server. At this time, the transaction message server actively requests the product server to query the inventory and coupon update status, and based on the received results, notifies the coupon server to restore the data through the product server. In this process, you can refer to the example diagram of the resource data changes associated with the target product. Fig. 11B .
[0163] refer to Fig. 12B , is a detailed example diagram of another abnormal order process. Fig. 12BIn the example, after the inventory server fails to execute the inventory pre-deduction transaction, the product server does not return the global result type (rollback) carrying the distributed transaction ID to the transaction message server within the preset time. Therefore, the transaction message server initiates a timeout reverse query request to the product server. After receiving the timeout reverse query request, the product server queries the order information and the pre-deduction status of the coupon and inventory, and returns the query result to the transaction message server. The transaction message server, based on the query result, delivers a slave transaction message to the product server so that the product server notifies the coupon server to perform the coupon data recovery operation. At this time, if the failure of the inventory pre-deduction is caused by network delay or other reasons, since the inventory data has actually been pre-deducted, it is also necessary to notify the inventory server to perform the inventory data recovery operation.
[0164] Process 2: Payment process.
[0165] refer to Fig.13 , is a payment process example diagram. Fig.13 In the process, after the target object pays the corresponding designated resources through the resource exchange server based on the order information, the payment result will be returned to the product server. After that, the product server will call the coupon server, inventory server, and order server in a preset order to execute the corresponding coupon deduction transaction, inventory deduction transaction, or order information modification transaction. Among them, when the inventory server executes the deduction transaction on the inventory data, the transaction execution fails, and the product server returns the failure result to the resource exchange server, and notifies the corresponding server again to execute the corresponding coupon deduction transaction, inventory deduction transaction, or order information modification transaction. In this process, the order information modification transaction fails to execute, so it is necessary to call back each transaction again until the coupon deduction transaction, inventory deduction transaction, or order information modification transaction are all executed successfully.
[0166] Based on the same inventive concept, the embodiment of the present application also provides a resource data updating device. Fig.14 FIG. 1 is a schematic diagram of the structure of a resource data updating device, which may include:
[0167] A creation module 1401 is used to create corresponding update transactions in a transaction message server for at least two resource data associated with the target product in response to a product acquisition request triggered for the target product;
[0168] An updating module 1402 is used to send a corresponding update transaction to an associated resource server to update the resource data according to the resource type corresponding to the at least two resource data, and receive at least two returned update results;
[0169] The first forwarding module 1403 is configured to send a global result type indicating a failure to update resource data to a transaction message server when there is at least one failed update result indicating a failed update and at least one successful update result indicating a successful update among the at least two update results;
[0170] The recovery module 1404 is used to perform the following operations for at least one successful update result: send the transaction failure message returned by the transaction message server to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
[0171] Optionally, the creation module 1401 is specifically used for:
[0172] In response to a product acquisition request triggered for a target product, determining at least two resource data associated with the target product;
[0173] Based on the resource types corresponding to the at least two resource data, update transactions corresponding to the at least two resource data are determined, and corresponding update transactions are respectively created in the transaction message server.
[0174] Optionally, the updating module 1402 is specifically used for:
[0175] According to the resource types corresponding to the at least two resource data, the corresponding update transactions are sent to the associated resource servers in sequence to update the resource data;
[0176] Whenever an update result returned by the resource server is received, determining whether the update result is a failed update result indicating that the update has failed;
[0177] If so, stop sending the next update transaction to the associated resource server;
[0178] If not, the next update transaction is sent to the associated resource server to update the resource data, and the returned update result is received.
[0179] Optionally, the first forwarding module 1403 is specifically configured to:
[0180] When there is at least one failed update result indicating that the update failed and at least one successful update result indicating that the update was successful in the at least two update results, determining that the resource data update failed based on the at least one failed update result and the at least one successful update result, and obtaining a global result type indicating that the resource data update failed;
[0181] Send the global result type to the transaction message server.
[0182] Optionally, the first forwarding module 1403 is further configured to:
[0183] When receiving a transaction exception message sent by the transaction message server, query the update status of at least two resource data respectively, and send the query results to the transaction message server; the transaction exception message is sent by the transaction message server when the global result type is not received within a preset time period;
[0184] When receiving a transaction failure message returned by the transaction message server for the query result, the transaction failure message is sent to a resource server corresponding to a successful update result.
[0185] Optionally, the device further comprises:
[0186] A second forwarding module is used to send a global result type representing a successful update of resource data to a transaction message server when at least two update results are successful update results;
[0187] The no-operation module is used to perform the following operations respectively for at least two update results: sending the transaction success message returned by the transaction message server to a resource server corresponding to an update result, so that a resource server performs a no-operation based on the transaction success message.
[0188] Optionally, the device further comprises:
[0189] The return module is used to return a product supply message to the target object that triggers the product acquisition request when receiving the transaction operation message returned by each resource server; wherein the transaction operation message indicates that the corresponding empty operation of each resource server is successfully executed;
[0190] The confirmation module is used to send the corresponding confirmation transaction to the associated resource server for resource data confirmation according to the resource type corresponding to each resource data after receiving the designated resource provision result provided based on the product provision message; the designated resource provision result is issued by the target object after providing the designated resource based on the product provision information.
[0191] Optionally, the confirmation module is specifically used to:
[0192] According to the resource types corresponding to the at least two resource data, the corresponding confirmation transactions are sent to the associated resource servers in sequence to confirm the resource data, and the returned confirmation results are received;
[0193] When the confirmation result is a successful confirmation result indicating a confirmation failure, each confirmation transaction is resent to the associated resource server for resource data confirmation until each confirmation result is a successful confirmation result indicating a confirmation success.
[0194] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.
[0195] In some possible implementations, the resource data updating device according to the present application may include at least a processor and a memory. The memory stores program code, and when the program code is executed by the processor, the processor executes the steps of the resource data updating method according to various exemplary implementations of the present application described in this specification. For example, the processor may execute the following steps: Figure 2 Follow the steps shown in .
[0196] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. In one embodiment, the electronic device may be a server. In this embodiment, the structure of the electronic device may be as follows: Fig.15 As shown, it includes a memory 1501 , a communication module 1503 and one or more processors 1502 .
[0197] The memory 1501 is used to store computer programs executed by the processor 1502. The memory 1501 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0198] The memory 1501 may be a volatile memory, such as a random-access memory (RAM); the memory 1501 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 1501 may be any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and accessible by a computer, but is not limited thereto. The memory 1501 may be a combination of the above memories.
[0199] The processor 1502 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 1502 is used to implement the resource data updating method when calling the computer program stored in the memory 1501 .
[0200] The communication module 1503 is used to communicate with terminal devices and other servers.
[0201] The specific connection medium between the memory 1501, the communication module 1503 and the processor 1502 is not limited in the embodiment of the present application. Fig.15 In the embodiment, the memory 1501 and the processor 1502 are connected via a bus 1504. The bus 1504 is connected to the processor 1502 via a bus 1504. Fig.15 The connections between the other components are described with bold lines, which are only for illustration and are not intended to be limiting. The bus 1504 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Fig.15 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.
[0202] The memory 1501 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the resource data updating method of the embodiment of the present application. The processor 1502 is used to execute the above-mentioned resource data updating method, such as Figure 2 shown.
[0203] In some possible implementations, various aspects of the resource data updating method provided in the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the resource data updating method according to various exemplary implementations of the present application described above in this specification. For example, the computer device may execute the following steps: Figure 2 Follow the steps shown in .
[0204] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0205] The program product of the embodiment of the present application can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a computing device. However, the program product of the present application is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with a command execution system, device or device.
[0206] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.
[0207] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0208] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user equipment, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0209] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.
[0210] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0211] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0212] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0213] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A resource data updating method, characterized in that: The method comprises: In response to a product acquisition request triggered for a target product, creating corresponding update transactions in a transaction message server for at least two resource data associated with the target product; According to the resource types corresponding to the at least two resource data, the corresponding update transaction is sent to the associated resource server to update the resource data, and at least two update results are returned; When there is at least one failed update result indicating an update failure and at least one successful update result indicating an update success in the at least two update results, sending a global result type indicating a resource data update failure to the transaction message server; For the at least one successful update result, the following operations are performed respectively: the transaction failure message returned by the transaction message server is sent to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
2. The method according to claim 1, characterized in that In response to the product acquisition request triggered for the target product, creating corresponding update transactions in the transaction message server for at least two resource data associated with the target product, respectively, including: In response to the product acquisition request triggered for the target product, determining at least two resource data associated with the target product; Based on the resource types corresponding to the at least two resource data, update transactions corresponding to the at least two resource data are determined, and corresponding update transactions are respectively created in the transaction message server.
3. The method according to claim 1, characterized in that The step of sending a corresponding update transaction to an associated resource server to update the resource data according to the resource types corresponding to the at least two resource data, and receiving at least two returned update results includes: According to the resource types corresponding to the at least two resource data, the corresponding update transactions are sent to the associated resource servers in sequence to update the resource data; Whenever an update result returned by a resource server is received, determining whether the update result is a failed update result indicating that the update has failed; If so, stop sending the next update transaction to the associated resource server; If not, the next update transaction is sent to the associated resource server to update the resource data, and the returned update result is received.
4. The method according to claim 1, characterized in that The global result type indicating the failure of updating resource data is sent to the transaction message server, including: When there is at least one failed update result indicating that the update failed and at least one successful update result indicating that the update was successful in the at least two update results, determining that the resource data update failed based on the at least one failed update result and the at least one successful update result, and obtaining a global result type indicating that the resource data update failed; The global result type is sent to the transaction message server.
5. The method according to any one of claims 1 to 4, characterized in that: The step of sending the transaction failure message returned by the transaction message server to a resource server corresponding to a successful update result includes: When receiving the transaction exception message sent by the transaction message server, query the update status of the at least two resource data respectively, and send the query results to the transaction message server; the transaction exception message is sent by the transaction message server when the global result type is not received within a preset time period; When the transaction failure message returned by the transaction message server for the query result is received, the transaction failure message is sent to a resource server corresponding to a successful update result.
6. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: When the at least two update results are both the successful update results, a global result type indicating that the resource data is updated successfully is sent to the transaction message server; For the at least two update results, the following operations are performed respectively: sending the transaction success message returned by the transaction message server to a resource server corresponding to one update result, so that the resource server performs a no-operation based on the transaction success message.
7. The method according to claim 6, characterized in that After each resource server performs a no-operation for the transaction success message, the method further includes: Upon receiving the transaction operation message returned by each resource server, returning a product supply message to the target object that triggered the product acquisition request; wherein the transaction operation message indicates that the corresponding empty operation of each resource server is successfully executed; After receiving the designated resource provision result provided based on the product supply message, the corresponding confirmation transaction is sent to the associated resource server for resource data confirmation according to the resource type corresponding to the at least two resource data; the designated resource provision result is triggered after the target object provides the designated resource based on the product supply information.
8. The method according to claim 7, characterized in that The step of sending the corresponding confirmation transaction to the associated resource server for resource data confirmation according to the resource types corresponding to the at least two resource data includes: According to the resource types corresponding to the at least two resource data, the corresponding confirmation transactions are sent to the associated resource servers in sequence to confirm the resource data, and the returned confirmation results are received; When the confirmation result is a successful confirmation result indicating a confirmation failure, each confirmation transaction is resent to the associated resource server for resource data confirmation until each confirmation result is a successful confirmation result indicating a confirmation success.
9. A resource data updating device, characterized in that: The device comprises: A creation module, configured to, in response to a product acquisition request triggered for a target product, create corresponding update transactions in a transaction message server for at least two resource data associated with the target product; An update module, configured to send a corresponding update transaction to an associated resource server to update the resource data according to the resource types corresponding to the at least two resource data, and receive at least two returned update results; A first forwarding module is used to send a global result type indicating a failure to update resource data to the transaction message server when there is at least one failed update result indicating a failed update and at least one successful update result indicating a successful update among the at least two update results; The recovery module is used to perform the following operations for the at least one successful update result: sending the transaction failure message returned by the transaction message server to a resource server corresponding to a successful update result, so that the corresponding resource server performs resource data recovery based on the transaction failure message.
10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of any one of the methods in claims 1 to 8.
11. A computer-readable storage medium, characterized in that: It includes program code. When the storage medium is run on an electronic device, the program code is used to enable the electronic device to execute the steps of any method described in claims 1 to 8.
12. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions implement the steps of any one of the methods of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Method for updating data and control apparatus thereof
CN102203779A
Multi-data-source dynamic isolated access method
CN103207908A
Resource manager failure handling in a multi-process transaction environment
US20160092318A1
