Routing exception processing method, device and electronic device
By performing secondary verification of request messages in a distributed transaction system and forwarding them to the correct cluster, the problem of inaccurate client request forwarding is solved, and the stability and accuracy of the system are improved.
Patent Information
- Application Number
- CN202111324452.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-10
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2041-11-10
AI Technical Summary
In distributed transaction systems, network exceptions or client requests lack specific fields, resulting in client requests that cannot be accurately forwarded to the corresponding server. The existing technology lacks effective processing methods, which affects the normal operation of the system.
By performing secondary verification of request messages within the cluster and forwarding request messages that fail to pass to the corresponding cluster, preset routing rules are used to determine the target cluster number to ensure that request messages are accurately forwarded to the correct server.
It improves the accuracy of client request forwarding, ensures the normal operation of the distributed transaction system, and reduces forwarding errors caused by network exceptions or missing requests.
Smart Images

Figure CN114051028B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of distributed technology, and in particular to a method, device and electronic device for handling routing anomalies. Background Art
[0002] Routing mainly refers to forwarding client requests to the application processing program of the corresponding server according to the request uniform resource locator or request message through corresponding rules.
[0003] With the development of Internet technology, the application of distributed trading systems is becoming more and more common. In distributed trading systems, client requests can be forwarded to various servers for processing through routing according to specified rules, thereby realizing related services.
[0004] However, due to network anomalies or the lack of specific fields in the client request, the client request cannot be accurately forwarded to the corresponding server, and there is no effective way to deal with this situation in the prior art, which reduces the accuracy of the client request forwarding process and affects the normal operation of the distributed trading system. Summary of the invention
[0005] The embodiments of the present application provide a method, device and electronic device for handling routing anomalies to improve the accuracy of forwarding client requests.
[0006] In a first aspect, an embodiment of the present application provides a method for handling routing exceptions, including:
[0007] Receiving a routing request sent according to a preset routing forwarding rule, wherein the routing request includes a request message;
[0008] Determining whether the request message contains a first preset identifier;
[0009] If the first preset identifier is included, determining the first target cluster number corresponding to the first preset identifier according to the preset routing corresponding rule, and determining whether the first target cluster number matches the current cluster number, wherein the current cluster number is the cluster number corresponding to the cluster currently executing the action in the distributed trading system;
[0010] If the first target cluster ID does not match the current cluster ID, the request message is sent to the first target cluster corresponding to the first target cluster ID according to the routing request, so that the first target cluster implements the corresponding service according to the request message.
[0011] Optionally, also include:
[0012] If the first target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
[0013] Optionally, also include:
[0014] If the request message does not include the first preset identifier but includes the second preset identifier, determining the first target preset identifier corresponding to the second preset identifier according to the preset database;
[0015] Determine a second target cluster number corresponding to the first target preset identifier according to the preset routing corresponding rule;
[0016] If the second target cluster number does not match the current cluster number, sending the request message to the second target cluster corresponding to the second target cluster number according to the routing request, so that the second target cluster implements the corresponding service according to the request message;
[0017] If the second target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
[0018] Optionally, before determining whether the request message includes the first preset identifier, the method further includes:
[0019] Determine whether the request message contains a cluster forwarding flag;
[0020] If the cluster forwarding flag is not included, continue to execute the steps of determining whether the request message contains the first preset flag and subsequent steps;
[0021] If a cluster forwarding flag is included, the corresponding service is implemented according to the request message.
[0022] Optionally, if the first target cluster number does not match the current cluster number, sending the request message to a first target cluster corresponding to the first target cluster number according to the routing request includes:
[0023] If the first target cluster number does not match the current cluster number, adding a cluster forwarding flag corresponding to the current cluster to the request message to obtain a new request message;
[0024] The new request message is sent to a first target cluster corresponding to the first target cluster ID according to the routing request.
[0025] Optionally, the routing forwarding rule includes:
[0026] Determine a corresponding first cluster number according to a first preset identifier in the request message, and obtain a cluster to receive a routing request corresponding to the first cluster number;
[0027] Alternatively, if the message request does not include the first preset identifier but includes the second preset identifier, a corresponding second cluster number is randomly determined according to the second preset identifier to obtain the cluster of the routing request to be received corresponding to the second cluster number.
[0028] In a second aspect, an embodiment of the present application provides a routing exception processing device, including:
[0029] A receiving module, used to receive a routing request sent according to a preset routing forwarding rule, wherein the routing request includes a request message;
[0030] A processing module, used for determining whether the request message contains a first preset identifier;
[0031] The processing module is further configured to determine, if the first preset identifier is included, a first target cluster number corresponding to the first preset identifier according to a preset routing corresponding rule, and determine whether the first target cluster number matches a current cluster number, wherein the current cluster number is a cluster number corresponding to a cluster currently executing an action in the distributed trading system;
[0032] The processing module is further configured to send the request message to a first target cluster corresponding to the first target cluster number according to the routing request if the first target cluster number does not match the current cluster number, so that the first target cluster implements the corresponding service according to the request message.
[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0034] The memory stores computer-executable instructions;
[0035] The processor executes the computer-executable instructions stored in the memory to implement the routing exception handling method as described in any one of the first aspects.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the routing exception handling method as described in any one of the first aspects is implemented.
[0037] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, the routing exception handling method as described in any one of the first aspects is implemented.
[0038] The embodiments of the present application provide a routing exception processing method, device and electronic device. After adopting the above scheme, a routing request including a request message can be first received, and then it can be determined whether the message request includes a first preset identifier. If the first preset identifier is included, the first target cluster number corresponding to the first preset identifier can be determined according to a preset routing rule, and it is determined whether the first target cluster number matches the cluster number of the current cluster. If the first target cluster number does not match the current cluster number, the request message is sent to the first target cluster corresponding to the first target cluster number according to the routing request, so that the first target cluster implements the corresponding business according to the request message. By performing a secondary verification on the request message within the cluster and forwarding the request message that fails the verification to the corresponding cluster, the situation in which the client request cannot be accurately forwarded to the corresponding server due to network abnormalities or the lack of specific fields in the client request is reduced, the accuracy of the client request forwarding process is improved, and the normal operation of the distributed trading system is guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0040] Figure 1 A schematic diagram of the architecture of an application system for the routing exception handling method provided in an embodiment of the present application;
[0041] Figure 2 A flowchart of a method for handling routing anomalies provided in an embodiment of the present application;
[0042] Figure 3 A flowchart of a method for handling routing anomalies provided in another embodiment of the present application;
[0043] Figure 4 A schematic diagram of the structure of a routing exception processing device provided in an embodiment of the present application;
[0044] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present 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 data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can also include other sequential instances in addition to those illustrated or described. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0047] With the development of Internet technology and the increasing number of transaction requests, the distributed architecture of transaction systems is the current trend of large-scale transaction systems. In a distributed transaction system, client requests can be forwarded to various servers for processing through routing according to specified rules, thereby realizing related services. Moreover, as the business volume continues to grow, the corresponding transaction requests are also increasing. In order to cope with and process a large number of transaction requests, the distributed transaction system divides the data horizontally and deploys the application services horizontally in a multi-cluster manner to meet the needs of business expansion and support subsequent expansion. However, as the routing pressure bears more and more transactions, the possibility of abnormalities when forwarding requests is also increasing. For example, the client request may not be accurately forwarded to the corresponding server due to network abnormalities or the lack of specific fields in the client request, and there is no effective processing method for this situation in the prior art, which reduces the accuracy of client request forwarding, thereby affecting the normal operation of the distributed transaction system.
[0048] Based on the above technical problems, the present application performs a secondary verification on the request message within the cluster and forwards the request message that fails the verification to the corresponding cluster. This achieves the technical effect of reducing the situation where the client request cannot be accurately forwarded to the corresponding server due to network anomalies or the lack of specific fields in the client request, and improving the accuracy of the client request forwarding process, thereby ensuring the normal operation of the distributed trading system.
[0049] Figure 1A schematic diagram of the architecture of an application system for the routing exception handling method provided in an embodiment of the present application, such as Figure 1 As shown, the application system may include: a client 101, a processing cluster 102, and a first target cluster 103. The processing cluster 102 (i.e., the current cluster) may receive a routing request sent by the client 101 according to a preset routing forwarding rule, and make a judgment based on the request message contained in the routing request to determine whether the cluster corresponding to the routing request is the processing cluster 102. If so, the processing cluster 102 may implement the corresponding service according to the request message in the routing request; if not, the first target cluster 103 corresponding to the routing request may be further determined, and the routing request may be forwarded to the first target cluster 103, so that the first target cluster 103 may implement the corresponding service according to the request message in the routing request.
[0050] The processing cluster 102 and the first target cluster 103 are both devices in the distributed transaction system.
[0051] In addition, the client 101 may be a device that can interact with the cluster, such as a smart phone, a personal computer, a tablet, or a smart wearable device. There may be one or more clients 101, that is, the processing cluster 102 may receive a routing request sent by one client 101, or may receive routing requests sent by multiple clients 101.
[0052] In addition, when the processing cluster 102 receives routing requests sent by multiple clients 101 , the type of each client 101 may be the same or different.
[0053] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0054] Figure 2 FIG. 1 is a flow chart of a method for handling routing anomalies provided in an embodiment of the present application. The method in this embodiment can be executed by the processing cluster 102. Figure 2 As shown, the method of this embodiment may include:
[0055] S201: receiving a routing request sent according to a preset routing forwarding rule, wherein the routing request includes a request message.
[0056] In this embodiment, if the user wants to implement related services (for example, communication services, financial services, or display services), he can perform corresponding touch operations on the client to generate a routing request, which can then be sent to the corresponding cluster according to the preset routing forwarding rules, that is, the processing cluster in this application.
[0057] The preset routing forwarding rules may be implemented in a variety of ways, including:
[0058] A corresponding first cluster number is determined according to the first preset identifier in the request message, and a cluster to receive a routing request corresponding to the first cluster number is obtained.
[0059] Alternatively, if the message request does not include the first preset identifier but includes the second preset identifier, a corresponding second cluster number is randomly determined according to the second preset identifier to obtain the cluster of the routing request to be received corresponding to the second cluster number.
[0060] Correspondingly, in one implementation, if the request message of the routing request includes a first preset identifier, the first cluster number corresponding to the first preset identifier can be determined according to the first preset identifier, and the routing request is sent to the cluster corresponding to the first cluster number, that is, the processing cluster.
[0061] In addition, if the request message of the routing request does not include the first preset identifier but includes the second preset identifier, the second cluster number may be randomly determined, and the routing request is sent to the cluster corresponding to the randomly determined second cluster number, ie, the processing cluster.
[0062] Exemplarily, the first preset identifier may be a customer number, and the second preset identifier may be three elements of a customer, namely, the customer name, the customer ID type, and the customer ID number. Of course, the specific content of the first preset identifier and the second preset identifier is only an achievable embodiment. When the first preset identifier and the second preset identifier are other parameters, they are also within the protection scope of this application.
[0063] In addition, if the request message of the routing request contains neither the first preset identifier nor the second preset identifier, a message abnormality prompt can be directly generated on the client to remind the user or operation and maintenance personnel to check in time.
[0064] S202: Determine whether the request message contains a first preset identifier.
[0065] In this embodiment, after receiving the routing request, the processing cluster may be the cluster to which the routing request ultimately corresponds, or it may not be the cluster to which the routing request ultimately corresponds. Therefore, it is necessary to perform a secondary judgment based on the request message contained in the routing request, and finally forward the routing request to the corresponding cluster based on the judgment result, thereby realizing the corresponding business.
[0066] Further, the first preset identifier included in the message request can directly determine the cluster number corresponding to the routing request. Therefore, it can be determined first whether the message request includes the first preset identifier. Exemplarily, the first preset identifier can be a customer number (also called c-id).
[0067] S203: If the first preset identifier is included, determine the first target cluster number corresponding to the first preset identifier according to the preset routing corresponding rule, and determine whether the first target cluster number matches the current cluster number, wherein the current cluster number is the cluster number corresponding to the cluster currently executing the action in the distributed transaction system.
[0068] In this embodiment, if the message request includes a first preset identifier, it indicates that the cluster number corresponding to the routing request can be directly determined according to the first preset identifier, and then the cluster number corresponding to the routing request determined by the first preset identifier is reconfirmed to determine whether it is the final cluster corresponding to the routing request.
[0069] Further, the first target cluster number corresponding to the first preset identifier can be determined according to the preset routing corresponding rule. The preset routing corresponding rule can adopt the existing technology, and illustratively, can be implemented by using the Murm Hash technology. In addition, the correspondence relationship between the first preset identifier and the cluster number can be pre-set, and then the first target cluster number corresponding to the first preset identifier can be determined according to the correspondence relationship between the first preset identifier and the cluster number.
[0070] In addition, after determining the first target cluster number, it can be determined whether the first target cluster number matches the current cluster number (i.e., the number corresponding to the current processing cluster). If the first target cluster number matches the current cluster number, it indicates that the routing request has been sent to the corresponding cluster. If the first target cluster number does not match the current cluster number, it indicates that the routing request has not been sent to the corresponding cluster.
[0071] S204: If the first target cluster number does not match the current cluster number, sending the request message to the first target cluster corresponding to the first target cluster number according to the routing request, so that the first target cluster implements the corresponding service according to the request message.
[0072] In this embodiment, if the first target cluster number does not match the current cluster number, it indicates that the routing request has not been sent to the corresponding cluster. In order to ensure the normal implementation of the corresponding service, the request message can be sent to the first target cluster corresponding to the first target cluster number according to the routing request, so that the first target cluster implements the corresponding service according to the request message. Among them, the implementation of the corresponding service according to the request message can be implemented by using existing technologies, which will not be discussed in detail here.
[0073] In addition, if the first target cluster number matches the current cluster number, the corresponding service can be directly implemented according to the request message.
[0074] Specifically, communication services, financial services or display services may be implemented according to the request message.
[0075] Among them, all implementation methods of this application comply with the relevant provisions of national laws and regulations on data acquisition, storage, use, and processing.
[0076] After adopting the above scheme, a routing request including a request message can be received first, and then it can be determined whether the message request includes a first preset identifier. If it includes the first preset identifier, the first target cluster number corresponding to the first preset identifier can be determined according to the preset routing rule, and it can be determined whether the first target cluster number matches the cluster number of the current cluster. If the first target cluster number does not match the current cluster number, the request message is sent to the first target cluster corresponding to the first target cluster number according to the routing request, so that the first target cluster implements the corresponding business according to the request message. By performing a secondary verification on the request message within the cluster and forwarding the request message that fails the verification to the corresponding cluster, the situation in which the client request cannot be accurately forwarded to the corresponding server due to network anomalies or the lack of specific fields in the client request is reduced, the accuracy of the client request forwarding process is improved, and the normal operation of the distributed trading system is guaranteed.
[0077] based on Figure 2 The method, the examples of this specification also provide some specific implementation plans of the method, which are described below.
[0078] Furthermore, in another embodiment, the method may further include:
[0079] If the request message does not include the first preset identifier but includes the second preset identifier, the first target preset identifier corresponding to the second preset identifier is determined according to the preset database.
[0080] Determine a second target cluster number corresponding to the first target preset identifier according to the preset routing corresponding rule.
[0081] If the second target cluster ID does not match the current cluster ID, the request message is sent to a second target cluster corresponding to the second target cluster ID according to the routing request, so that the second target cluster implements the corresponding service according to the request message.
[0082] If the second target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
[0083] In this embodiment, in some special cases, the request message may not contain the first preset identifier, but contains the second preset identifier, that is, the request message does not contain the customer number, but contains the customer name, customer ID type and customer ID number, then the customer number corresponding to the customer name, customer ID type and customer ID number can be determined first according to the preset database, that is, the first target preset identifier. The preset database can be a third-party system or a public database. The first preset identifier can be the customer number, and the second preset identifier can be the customer name, customer ID type and customer ID number.
[0084] In addition, the customer's name, customer ID type and customer ID number can also be collectively referred to as the three elements of the customer. For example, they can be expressed as the customer's name (also called u_name), the customer ID type (also called u_idtype), and the customer ID number (also called u_idcode).
[0085] After determining the first target preset identifier, the second target cluster number corresponding to the first target preset identifier can be determined according to the preset routing corresponding rule. Then determine whether the second target cluster number matches the current cluster number. If the second target cluster number matches the current cluster number, it indicates that the routing request has been sent to the corresponding cluster; if the second target cluster number does not match the current cluster number, it indicates that the routing request has not been sent to the corresponding cluster, then the request message can be sent to the second target cluster corresponding to the second target cluster number according to the routing request, so that the second target cluster implements the corresponding service according to the request message.
[0086] Among them, all implementation methods of this application comply with the relevant provisions of national laws and regulations on data acquisition, storage, use, and processing.
[0087] After adopting the above scheme, when the request message does not contain the first preset identifier, it is also possible to implement secondary verification of the request message within the cluster, and forward the requests that fail the verification to the corresponding cluster, thereby ensuring the protection of routing anomalies, improving the accuracy of routing, and ensuring the normal operation of the system.
[0088] In addition, in another embodiment, before S202, the method may further include:
[0089] It is determined whether the request message contains a cluster forwarding flag.
[0090] If the cluster forwarding flag is not included, continue to execute the steps of determining whether the request message contains the first preset flag and subsequent steps.
[0091] If a cluster forwarding flag is included, the corresponding service is implemented according to the request message.
[0092] In this embodiment, after the processing cluster receives the routing request, it can first determine whether the request message included in the routing request contains a cluster forwarding flag. If the cluster forwarding flag is included, it indicates that the routing request is forwarded by other clusters. In order to avoid the routing request from infinitely looping between clusters, when it is determined that the request message contains the cluster forwarding flag, the routing request is no longer forwarded to other clusters, but the corresponding service is directly implemented according to the request message, which improves the processing efficiency of the routing request and also saves the computing power of the cluster.
[0093] In addition, if the request message does not contain a cluster forwarding flag, it can continue to determine whether the request message contains a first preset identifier. If the first preset identifier is contained, the first target cluster number corresponding to the first preset identifier is determined according to the preset routing corresponding rule, and it is determined whether the first target cluster number matches the current cluster number. If the first target cluster number does not match the current cluster number, the request message is sent to the first target cluster corresponding to the first target cluster number according to the routing request, so that the first target cluster implements the corresponding service according to the request message. If the first target cluster number matches the current cluster number, the corresponding service is implemented according to the request message. If the request message does not contain the first preset identifier and contains the second preset identifier, the first target preset identifier corresponding to the second preset identifier is determined according to the preset database. The second target cluster number corresponding to the first target preset identifier is determined according to the preset routing corresponding rule. If the second target cluster number does not match the current cluster number, the request message is sent to the second target cluster corresponding to the second target cluster number according to the routing request, so that the second target cluster implements the corresponding service according to the request message. If the second target cluster number matches the current cluster number, the corresponding service is implemented according to the request message.
[0094] The form of the cluster forwarding flag can be customized according to the actual application scenario. Exemplarily, the cluster forwarding flag can be set to the cluster number of the forwarding cluster. For example, if the routing request is forwarded from cluster A to cluster B, the cluster forwarding flag of the routing request can be set to A. This setting method can intuitively determine the source of the routing request, which is convenient for subsequent maintenance.
[0095] In addition, the request message may also include a cluster forwarding flag, which may be:
[0096] If the first target cluster ID does not match the current cluster ID, a cluster forwarding flag corresponding to the current cluster is added to the request message to obtain a new request message.
[0097] The new request message is sent to a first target cluster corresponding to the first target cluster ID according to the routing request.
[0098] In this embodiment, when the first target cluster number does not match the current cluster number, a cluster forwarding flag may be first added to the request message to obtain a new request message, and then the new request message may be sent to the first target cluster corresponding to the first target cluster number. When the first target cluster receives the routing request, it may first determine whether the request message of the received routing request contains a cluster forwarding flag. If the cluster forwarding flag is contained, the corresponding service may be directly implemented according to the request message in the routing request.
[0099] In addition, in the process of forwarding routing requests, there may be forwarding anomalies, that is, the routing request originally sent to the first target cluster for processing is forwarded to other clusters. At this time, you can still first determine whether the request message of the routing request contains a cluster forwarding flag. If it does, other clusters can directly process the routing request and then implement the corresponding business, ensuring the normal implementation of the business.
[0100] Among them, all implementation methods of this application comply with the relevant provisions of national laws and regulations on data acquisition, storage, use, and processing.
[0101] Figure 3 A flowchart of a method for handling routing anomalies provided in another embodiment of the present application is shown in FIG. Figure 3 As shown, in this embodiment:
[0102] The client can first generate a routing request, and then determine whether the routing request contains a first preset identifier. If the first preset identifier is contained, the corresponding cluster number can be determined according to the first preset identifier and forwarded to the corresponding cluster. If the first preset identifier is not contained but the second preset identifier is contained, the cluster number can be randomly determined, and the routing request is sent to the randomly determined cluster number.
[0103] After forwarding the routing request to the processing cluster (i.e., the cluster corresponding to the first preset identifier or the cluster randomly determined according to the second preset identifier), the secondary verification process can be started, that is, first determine whether the request message contains the cluster forwarding flag. If it does, the corresponding service can be directly implemented according to the request message. If not, it can be determined whether the request message contains the first preset identifier. If it does, the first target cluster number can be determined according to the first preset identifier, and then it can be determined whether the first target cluster number is consistent with the current processing cluster number. If they are consistent, the corresponding service can be directly implemented. If they are inconsistent, the routing request can be sent to the first target cluster.
[0104] In addition, if the message request does not contain the first preset identifier but contains the second preset identifier, the first target preset identifier corresponding to the second preset identifier can be determined according to the second preset identifier and the preset database, and the second target cluster number can be determined according to the first target preset identifier, and then it is determined whether the second target cluster number is consistent with the current processing cluster number. If they are consistent, the corresponding service can be directly implemented. If they are inconsistent, the routing request can be sent to the second target cluster.
[0105] Furthermore, Table 1 is a request message information table. As shown in Table 1, the first preset identifier can be the customer number (also called c_id), the second preset identifier can be three elements of the customer, namely, the customer name (also called u_name), the customer ID type (also called u_idtype), and the customer ID number (also called u_idcode), and the cluster forwarding flag can be represented by q_flag.
[0106] Table 1 Request message information table
[0107]
[0108] Among them, all implementation methods of this application comply with the relevant provisions of national laws and regulations on data acquisition, storage, use, and processing.
[0109] After adopting the above solution, when the router forwards the request to a non-corresponding cluster, the corresponding cluster adds a routing backup mechanism to ensure the accuracy of request processing by verifying the message. At the same time, the message processed by the non-current cluster can be forwarded to the corresponding cluster, which can ensure the correctness of the transaction, improve the security of the system, and ensure the stable operation of the system.
[0110] Based on the same idea, the embodiments of this specification also provide a device corresponding to the above method. Figure 4 A schematic diagram of the structure of the routing exception processing device provided in the embodiment of the present application is shown in FIG. Figure 4 As shown, the device provided in this embodiment may include:
[0111] The receiving module 401 is used to receive a routing request sent according to a preset routing forwarding rule, wherein the routing request includes a request message.
[0112] The routing forwarding rules include:
[0113] Determine a corresponding first cluster number according to a first preset identifier in the request message, and obtain a cluster to receive a routing request corresponding to the first cluster number;
[0114] Alternatively, if the message request does not include the first preset identifier but includes the second preset identifier, a corresponding second cluster number is randomly determined according to the second preset identifier to obtain the cluster of the routing request to be received corresponding to the second cluster number.
[0115] The processing module 402 is used to determine whether the request message contains a first preset identifier.
[0116] The processing module 402 is further configured to determine, if the first preset identifier is included, a first target cluster number corresponding to the first preset identifier according to a preset routing corresponding rule, and determine whether the first target cluster number matches a current cluster number, wherein the current cluster number is a cluster number corresponding to a cluster currently executing an action in a distributed trading system.
[0117] The processing module 402 is further configured to send the request message to a first target cluster corresponding to the first target cluster number according to the routing request if the first target cluster number does not match the current cluster number, so that the first target cluster implements the corresponding service according to the request message.
[0118] In this embodiment, the processing module 402 is further used for:
[0119] If the first target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
[0120] In addition, in another embodiment, the processing module 402 is further configured to:
[0121] If the request message does not include the first preset identifier but includes the second preset identifier, the first target preset identifier corresponding to the second preset identifier is determined according to the preset database.
[0122] Determine a second target cluster number corresponding to the first target preset identifier according to the preset routing corresponding rule.
[0123] If the second target cluster ID does not match the current cluster ID, the request message is sent to a second target cluster corresponding to the second target cluster ID according to the routing request, so that the second target cluster implements the corresponding service according to the request message.
[0124] If the second target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
[0125] In addition, in another embodiment, the processing module 402 is further configured to:
[0126] It is determined whether the request message contains a cluster forwarding flag.
[0127] If the cluster forwarding flag is not included, continue to execute the steps of determining whether the request message contains the first preset flag and subsequent steps.
[0128] If a cluster forwarding flag is included, the corresponding service is implemented according to the request message.
[0129] In addition, in another embodiment, the processing module 402 is further configured to:
[0130] If the first target cluster ID does not match the current cluster ID, a cluster forwarding flag corresponding to the current cluster is added to the request message to obtain a new request message.
[0131] The new request message is sent to a first target cluster corresponding to the first target cluster ID according to the routing request.
[0132] Among them, all implementation methods of this application comply with the relevant provisions of national laws and regulations on data acquisition, storage, use, and processing.
[0133] The device provided in the embodiment of the present application can realize the above-mentioned Figure 2 The implementation principle and technical effect of the method in the embodiment shown are similar and will not be described in detail here.
[0134] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the device 500 provided in this embodiment includes: a processor 501 and a memory connected to the processor in communication. The processor 501 and the memory 502 are connected via a bus 503 .
[0135] In a specific implementation process, the processor 501 executes the computer execution instructions stored in the memory 502, so that the processor 501 executes the routing exception processing method in the above method embodiment.
[0136] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0137] In the above Figure 5In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0138] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk storage.
[0139] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0140] The embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the routing exception handling method of the above method embodiment is implemented.
[0141] An embodiment of the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the routing exception processing method as described above is implemented.
[0142] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0143] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0144] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for handling routing exceptions, characterized in that: include: Receiving a routing request sent according to a preset routing forwarding rule, wherein the routing request includes a request message; Determine whether the request message contains a cluster forwarding flag; If a cluster forwarding flag is included, the corresponding service is implemented according to the request message; If the cluster forwarding flag is not included, determining whether the request message includes a first preset flag; If the first preset identifier is included, determining the first target cluster number corresponding to the first preset identifier according to the preset routing corresponding rule, and determining whether the first target cluster number matches the current cluster number, wherein the current cluster number is the cluster number corresponding to the cluster currently executing the action in the distributed trading system; If the first target cluster number does not match the current cluster number, sending the request message to the first target cluster corresponding to the first target cluster number according to the routing request, so that the first target cluster implements the corresponding service according to the request message; Also includes: If the request message does not include the first preset identifier but includes the second preset identifier, determining the first target preset identifier corresponding to the second preset identifier according to the preset database; Determine a second target cluster number corresponding to the first target preset identifier according to the preset routing corresponding rule; If the second target cluster number does not match the current cluster number, sending the request message to the second target cluster corresponding to the second target cluster number according to the routing request, so that the second target cluster implements the corresponding service according to the request message; If the second target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
2. The method according to claim 1, characterized in that Also includes: If the first target cluster ID matches the current cluster ID, the corresponding service is implemented according to the request message.
3. The method according to claim 1, characterized in that If the first target cluster number does not match the current cluster number, sending the request message to the first target cluster corresponding to the first target cluster number according to the routing request includes: If the first target cluster number does not match the current cluster number, adding a cluster forwarding flag corresponding to the current cluster to the request message to obtain a new request message; The new request message is sent to a first target cluster corresponding to the first target cluster ID according to the routing request.
4. The method according to any one of claims 1 to 3, characterized in that: The routing forwarding rules include: Determine a corresponding first cluster number according to a first preset identifier in the request message, and obtain a cluster to receive a routing request corresponding to the first cluster number; Alternatively, if the message request does not include the first preset identifier but includes the second preset identifier, a corresponding second cluster number is randomly determined according to the second preset identifier to obtain the cluster of the routing request to be received corresponding to the second cluster number.
5. A routing exception processing device, characterized in that: include: A receiving module, used to receive a routing request sent according to a preset routing forwarding rule, wherein the routing request includes a request message; A processing module, used for determining whether the request message contains a first preset identifier; The processing module is further configured to determine, if the first preset identifier is included, a first target cluster number corresponding to the first preset identifier according to a preset routing corresponding rule, and determine whether the first target cluster number matches a current cluster number, wherein the current cluster number is a cluster number corresponding to a cluster currently executing an action in the distributed trading system; The processing module is further configured to send the request message to a first target cluster corresponding to the first target cluster number according to the routing request if the first target cluster number does not match the current cluster number, so that the first target cluster implements the corresponding service according to the request message; The processing module is further used for: If the request message does not include the first preset identifier but includes the second preset identifier, determining the first target preset identifier corresponding to the second preset identifier according to the preset database; Determine a second target cluster number corresponding to the first target preset identifier according to the preset routing corresponding rule; If the second target cluster number does not match the current cluster number, sending the request message to the second target cluster corresponding to the second target cluster number according to the routing request, so that the second target cluster implements the corresponding service according to the request message; If the second target cluster number matches the current cluster number, implementing the corresponding service according to the request message; The processing module is further used for: Determine whether the request message contains a cluster forwarding flag; If the cluster forwarding flag is not included, continue to execute the steps of determining whether the request message contains the first preset flag and subsequent steps; If a cluster forwarding flag is included, the corresponding service is implemented according to the request message.
6. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the routing exception processing method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the routing exception processing method according to any one of claims 1 to 4 is implemented.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the routing exception processing method according to any one of claims 1 to 4 is implemented.
