Resource data updating methods, devices, electronic equipment and storage media
By creating update transactions in the transaction message server and passing through the global result type, the problem of inconsistent resource data updates is solved, resource data recovery and consistency are achieved, and system stability is improved.
Patent Information
- Application Number
- CN202310530317.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-11
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2043-05-11
AI Technical Summary
In product supply operations, when resource data updates fail, inconsistencies arise among various resource data associated with the target product, necessitating a solution to ensure resource data consistency.
By creating update transactions in the transaction message server, receiving update results from the resource server, and passing the global result type to the resource server in the event of failure or success, the characteristics of the transaction message server are used to ensure that messages are received and to perform resource data recovery.
This ensures the consistency of resource data during the update process, avoids data inconsistency issues caused by product server failures, and improves the stability and reliability of the system.
Smart Images

Figure CN118939663B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, electronic device and storage medium for updating resource data. Background Technology
[0002] With the rapid development of internet technology, online product supply between clients and servers has become a new trend. In online product supply transactions, the server displays various products to the client. After selecting a target product, the client sends a product retrieval request to the server. The server responds to the request by creating corresponding product supply information. Based on this information, the client provides the specified resources to the server to obtain the desired product.
[0003] During the execution of the above 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. For example, it will deduct product inventory, deduct deduction vouchers, deduct activity qualifications, and deduct points.
[0004] In this scenario, if an update to one resource fails, subsequent update operations for all other resources cannot proceed. If a resource data update failure occurs during the update process, resulting in some resource data updating successfully while others fail, inconsistencies will arise among the 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 various resource data when updating the resource data bound to the target product. Summary of the Invention
[0006] This application provides a resource data update method, apparatus, electronic device, and storage medium to solve the problem of inconsistent resource data caused by inconsistent update results when updating resource data bound to a target product in a product supply business scenario.
[0007] On one hand, this application provides a resource data updating method, the method comprising:
[0008] In response to a product acquisition request triggered for a target product, corresponding update transactions are created in the transaction message server for at least two resource data associated with the target product.
[0009] According to the resource type 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 received.
[0010] If, among the at least two update results, there is at least one failed update result indicating an update failure and at least one successful update result indicating a successful update, the global result type indicating a failed update of resource data is sent to the transaction message server.
[0011] For each of the at least one successful update result, the following operations are performed: the transaction failure message returned by the transaction message server is sent to the resource server corresponding to a successful update result, so that the corresponding resource server can perform resource data recovery based on the transaction failure message.
[0012] On one hand, this application provides a resource data updating device, the device comprising:
[0013] A creation module is used to respond to a product acquisition request triggered for a target product, and to create corresponding update transactions in the transaction message server for at least two resource data associated with the target product.
[0014] The update module is used to send 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 to receive at least two update results returned.
[0015] The first forwarding module is used to send a global result type indicating a failed update 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 configured to perform the following operations for each of the at least one successful update result: send the transaction failure message returned by the transaction message server to the resource server corresponding to a successful update result, so that the corresponding resource server can perform 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, at least two resource data associated with the target product are determined;
[0019] Based on the resource types corresponding to the at least two resource data, determine the update transactions corresponding to the at least two resource data, and create the corresponding update transactions in the transaction message server.
[0020] Optionally, the update module is specifically used for:
[0021] According to the resource type 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] Upon receiving an update result from a resource server, determine whether the update result is a failed update result indicating an update failure.
[0023] If so, then 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 updated result is received.
[0025] Optionally, the first forwarding module is specifically used for:
[0026] When there is at least one failed update result indicating update failure and at least one successful update result indicating update success among the at least two update results, the resource data update is determined to have failed based on the at least one failed update result and the at least one successful update result, and a global result type indicating resource data update failure is obtained.
[0027] The global result type is sent to the transaction message server.
[0028] Optionally, the first forwarding module is further configured to:
[0029] Upon receiving a transaction exception message from the transaction message server, the update status of the at least two resource data items is queried respectively, and the query results are sent to the transaction message server; the transaction exception message is sent by the transaction message server when it has not received the global result type within a preset time period;
[0030] Upon receiving the 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.
[0031] Optionally, the device further includes:
[0032] The second forwarding module is used to send a global result type representing a successful update of resource data to the transaction message server when at least two update results are both successful update results.
[0033] The no-operation module is used to perform the following operations for the at least two update results: sending the transaction success message returned by the transaction message server to a resource server corresponding to one of the update results, so that the resource server performs a no-operation based on the transaction success message.
[0034] Optionally, the device further includes:
[0035] The return module is used to return a product supply message to the target object that triggered the product acquisition request when it receives the transaction operation message returned by each resource server; wherein, the transaction operation message indicates that the no-operation corresponding to each resource server was successfully executed;
[0036] 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 the at least two resource data after receiving the specified resource provision result based on the product supply message; the specified resource provision result is triggered by the target object after providing the specified resource based on the product supply information.
[0037] Optionally, the confirmation module is specifically used for:
[0038] According to the resource type corresponding to the at least two resource data, the corresponding confirmation transactions are sent to the associated resource server 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 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 success.
[0040] On one hand, an electronic device provided in this application includes a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor performs the steps of any of the above-described resource data update methods.
[0041] On the one hand, this application provides a computer-readable storage medium including program code, which, when the storage medium is run on an electronic device, is used to cause the electronic device to perform the steps of any of the above-described resource data update methods.
[0042] On one hand, an embodiment of this application provides a computer program product, which includes computer instructions 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, causing the electronic device to perform the steps of any of the above-described resource data update methods.
[0043] The beneficial effects of this application are as follows:
[0044] This application provides a resource data update method, apparatus, electronic device, and storage medium. When, in the update results returned for at least two resource data bound to a target product, both successful and failed update results exist, a global result type representing the failed resource data update is forwarded to the corresponding resource server via a transaction message server. This allows the resource server to recover the resource data corresponding to the successful update result. Because a transaction message server has the characteristic that sending messages through a transaction message server guarantees that the sent message will be received, forwarding the global result type to the corresponding resource server via the transaction message server ensures that the global result type will be received by the resource server. Compared to sending directly through the product server, forwarding via a transaction message server ensures that the corresponding resource server will receive the global result type even if the product server fails, and can recover the successfully updated resource data based on the global result type, thereby ensuring the consistency between resource data. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0046] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0047] Figure 2 A flowchart illustrating the implementation of a resource data updating method provided in this application embodiment;
[0048] Figure 3 A system architecture diagram for performing product supply operations is provided in this application embodiment;
[0049] Figure 4 A schematic diagram illustrating an update transaction creation scenario provided in an embodiment of this application;
[0050] Figure 5A An example diagram of a parallel scheme for each update transaction provided in an embodiment of this application;
[0051] Figure 5B An example diagram of a serial update transaction scheme provided in this application embodiment;
[0052] Figure 6 An example diagram illustrating a scenario for sending a transaction failure message, provided as an embodiment of this application;
[0053] Figure 7 An example diagram illustrating another scenario for sending a transaction failure message, provided in an embodiment of this application;
[0054] Figure 8 An example diagram illustrating a scenario for sending a transaction success message, provided as an embodiment of this application;
[0055] Figure 9 A schematic diagram illustrating a scenario for confirming the initiation of a transaction, provided as an embodiment of this application;
[0056] Figure 10A This is an example diagram of a normal order placement scenario provided in an embodiment of this application;
[0057] Figure 10B This application provides an example diagram of resource data changes.
[0058] Figure 10C Detailed example diagrams of a normal order placement process provided in this application embodiment;
[0059] Figure 11A An example diagram of an abnormal order placement scenario provided in this application embodiment;
[0060] Figure 11B Another example diagram illustrating resource data changes provided in this application embodiment;
[0061] Figure 11C A detailed example diagram of an abnormal order placement process is provided for an embodiment of this application;
[0062] Figure 12A An example diagram of an abnormal order placement scenario provided in this application embodiment;
[0063] Figure 12B Detailed example diagram of another abnormal order placement process provided in this application embodiment;
[0064] Figure 13 A sample diagram of a payment process provided in this application embodiment;
[0065] Figure 14 This is a schematic diagram of the structure of a resource data updating device provided in an embodiment of this application;
[0066] Figure 15 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0068] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.
[0069] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.
[0070] A transaction is a unit of program execution that updates resource data. It consists of all operations performed between the start and end of the transaction, such as a resource data deduction transaction and a resource data restoration transaction. A resource data deduction transaction can deduct from inventory data, deduction from voucher data, deduction from activity eligibility data, and deduction from points data, etc. Similarly, a resource data restoration transaction can restore inventory data, restore deduction from voucher data, restore activity eligibility data, and deduct from points data, etc.
[0071] Resources: A general term for substances, energy, and information that can be developed and utilized. In this application embodiment, resources refer to information related to the target product, such as inventory, discount vouchers, activity eligibility, points, etc. Among them, discount vouchers can be coupons in e-commerce scenarios, or lists of winners, etc. In specific use, points can also be classified as discount vouchers.
[0072] Resource data recovery: Restoring resource data to its state before the update. For example, if a resource server updates its inventory resources from 100 to 50 during an update transaction, then resource data recovery will restore the inventory resources from 50 back to 100.
[0073] Transaction message server characteristics: A notification from A to B can be defined as a message, which can be broken down into two steps: A sends the message + B receives the message. However, in practice, there may be situations where A sends a message but B does not receive it. Transaction message servers are used to solve this problem, ensuring that B will definitely receive the message after A sends it; this is the characteristic of transaction message servers.
[0074] The design concept of the embodiments of this application is briefly introduced below:
[0075] During the execution of the above 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. For example, it will deduct product inventory, deduct deduction vouchers, deduct activity qualifications, and deduct points.
[0076] In this scenario, if an update to one resource fails, subsequent update operations for all other resources cannot proceed. If a resource data update failure occurs during the update process, resulting in some resource data updating successfully while others fail, inconsistencies will arise among the 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 various resource data when updating the resource data bound to the target product.
[0078] In view of this, embodiments of this application provide a resource data update method, apparatus, electronic device, and storage medium. In response to a product acquisition request triggered for a target product, the product server creates corresponding update transactions for each resource data associated with the target product in a transaction message server, thereby registering each update transaction in the transaction message server. Then, according to the resource type of each resource data, the product server sends the corresponding update transaction to the associated resource server for resource data update, receives the returned update results, and if at least one failed update result indicating update failure and at least one successful update result indicating update success are present in the update results, a global result type indicating resource data update failure is sent to the transaction message server. This facilitates the forwarding of the global result type through the transaction message server, ensuring that the forwarded transaction message is necessarily received.
[0079] Furthermore, for at least one successful update result, the following operations are performed: the transaction failure message returned by the transaction message server is sent to the resource server corresponding to the successful update result, so that the corresponding resource server can perform resource data recovery based on the transaction failure message. In this way, the transaction failure message returned by the transaction message server ensures that each resource server receives the global result type. Subsequently, 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 resource data corresponding to the target product.
[0080] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.
[0081] like Figure 1 The diagram shown illustrates an application scenario provided by an embodiment of this application. This application scenario diagram includes a server cluster 101, a transaction message server 102, a terminal device 103, and a product server 104; 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] Server cluster 101 contains multiple resource servers used to update or restore the resource data bound to the target product during product supply operations. Each resource server can be an independent server, including microservers, edge servers in the cloud computing field, or cloud servers providing 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 (CDNs), and big data and artificial intelligence platforms. These resource servers can be configured individually or as a unified whole.
[0083] Transaction message server 102 is used based on the characteristic of transaction message servers: messages sent through the transaction message server are guaranteed to be received. It sends a global result type indicating a failed resource data update to each resource server to ensure that each resource server can receive the global result type and, based on the global result type, restore the successfully updated resource data, thereby maintaining consistency among the resource data. The specific type of transaction message server 102 can be found in the resource server section, and will not be elaborated here.
[0084] Terminal device 103 is used to initiate product acquisition requests to product server 104. Product server 104 creates product supply information based on the product acquisition requests and acts as a transaction coordination server between resource servers and transaction message server 102. That is, resource data processing information sent by each resource server to transaction message server 102, and transaction messages sent by each transaction message server 102 to each resource server, all need to be coordinated through product server 104. The specific type of transaction message server 102 can be referred to as resource server, and will not be described in detail here.
[0085] The number of the aforementioned server cluster 101, transaction message server 102, terminal device 103, and product server 104 is not limited here.
[0086] It should be noted that the resource data update method in this embodiment can be executed by the product server 104 alone, or by the product server 104 together with the server cluster 101, the transaction message server 102, and the terminal device 103. Specifically, when 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 via the terminal device 103 for the target product. In response to the product acquisition request, the product server 104 requests the creation of corresponding update transactions for at least two resource data associated with the target product in the request to the transaction message server 102.
[0087] Furthermore, product server 104 sends corresponding update transactions to associated resource servers according to the resource types corresponding to at least two resource data sets for resource data updates. At least two resource servers return at least two update results to product server. If, among the at least two update results, there is at least one failed update result indicating update failure and at least one successful update result indicating update success, product server 104 sends the global result type indicating resource data update failure to transaction message server 102. At this time, transaction message server 102 returns a transaction failure message to product server 104 based on the received information. In response to receiving the transaction failure message, product server 104 performs the following operations for each of the at least one successful update result: sending the transaction failure message to the resource server corresponding to a successful update result, so that the corresponding resource server can recover resource data based on the transaction failure message.
[0088] The resource data update method provided by the exemplary embodiments of this application will be described below with reference to the accompanying drawings and the above application scenarios. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way.
[0089] refer to Figure 2 The following is a flowchart illustrating the implementation of a resource data update method provided in this application embodiment. The method is described here with a product server as the execution entity. The specific implementation process of this method is as follows:
[0090] S201, In response to a product acquisition request triggered for a target product, create corresponding update transactions in the transaction message server for at least two resource data associated with the target product;
[0091] In this application embodiment, a system architecture diagram for performing product supply operations can be referenced. Figure 3 .exist Figure 3 The system comprises four layers: the business layer, the business logic layer, the basic service layer, and the storage layer. Based on these four layers, various transactions related to product supply operations can be executed.
[0092] The business layer, based on the logical functions of the business logic layer, encapsulates product supply business scenarios, including personal computer (PC) terminals, HTML5 (H5) pages, mini-programs, or applications (APPs). In the product supply business, the business layer serves as the interface for the target object to initiate the product supply business. For example, the target object can browse various products provided by the product server through the APP, and after selecting the target product, it can initiate the product supply business and create product supply information. Of course, the target object can also initiate the product supply business through H5 pages, mini-programs, PC terminals, etc., without specific limitations here.
[0093] The business logic layer includes a product server, a transaction message server, and a resource exchange server. Through information exchange between the product server and the transaction message server, product supply information can be created; through information exchange between the product server and the resource exchange server, target products can be provided to target objects, and specified resources can be obtained from the target objects.
[0094] When creating product supply information, the product server can also mobilize various resource servers in the basic service layer to update various resource data bound to the target product. The global result type of the resource data update is then passed 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. This includes: if the global result type is obtained when there are both failed update results and successful update results in the update results of each resource data, then the resource data corresponding to the successful update results is restored; if the global result type is obtained when all update results are successful update results or no successful update results are found, then a no-operation is performed.
[0095] The basic service layer consists of resource servers 1 to N, where N is greater than or equal to the number of different resource types bound to the target product. For example, if the target product is bound to resources such as product inventory, discount vouchers, activity eligibility, and points, there are four resource types, and in this case, N is greater than or equal to 4. Different types of resource data are updated or restored by different resource servers. These resource servers can be microservers, used to support the upstream business logic layer.
[0096] The storage layer is used to store the various resource data bound to the target product. Different types of resource data are stored in different databases, realizing one-to-one storage between the database and the upstream basic service layer.
[0097] Based on the system architecture for the above-mentioned product supply business, the following process is generally required when executing the product supply business: 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 and creates product supply information for the target product, and the target object can obtain the target product after providing the corresponding specified resources based on the product supply information.
[0098] When creating product supply information, each resource server needs to update the data of all resources associated with the target product. This includes deducting from product inventory, discount vouchers, activity eligibility, and points. If all resource data is successfully updated, the product supply information will be successfully created. At this point, consistency between the resource data will also be maintained.
[0099] Conversely, if any resource data fails to update, it will cause the product supply information creation to fail, leading to inconsistencies between the resource data. For example, the resource data associated with the target product might be: Product inventory quantity 100, Deduction voucher quantity 100, Activity eligibility 100 times, Points 100. When deducting from each resource data, the deduction quantity is always 1. If only the product inventory and deduction vouchers are successfully deducted, the resource data will become: Product inventory quantity 99, Deduction voucher quantity 99, Activity eligibility 100 times, Points 100. In this case, the resource data is inconsistent, which is detrimental to product information management.
[0100] In this embodiment of the application, the system architecture based on the above-mentioned product supply business 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 points. For example... Figure 4 The diagram illustrates a scenario for creating an update transaction, which includes the following steps:
[0102] Step 401: In response to a product acquisition request triggered for the target product, determine at least two resource data associated with the target product, wherein different types of resource data are stored in different databases, and the types of resources associated with each product are also pre-set by the product server.
[0103] Step 402: Based on the resource types corresponding to at least two resource data, determine the update transactions corresponding to at least two resource data. For example, when the at least two resource types are product inventory, deduction voucher, activity qualification and points, the update transactions can be determined as follows: deducting from product inventory, deducting from deduction voucher, deducting from activity qualification and deducting from points.
[0104] Step 403: In the transaction message server, create the corresponding update transactions respectively.
[0105] By creating a corresponding update transaction in the transaction message server, a global transaction identifier set by the transaction message server for all update transactions can be obtained. Based on this, the update time corresponding to different products can be distinguished.
[0106] S202, according to the resource type corresponding to at least two resource data, send the corresponding update transaction to the associated resource server to update the resource data, and receive at least two update results returned;
[0107] In this embodiment of the application, after creating the corresponding update transaction in the transaction message server, at least two update transactions are sent to the associated resource server to update the resource data according to the resource types corresponding to at least two resource data, and at least two update results are received.
[0108] For example, when at least two resource types are product inventory, discount vouchers, activity eligibility, and points, at least two update transactions are sent to the inventory server, discount voucher server, activity eligibility server, and points server, respectively. These servers are all resource servers. Specifically, the inventory server is used to deduct from product inventory; the discount voucher server is used to deduct from discount vouchers; the activity eligibility server is used to deduct from activity eligibility; and the points server is used to deduct from points. Then, the update results for the resource data from each resource server are received.
[0109] In the above process, 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. There are two implementation schemes:
[0110] Option 1: Parallel approach.
[0111] The product server sends at least two update tasks simultaneously to the corresponding resource servers, enabling the resource servers to update their resource data. In this method, at least two update transactions are processed in parallel among the corresponding resource servers. Therefore, the updates performed by each resource server do not affect the others, and each resource server can generate its own update result.
[0112] For example, refer to Figure 5A This is an example diagram of a parallel scheme for each update transaction. Figure 5A In the process, at time t1, the product server simultaneously sends 4 update transactions to 4 independent resource servers. At times t2, t3, t4, and t5, it receives update results returned by the 4 resource servers respectively. The number of update results is consistent with the number of update transactions. Among the 4 update results, the update result received at time t4 is the failed update result, which indicates that the resource data update failed.
[0113] Option 2: Serial scheme.
[0114] The product server, based on the resource types corresponding to at least two resource data, sequentially sends at least two update transactions to the associated resource servers to update the resource data. Upon receiving an update result from a resource server, it determines whether the update result is a failed update result indicating an update failure. If so, it stops sending the next update transaction to the associated resource server; otherwise, it continues sending the next update transaction to the associated resource server to update the resource data and receives the returned update result.
[0115] For example, refer to Figure 5B This is an example diagram of a serial update transaction scheme. Figure 5B In the process, at time T1, the product server sends update transaction 1 to resource server 1. After receiving a successful update result from resource server 1 indicating that the resource data update was successful, at time T2, the product server sends update transaction 2 to resource server 2 and receives a successful update result from resource server 2. Further, at time T3, after sending update transaction 3 to resource server 3, the product server receives a failed update result from resource server 3. At this point, the product server will no longer send subsequent update transaction 4 to resource server 4.
[0116] The following is a comparative analysis of Scheme 1 and Scheme 2:
[0117] If we follow Option 1, then refer to Figure 5AResource server 3 returned a failed update result, while resource servers 1, 2, and 4 returned successful update results. At this point, due to the existence of failed resource data updates, there is inconsistency between the resource data. 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 are the resource data updated by resource servers 1, 2, and 4 respectively.
[0118] However, if Option 2 is implemented, then refer to Figure 5B If resource server 3 returns a failed update result, resource server 4 will not execute the data update transaction. At this time, due to the failure of resource data updates, there is inconsistency among the four resource data sets. 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 are the resource data updated by resource servers 1 and 2 respectively.
[0119] As shown above, Scheme 2 requires less resource data to be recovered than Scheme 1. Especially when the failed update result is returned earlier, Scheme 2 significantly saves on data processing. Therefore, Scheme 2 is the preferred option.
[0120] In the above process, different resource servers are used to update the various resource data bound to the product information. Compared with using a single server, this not only has stronger data processing capabilities and can be applied to scenarios with a larger volume of product supply business processing, but also, since 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.
[0121] S203, when there is at least one failed update result indicating update failure and at least one successful update result indicating update success among at least two update results, the global result type indicating resource data update failure is sent to the transaction message server.
[0122] In this embodiment of the application, after obtaining update results returned by at least two resource servers, different processing schemes are adopted based on the different result types in the at least two update results, including:
[0123] When there is at least one failed update result indicating update failure and at least one successful update result indicating update success among at least two update results, the resource data update failure is determined based on the at least one failed update result and the at least one successful update result, and the global result type indicating the resource data update failure is obtained.
[0124] For example, in Figure 5AThere are 3 successful update results and 1 failed update result; Figure 5B In the process, there are 2 successful update results and 1 failed update result. If there is a failed update result, then for the global update result, the resource data update for the target product is considered a failure. Therefore, Figure 5A as well as Figure 5B All global result types in the table represent global result types indicating failure of resource data update.
[0125] Furthermore, the global result type indicating the failure of the resource data update is sent to the transaction message server.
[0126] It's important to note that sending the global result type indicating a failed resource data update to the transaction message server here leverages its characteristic: a notification from A to B can be defined as a message, which can be broken down into two steps: A sending the message and B receiving the message. However, in practice, there might be situations where A sends a message but B doesn't receive it. The transaction message server is designed to solve this problem, ensuring that B always receives the message after A sends it. Based on this characteristic, when sending received information to the corresponding resource servers for data recovery, the transaction message server ensures that each resource server receives the information, thus guaranteeing data resource consistency.
[0127] As a contrasting approach, if the product server, upon receiving a global result type indicating a failed resource data update and a transaction identifier corresponding to at least one successful update result, directly sends the global result type indicating a failed resource data update to the corresponding resource server according to the transaction identifier corresponding to at least one successful update result, then when the product server malfunctions, it cannot be guaranteed that the corresponding resource server will receive the global result type indicating a failed resource data update. Consequently, it cannot be guaranteed that data recovery can be performed on the successfully updated resource data, leading to inconsistencies between the various resource data.
[0128] As can be seen from the above, in this embodiment of the application, the global result type representing the failure of resource data update is sent to the transaction message server. The timeout reverse lookup mechanism of the message server helps to ensure the consistency between 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 the resource server corresponding to the successful update structure, so that the corresponding resource server can perform resource data recovery based on the transaction failure message.
[0130] In this embodiment, after receiving a global update result indicating a failed resource data update, the transaction message server, based on the received information, returns a transaction failure message to the resource server corresponding to at least one successful update result. When returning the transaction failure message, since the product server acts as the transaction coordinator in this embodiment, the transaction message server first returns the transaction failure message to the product server, and then the product server returns it to the corresponding resource server, enabling the resource server to perform data recovery and thus ensuring consistency among the resource data.
[0131] For example, refer to Figure 6 This is an example diagram illustrating a scenario where a transaction failure message is sent. Figure 6 There are three resource servers: Resource Server 1, Resource Server 2, and Resource Server 3. Resource Server 1 and Resource Server 2, after executing their respective update transactions for resource data, send successful update results to the product server, while Resource Server 3 sends a failed update result. The product server, based on the two successful update results and one failed update result, sends a global result type indicating a failed resource data update to the transaction message server. The transaction message server, in response to the received global result type, returns a transaction failure message to the product server. Upon receiving the transaction failure message, the product server, based on the unique identifiers corresponding to the two successful update results, forwards the message to the respective resource servers, enabling Resource Server 1 and Resource Server 2 to recover the corresponding resource data based on the received failure message.
[0132] In one 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 results from each resource server, the transaction message server will return a transaction exception message to the product server to maintain the real-time consistency of the resource data. Upon receiving the transaction exception message from the transaction message server, the product server queries the update status of each resource data, including whether the update was successful or failed, and sends the query results to the transaction message server. Upon receiving a transaction failure message from the transaction message server in response to the query results, the product server sends the transaction failure message to at least one resource server corresponding to a successful update result, so that the corresponding resource server can restore the successfully updated resource data.
[0133] For example, refer to Figure 7 This is an example diagram illustrating another scenario for sending transaction failure messages. Figure 7There are three resource servers: Resource Server 1, Resource Server 2, and Resource Server 3. Resource Server 1 and Resource Server 2, after executing their respective update transactions for resource data, send successful update results to the product server, while Resource Server 3 sends a failed update result. At this point, based on the two successful update results and one failed update result, the product server should send a global result indicating a failed resource data update to the transaction message server within a preset time period. However, the product server sends a timeout message instead.
[0134] If the transaction message server does not receive feedback from the product server within a preset time period, it sends a transaction exception message to the product server. Upon receiving this message, the product server queries the update status of each resource data and sends the query results back to the transaction message server. These results include at least a global result type indicating a resource data update failure. The transaction message server returns a transaction failure message to the product server based on the received global result type. The product server then forwards this failure message to the corresponding resource server 1 and resource server 2. Upon receiving the failure message, resource server 1 and resource server 2 perform resource data recovery operations on the previously updated resource data, thereby maintaining the consistency of the resource data.
[0135] It should be noted that, during the implementation of the above resource data update method, in order to ensure that the global update transactions are consistent when the transaction message server and the product server exchange information, the transaction message server sets a global transaction identifier for each update transaction when the product server requests the creation of each update transaction. Based on this, the information sent between the product server and the transaction message server during information exchange will carry the global transaction identifier.
[0136] Similarly, during the interaction between the product server and various resource servers, 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 unique identifier to each update transaction and associate this unique identifier with the corresponding resource server. For example, when updating inventory data, the product server will assign a unique identifier to the inventory update transaction and associate this unique identifier with the inventory server.
[0137] Furthermore, the aforementioned resource data update method ensures consistency among resource data in application scenarios where there is at least one failed update result indicating an update failure and at least one successful update result indicating a successful update. In one possible application scenario, if the product server receives at least one failed update result due to network latency or an alarm message indicating insufficient inventory, then the resource data corresponding to the failed update result has actually been updated successfully, and therefore data recovery is also required.
[0138] In one possible implementation, if all update results for resource data are successful, the product server sends a global result type indicating a successful resource data update to the transaction message server. For each update result, the product server performs the following operations: it sends a transaction success message returned by the transaction message server to a resource server corresponding to each update result, causing that resource server to perform a no-operation based on the transaction success message.
[0139] For example, refer to Figure 8 This is an example diagram illustrating a scenario where a successful transaction message is sent. Figure 8 There are three resource servers: Resource Server 1, Resource Server 2, and Resource Server 3. When these three servers execute data update transactions for each resource, the update result they receive is a successful update result. Resource Servers 1, 2, and 3 send their respective successful update results to the product server. Upon receiving these results, the product server sends a global result type indicating a successful resource update to the transaction message server. The transaction message server, upon receiving the global result type, returns a transaction success message to the product server. The product server, upon receiving the transaction success message, then forwards it to Resource Servers 1, 2, and 3 respectively. Each of these three servers then performs a no-operation.
[0140] After each resource server executes its no-operation, it signifies that each resource server's update transaction for the resource data has been successfully completed. At this point, each resource server returns a transaction operation message to the product server, indicating that its no-operation was successful. Upon receiving the transaction operation messages from each resource server, the product server returns a product supply message to the target object that triggered the product acquisition request. This product supply information includes the target product ID, product supply protocol ID, and target object ID. Based on the product supply information, the target object provides the specified resource to the resource exchange server and then returns the specified resource supply result to the product server. Upon receiving the specified resource supply result, the product server, according to the resource type of each resource data, sends the corresponding confirmation transaction to the associated resource server for resource data confirmation.
[0141] For example, refer to Figure 9 This is a schematic diagram illustrating a scenario where the initiation of a transaction is confirmed. Figure 9 In this process, resource servers 1, 2, and 3 each send transaction operation information to the product server, representing the execution of no-operation on each successfully updated resource data. Upon receiving these transaction operation information, the product server sends product supply information to the target object. The target object, after providing the specified resource, returns the specified resource provision result to the product server. In response to the specified resource provision result, the product server sends confirmation transactions to resource servers 1, 2, and 3, respectively, to acknowledge the resource data.
[0142] In the above process, there are two implementation schemes when confirming resource data.
[0143] Option 1: Parallel approach.
[0144] The product server sends the resource type of each resource data to its respective associated resource server for data confirmation, and receives the confirmation results returned by each resource server.
[0145] Option 2: Serial Scheme
[0146] According to the resource type of each resource data, the product server sequentially sends the corresponding confirmation transaction to the associated resource server for resource data confirmation, and receives the returned confirmation result. If the confirmation result is a success confirmation result indicating confirmation failure, the server resends each confirmation transaction to the associated resource server for resource data confirmation, until each confirmation result is a success confirmation result indicating confirmation success.
[0147] The advantages and disadvantages of Scheme 1 and Scheme 2 will be compared and analyzed below:
[0148] Option 1 can quickly identify which resource data failed to be confirmed, saving time, but it requires the participation of all resource servers, increasing the data processing volume. Option 2 only requires confirming each resource data one by one, and stops subsequent confirmation transactions when unconfirmed resource data is found. Compared to Option 1, each confirmation only requires the participation of one resource server, resulting in less data processing, but it cannot quickly identify failed confirmation resource data.
[0149] Given that both Option 1 and Option 2 have their own advantages and disadvantages, the appropriate resource data confirmation option can be selected based on the actual situation.
[0150] In summary, the embodiments of this application provide a resource data update method, apparatus, electronic device, and storage medium. When each independent resource server returns update results for resource data bound to a target product, and both successful and failed update results exist, the global result type indicating a failed resource data update is transmitted to the corresponding resource server through a transaction message server. This enables the resource server to restore the resource data corresponding to the successful update result, thereby ensuring consistency among the resource data.
[0151] On the one hand, by updating the resource data bound to the product information separately through different resource servers, compared with using a single server, not only is the data processing capability stronger and applicable to scenarios with a larger volume of product supply business processing, but also, since 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, the transaction message transaction server and product server can promptly obtain transaction failure information and send the information to the corresponding resource server for data recovery, thus ensuring the real-time consistency of all resource data.
[0153] On the one hand, due to the characteristics of transaction message servers, it can be guaranteed that sent messages will be received. Therefore, by passing the global result type through the transaction message server to the corresponding resource server, it can be guaranteed that the global result type will be received by the resource server. Compared with sending directly through the product server, passing through the transaction message server can ensure that the corresponding resource server will receive the global result type even if the product server fails, and can restore the successfully updated resource data according to the global result type, thereby ensuring the consistency of resource data and high reliability.
[0154] Based on the above embodiments, the resource data update method in this application embodiment will be described in detail below using a specific e-commerce scenario. In the e-commerce scenario, if a target object wants to obtain a target product, it must go through the following two processes: one is the order placement process, and the other is the payment process.
[0155] Process 1: Order Placement Process
[0156] The order placement process includes three scenarios: normal order placement and abnormal order placement.
[0157] refer to Figure 10A This is an example image of a normal order placement scenario. Figure 10A In this process, the target object requests the target product from the product server. Upon receiving the request, the product server sequentially notifies the coupon server and inventory server to update the product, receiving a success update result from each. Then, the product server notifies the transaction message server of a globally successful update message. Upon receiving this message, the transaction message server, through the product server, notifies the inventory server and coupon server to perform a no-operation. For an example diagram illustrating the changes in resource data associated with the target product during this process, please refer to... Figure 10B .
[0158] refer to Figure 10C , then Figure 10A A detailed example of a normal order placement process is shown in the image. Figure 10C In this process, the target user initiates an order request (a product acquisition request) to the product server via a terminal device. Upon receiving the order request, the product server notifies the order server to create order information. At this stage, the created order information is invisible to the target user and cannot be used for payment. Further, the product server requests to register a distributed transaction with the transaction message server, including coupon pre-deduction and inventory pre-deduction. Upon receiving the registration request, the transaction message server returns a distributed transaction ID to the product server. Responding to the received distributed transaction ID, the product server sequentially notifies the coupon server and the inventory server to execute their respective coupon pre-deduction and inventory pre-deduction transactions. After completion, the product server modifies the previously created order information so that the target user can make payment based on the order information.
[0159] Furthermore, the product server sends the global result type (commit) of the aforementioned coupon pre-deduction transaction and inventory pre-deduction transaction, along with the distributed transaction ID, to the transaction message server, and also sends the order information to the target object. Upon receiving the global result type, the transaction message server sends a sub-transaction message to the product server, causing the coupon server and inventory server to perform no-operation actions.
[0160] refer to Figure 11A This is an example diagram illustrating an abnormal order placement scenario. Figure 11A In this process, the target object requests the target product from the product server. Upon receiving the request, the product server sequentially notifies the coupon server and inventory server to update the product. If the inventory server's resource data update fails, the product server then notifies the transaction message server of a global update failure message. Upon receiving this message, the transaction message server, through the product server, notifies the coupon server to perform a no-operation. An example diagram illustrating the changes in resource data associated with the target product can be found in the [reference needed]. Figure 11B .
[0161] refer to Figure 11C This is a detailed example diagram of an abnormal order placement process. Figure 11C In the process, after receiving the distributed transaction ID from 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 sequence. However, the inventory server's inventory pre-deduction transaction fails. At this point, the product server returns a global result type (rollback) to the transaction message server. The transaction message server then sends a sub-transaction message to the product server based on the received global result type (rollback), thereby triggering the coupon server to perform a coupon data recovery transaction and triggering the inventory server to perform an inventory data recovery transaction.
[0162] refer to Figure 12A This is an example diagram illustrating an abnormal order placement scenario. Figure 12A In this process, the target object requests the target product from the product server. Upon receiving the request, the product server sequentially notifies the coupon server and inventory server to update the product. However, the inventory server's resource data update fails, and the product server times out, sending a global update failure message to the transaction message server. At this point, the transaction message server proactively requests the product server to query the inventory and coupon update status, and based on the received results, notifies the coupon server through the product server to restore the data. An example diagram illustrating the changes in resource data associated with the target product during this process can be found in [reference needed]. Figure 11B .
[0163] refer to Figure 12B This is a detailed example diagram of another abnormal order placement process. Figure 12BIn this scenario, if the inventory server fails to execute a pre-deduction transaction and the product server does not return a global result type (rollback) carrying the distributed transaction ID to the transaction message server within a preset time, the transaction message server initiates a timeout reverse lookup request to the product server. Upon receiving this request, the product server queries the order information, coupons, and pre-deduction status of the inventory, and returns the query results to the transaction message server. Based on the query results, the transaction message server sends a sub-transaction message to the product server, instructing it to notify the coupon server to perform a coupon data recovery operation. If the pre-deduction of inventory fails due to network latency or other reasons, since the inventory data has already been pre-deducted, it is also necessary to notify the inventory server to perform an inventory data recovery operation.
[0164] Step 2: Payment Process.
[0165] refer to Figure 13 This is a sample diagram of a payment process. Figure 13 In this process, after the target object pays for the specified resources through the resource exchange server based on the order information, the payment result is returned to the product server. Subsequently, the product server, in a preset order, calls the coupon server, inventory server, and order server to execute the corresponding coupon deduction transaction, inventory deduction transaction, or order information modification transaction. If the inventory server fails to execute the deduction transaction on the inventory data, the product server returns the failure result to the resource exchange server and notifies the corresponding server again to execute the coupon deduction transaction, inventory deduction transaction, or order information modification transaction. If the order information modification transaction fails during this process, all transactions need to be called back again until the coupon deduction transaction, inventory deduction transaction, or order information modification transaction all succeed.
[0166] Based on the same inventive concept, embodiments of this application also provide a resource data updating device. For example... Figure 14 The diagram shown is a structural schematic of a resource data update device, which may include:
[0167] Create module 1401 to respond to a product acquisition request triggered for a target product, and create corresponding update transactions in the transaction message server for at least two resource data associated with the target product.
[0168] The update module 1402 is used to send the corresponding update transaction to the associated resource server to update the resource data according to the resource type corresponding to at least two resource data, and to receive at least two update results returned.
[0169] The first forwarding module 1403 is used to send the global result type indicating the failure of the resource data update to the transaction message 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 among 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 the resource server corresponding to a successful update result, so that the corresponding resource server can recover resource data based on the transaction failure message.
[0171] Optionally, module 1401 is specifically used for:
[0172] In response to a product retrieval request triggered for a target product, determine at least two resource data associated with the target product;
[0173] Based on the resource types corresponding to at least two resource data, determine the update transactions corresponding to at least two resource data, and create the corresponding update transactions in the transaction message server.
[0174] Optionally, update module 1402 is specifically used for:
[0175] Based on the resource type corresponding to at least two resource data, the corresponding update transactions are sent to the associated resource servers in sequence to update the resource data;
[0176] Upon receiving an update result from a resource server, determine whether the update result is a failed update result indicating that the update has failed;
[0177] If so, then 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 updated result is received.
[0179] Optionally, the first forwarding module 1403 is specifically used for:
[0180] When there is at least one failed update result indicating update failure and at least one successful update result indicating update success among at least two update results, the resource data update is determined to have failed based on the at least one failed update result and the at least one successful update result, and the global result type indicating the resource data update failure is obtained.
[0181] Send the global result type to the transaction message server.
[0182] Optionally, the first forwarding module 1403 is also used for:
[0183] Upon receiving a transaction exception message from the transaction message server, the update status of at least two resource data items is queried separately, and the query results are sent to the transaction message server. The transaction exception message is sent by the transaction message server when it has not received a global result type within a preset time period.
[0184] When a transaction failure message is received from the transaction message server in response to a query result, the transaction failure message is forwarded to the resource server corresponding to the successful update result.
[0185] Optionally, the device also includes:
[0186] The second forwarding module is used to send a global result type indicating that the resource data has been successfully updated to the transaction message server when at least two update results are both successful update results.
[0187] The no-operation module is used to perform the following operations for at least two update results: send the transaction success message returned by the transaction message server to a resource server corresponding to one of the update results, so that a resource server performs a no-operation based on the transaction success message.
[0188] Optionally, the device also includes:
[0189] The return module is used to return a product supply message to the target object that triggered the product acquisition request when it receives a transaction operation message from each resource server; wherein, the transaction operation message indicates that the no-operation corresponding to each resource server was executed successfully;
[0190] The confirmation module is used to send the corresponding confirmation transaction to the associated resource server to confirm the resource data after receiving the specified resource provision result based on the product supply message, according to the resource type corresponding to each resource data. The specified resource provision result is issued by the target object after providing the specified resource based on the product supply information.
[0191] Optionally, the confirmation module is specifically used for:
[0192] Based on the resource types corresponding to 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] If the confirmation result is a successful confirmation result indicating a 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 success.
[0194] Those skilled in the art will understand that various aspects of this application can be implemented as a system, method, or program product. Therefore, various aspects of this application can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, collectively referred to herein as a "circuit," "module," or "system."
[0195] In some possible implementations, the resource data updating apparatus according to this application may include at least a processor and a memory. The memory stores program code that, when executed by the processor, causes the processor to perform the steps of the resource data updating methods according to various exemplary embodiments of this application described in this specification. For example, the processor may perform actions such as... Figure 2 The steps are shown in the figure.
[0196] Based on the same inventive concept as the above-described method embodiments, this application also provides an electronic device. In one embodiment, the electronic device may be a server. In this embodiment, the structure of the electronic device may be as follows: Figure 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. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0198] Memory 1501 may be volatile memory, such as random-access memory (RAM); memory 1501 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 1501 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 1501 may be a combination of the above-described memories.
[0199] Processor 1502 may include one or more central processing units (CPUs) or digital processing units, etc. Processor 1502 is used to implement the above-described resource data update method when calling computer programs stored in memory 1501.
[0200] The communication module 1503 is used to communicate with terminal devices and other servers.
[0201] This application embodiment does not limit the specific connection medium between the memory 1501, communication module 1503, and processor 1502. This application embodiment... Figure 15 The memory 1501 and the processor 1502 are connected via a bus 1504, and the bus 1504 is in Figure 15 The diagram uses thick lines to describe the connections between other components; these are for illustrative purposes only and should not be considered limiting. The 1504 bus can be divided into address bus, data bus, control bus, etc. For ease of description, Figure 15 It is described using only a thick line, but does not indicate that there is only one bus or one type of bus.
[0202] The memory 1501 stores a computer storage medium, which stores computer-executable instructions for implementing the resource data update method of this application embodiment. The processor 1502 is used to execute the above-described resource data update method, such as... Figure 2 As shown.
[0203] In some possible implementations, various aspects of the resource data update method provided in this application can also be implemented as a program product, which includes program code. When the program product is run on a computer device, the program code is used to cause the computer device to perform the steps in the resource data update method according to the various exemplary embodiments of this application described above. For example, the computer device can perform actions such as... Figure 2 The steps are shown in the figure.
[0204] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0205] The program product of the embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a computing device. However, the program product of this application is not limited thereto. In this document, the readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with a command execution system, apparatus, or device.
[0206] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with a command execution system, apparatus, or device.
[0207] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0208] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can 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 sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this 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 and embodied by multiple units.
[0210] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0211] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0212] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0213] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method for updating resource data, characterized in that, Applied to a product server, the method includes: In response to a product acquisition request triggered for a target product, corresponding update transactions are created in the transaction message server for at least two resource data associated with the target product; the transaction message server is used to perform message pass-through between the product server and the resource server; 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; wherein, the resource types of the resource data stored in different resource servers are different; Upon receiving an update result from a resource server, determine whether the update result is a failed update result indicating an update failure. If so, then stop sending the next update transaction to the associated resource server; If not, the next update transaction will be sent to the associated resource server to update the resource data, and the updated result will be received. If, among the at least two update results, there is at least one failed update result indicating an update failure and at least one successful update result indicating a update success, it is determined that the product supply information creation has failed, and a global result type indicating a failure to update resource data is sent to the transaction message server. For each of the at least one successful update result, the following operations are performed: the transaction failure message returned by the transaction message server is sent to the resource server corresponding to a successful update result, so that the corresponding resource server can perform resource data recovery based on the transaction failure message.
2. The method as described in claim 1, characterized in that, In response to a product retrieval request triggered for a target product, corresponding update transactions are created in the transaction message server for at least two resource data associated with the target product, including: In response to the product acquisition request triggered for the target product, at least two resource data associated with the target product are determined; Based on the resource types corresponding to the at least two resource data, determine the update transactions corresponding to the at least two resource data, and create the corresponding update transactions in the transaction message server.
3. The method as described in claim 1, characterized in that, The global result type representing the failure to update resource data is sent to the transaction message server, including: When there is at least one failed update result indicating update failure and at least one successful update result indicating update success among the at least two update results, the resource data update is determined to have failed based on the at least one failed update result and the at least one successful update result, and a global result type indicating resource data update failure is obtained. The global result type is sent to the transaction message server.
4. The method according to any one of claims 1 to 3, 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: Upon receiving a transaction exception message from the transaction message server, the update status of the at least two resource data items is queried respectively, and the query results are sent to the transaction message server; the transaction exception message is sent by the transaction message server when it has not received the global result type within a preset time period; Upon receiving the 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.
5. The method according to any one of claims 1-3, characterized in that, The method further includes: When at least two update results are both successful update results, a global result type representing a successful update of resource data will be sent to the transaction message server; For each of the at least two update results, the following operations are performed: the transaction success message returned by the transaction message server is sent to a resource server corresponding to one of the update results, so that the resource server performs a no-operation based on the transaction success message.
6. The method as described in claim 5, characterized in that, After each resource server performs a null operation in response to the transaction success message, the process also includes: Upon receiving the transaction operation message returned by each of the resource servers, a product supply message is returned to the target object that triggered the product acquisition request; wherein, the transaction operation message indicates that the no-operation corresponding to each resource server was successfully executed; After receiving the specified resource provision result based on the product supply message, the corresponding confirmation transaction is sent to the associated resource server to confirm the resource data according to the resource type corresponding to the at least two resource data; the specified resource provision result is triggered by the target object providing the specified resource based on the product supply information.
7. The method as described in claim 6, characterized in that, The step of sending the corresponding confirmation transaction to the associated resource server for resource data confirmation according to the resource type corresponding to the at least two resource data includes: According to the resource type corresponding to the at least two resource data, the corresponding confirmation transactions are sent to the associated resource server 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 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 success.
8. A resource data updating device, characterized in that, The device, applied to a product server, includes: A creation module is used to respond to a product acquisition request triggered for a target product, and to create corresponding update transactions in a transaction message server for at least two resource data associated with the target product; the transaction message server is used to perform message pass-through between the product server and the resource server; The update module is used to sequentially send corresponding update transactions to the associated resource servers for resource data updates according to the resource types corresponding to the at least two resource data; wherein the resource types of the resource data stored in different resource servers are different; when each update result returned by a resource server is received, it is determined whether the update result is a failed update result indicating that the update has failed; if so, the next update transaction is stopped from being sent to the associated resource server; if not, the next update transaction is sent to the associated resource server for resource data updates, and the returned update result is received. The first forwarding module is used to determine that the product supply information creation has failed when there is at least one failed update result indicating update failure and at least one successful update result indicating update success among the at least two update results, and to send the global result type indicating resource data update failure to the transaction message server. The recovery module is configured to perform the following operations for each of the at least one successful update result: send the transaction failure message returned by the transaction message server to the resource server corresponding to a successful update result, so that the corresponding resource server can perform resource data recovery based on the transaction failure message.
9. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores program code that, when executed by the processor, causes the processor to perform the steps of any of the methods described in claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It includes program code that, when the storage medium is running on an electronic device, causes the electronic device to perform the steps of any of the methods described in claims 1 to 7.
11. A computer program product, characterized in that, The method includes computer instructions, characterized in that, when executed by a processor, the computer instructions implement the steps of any of the methods described in claims 1 to 7.
Citation Information
Patent Citations
Method for updating data and control apparatus thereof
CN102203779A
