WO2020258653A1 - 一种跨节点的数据处理方法及装置 - Google Patents

一种跨节点的数据处理方法及装置 Download PDF

Info

Publication number
WO2020258653A1
WO2020258653A1 PCT/CN2019/117516 CN2019117516W WO2020258653A1 WO 2020258653 A1 WO2020258653 A1 WO 2020258653A1 CN 2019117516 W CN2019117516 W CN 2019117516W WO 2020258653 A1 WO2020258653 A1 WO 2020258653A1
Authority
WO
WIPO (PCT)
Prior art keywords
sub
node
processes
message
routing information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/117516
Other languages
English (en)
French (fr)
Inventor
刘建波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Publication of WO2020258653A1 publication Critical patent/WO2020258653A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/465Distributed object oriented systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • G06F9/548Object oriented; Remote method invocation [RMI]

Definitions

  • the present invention relates to the field of computer technology in financial technology (Fintech), and in particular to a cross-node data processing method and device.
  • Distributed transaction provides a mechanism to incorporate all operations involved in an activity into an indivisible execution unit. All operations that make up a transaction can only be submitted when all operations can be executed normally, as long as any operation fails. Will cause the rollback of the entire transaction.
  • the peripheral system calls the nodes separately, that is, the first node is called first, and the second node is called after the first node is processed.
  • This method requires multiple interactions between the peripheral system and more than one node, and the interaction process between the peripheral system and the node is complicated and cumbersome, and it is difficult to ensure the consistency of transactions.
  • This application provides a cross-node data processing method and device to reduce the difficulty of remote invocation of peripheral systems.
  • An embodiment of the present invention provides a cross-node data processing method, including:
  • the first node receives the data processing message
  • the first node parses the data processing message, determines the main process and determines whether the main process contains N sub-processes, N ⁇ 1;
  • the first node executes the main process and sequentially determines the nodes corresponding to the N sub-processes;
  • the first node executes the first sub-process
  • the first sub-process is a sub-process in which the corresponding node of the N sub-processes is the first node
  • the first node For the second sub-process, the first node generates a message to be processed according to the second sub-process, and sends the message to be processed to the second node so that the second node can
  • the packet is processed and the sub-process is executed;
  • the second sub-process is a sub-process in which the corresponding node in the N sub-processes is a second node, and the second node is a node other than the first node.
  • the method further includes:
  • the first node determines the configuration information of the N sub-processes
  • the first node sequentially determining the nodes corresponding to the N sub-processes includes:
  • the first node obtains the routing information of the sub-process from the configuration information of the sub-process;
  • the first node determines the node corresponding to the sub-process according to the routing information of the sub-process.
  • the first node determining the node corresponding to the sub-process according to the routing information of the sub-process includes:
  • routing information of the sub-process is a local message, determine that the node corresponding to the sub-process is the first node;
  • routing information of the sub-process is the global service location GSL, determining that the node corresponding to the sub-process is the second node;
  • routing information of the sub-process is a specific identifier
  • look up the correspondence between the specific identifier and the node identifier and if the specific identifier corresponds to the identifier of the first node, determine the node corresponding to the sub-process Is the first node; if the specific identifier corresponds to the identifier of the second node, it is determined that the node corresponding to the sub-process is the second node.
  • the first node for a sub-process where the corresponding node is the second node, the first node generates a message to be processed according to the sub-process, and sends the message to be processed to the second node Before sending, it also includes:
  • the first node determines that the corresponding node is the operation data of the sub-process of the first node
  • the first node submits the operation data to the database of the first node.
  • the method further includes:
  • the first node monitors the execution process of the main process and the sub-processes
  • the performing a reverse operation on the first sub-process to the M-1th sub-process includes:
  • the first node obtains the operation data of the sub-process from the database of the first node;
  • the sub-process is the first sub-process, directly perform a reverse operation on the first sub-process;
  • the sub-process is the second sub-process, perform a remote reverse operation on the second sub-process.
  • a cross-node data processing device includes:
  • the transceiver unit is used to receive data processing messages
  • the parsing unit is used to parse the data processing message, determine the main process and determine whether the main process contains N sub-processes, N ⁇ 1;
  • the execution unit is configured to execute the main process if the main process includes N sub-processes, and sequentially determine the nodes corresponding to the N sub-processes; for the first sub-process, execute the first sub-process, the first A sub-process is a sub-process in which the corresponding node in the N sub-processes is the first node;
  • the transceiver unit is further configured to generate a message to be processed according to the second sub-process for the second sub-process, and send the message to be processed to the second node, so that the second node can
  • the message to be processed executes the second sub-process;
  • the second sub-process is a sub-process in which the corresponding node in the N sub-processes is a second node, and the second node is a sub-process except the first node Outside the node.
  • the parsing unit is further configured to determine the configuration information of the N sub-processes if the main process includes N sub-processes;
  • the execution unit is further configured to obtain the routing information of the sub-process from the configuration information of the sub-process for any one of the N sub-processes; determine the routing information of the sub-process according to the routing information of the sub-process The node corresponding to the sub-process.
  • the execution unit is specifically configured to:
  • routing information of the sub-process is a local message, determine that the node corresponding to the sub-process is the first node;
  • routing information of the sub-process is the global service location GSL, determining that the node corresponding to the sub-process is the second node;
  • routing information of the sub-process is a specific identifier
  • look up the correspondence between the specific identifier and the node identifier and if the specific identifier corresponds to the identifier of the first node, determine the node corresponding to the sub-process Is the first node; if the specific identifier corresponds to the identifier of the second node, it is determined that the node corresponding to the sub-process is the second node.
  • the execution unit is further configured to:
  • a monitoring unit is further included for:
  • the monitoring unit is specifically configured to:
  • the sub-process is the first sub-process, directly perform a reverse operation on the first sub-process;
  • the sub-process is the second sub-process, perform a remote reverse operation on the second sub-process.
  • the embodiment of the present invention also provides an electronic device, including:
  • At least one processor and,
  • a memory communicatively connected with the at least one processor; wherein,
  • the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the method described above.
  • the embodiment of the present invention also provides a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium storing computer instructions, and the computer instructions are used to make the computer execute the method described above.
  • the first node after receiving the data processing message of the peripheral system, determines the main process according to the data processing message, and determines whether the main process includes sub-processes. If the main process includes N sub-processes, the first node executes the main process and sequentially determines the nodes corresponding to the N sub-processes. According to the nodes corresponding to the sub-processes, the N sub-processes can be divided into a first sub-process and a second sub-process, wherein the node corresponding to the first sub-process is the first node, and the node corresponding to the second sub-process is the second node.
  • the first node since the corresponding node is the first node, the first node directly executes the first sub-process.
  • the first node For the second sub-process, the first node generates a message to be processed according to the second sub-process and sends it to the second node so that the second node executes the second sub-process according to the message to be processed.
  • the peripheral system does not need to frequently interact with nodes, and only needs to send data processing messages to one node, and subsequent processes are solved internally between nodes, and the execution process is simple and does not require human intervention. This reduces the data transmission pressure of peripheral systems and nodes and saves network resources.
  • the transaction processing standards can be uniformly formulated and ensured by the system, thereby ensuring the consistency of distributed transactions.
  • Figure 1 is a schematic structural diagram of a possible system architecture provided by an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a cross-node data processing method provided by an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a cross-node data processing method and apparatus according to an embodiment of the present invention.
  • Fig. 4 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
  • a system architecture to which the embodiment of the present invention is applicable includes a peripheral system 101 and N account nodes 102.
  • the peripheral system 101 can be a client installed on a terminal or an operating system installed on a server.
  • the terminal can be an electronic device with wireless communication functions such as a mobile phone, a tablet computer, or a dedicated handheld device, or it can be It is a personal computer (personal computer, PC for short), notebook computer, server and other wired access devices connected to the Internet.
  • the terminal can be an independent device or a terminal cluster formed by multiple terminals.
  • the terminal can use cloud computing technology for information processing.
  • the account node 102 may be a network device such as a computer, it may be an independent device, or a server cluster formed by multiple servers.
  • the N account nodes 102 can be installed on N servers or less than N servers, that is, there are two or more account nodes 102 installed on the same server.
  • the account node 102 can use cloud computing technology for information processing.
  • the peripheral system 101 can communicate with the account node 102 through the INTERNET network, or through mobile communication systems and account nodes such as the Global System for Mobile Communications (GSM), long term evolution (LTE) system, etc. 102 to communicate.
  • the peripheral system 101 can also remotely call the account node 102 through RMB, or through other methods such as RPC.
  • Message middleware the infrastructure system responsible for message transmission, such as ESB, Dubbo, RocketMQ, Kafka, Solace, etc., suitable for distributed environments that require reliable data transmission.
  • ESB the infrastructure system responsible for message transmission
  • Dubbo the infrastructure system responsible for message transmission
  • RocketMQ the infrastructure system responsible for message transmission
  • Kafka the infrastructure system responsible for message transmission
  • Solace the infrastructure system responsible for message transmission
  • different objects pass messages to activate each other's events and complete corresponding operations.
  • the sender sends the message to the message server, and the message server stores the message in several queues, and then forwards the message to the receiver when appropriate.
  • Message middleware can communicate between different platforms. It is often used to shield the characteristics of various platforms and protocols to achieve collaboration between applications. Its advantage is that it can provide synchronization and asynchronous between the client and the server.
  • the connection, and the message can be transmitted or stored and forwarded at any time.
  • Routing service system an infrastructure system used to maintain the relationship between card numbers, account numbers, customer numbers, etc. and node numbers.
  • the distributed service architecture is a cluster networking, which means that there is a multi-instance deployment of a service in the cluster, and the routing service system can select an appropriate service provider from the service list to call.
  • the distributed service framework must be able to meet the flexible routing needs of users.
  • AOP Aspect-oriented programming technology used to define interceptors.
  • the distributed deposit core system is a multi-node model.
  • Account data is distributed among multiple database nodes.
  • Cross-node scenarios may occur in transactions between accounts. For example, account A is stored in the database of account node 1, and account B is stored in the database of account node 2. To realize the transfer from account A to account B, a cross-node transaction scenario is formed.
  • the peripheral system first calls the debit interface of account node 1 to execute the fund transfer operation of account A, and then calls the credit interface of account node 2 to execute the funds of account B Transfer to operation. Before performing fund operations, the conditions of account A and account B need to be checked. Therefore, the peripheral system needs to interact with the account node 1 and the account node 2 frequently. In addition, different peripheral systems interact with account nodes, and it is difficult to ensure the consistency of distributed transactions.
  • an embodiment of the present invention provides a cross-node data processing method.
  • the cross-node data processing method provided by the embodiment of the present invention includes the following steps:
  • Step 201 The first node receives a data processing message.
  • the data processing message includes the account information involved in the message.
  • the data processing message involves more than one account, and these accounts are distributed in different account nodes.
  • the peripheral system can look up the correspondence between the account identifier and the node identifier through the message middleware, determine the account node specifically involved in the data processing message, and send the data processing message to any of the account nodes.
  • the peripheral system can send the transfer request to the debit node or the lender node.
  • the peripheral system sends the transfer request to the message middleware, and the message middleware selects one of the debit node and the credit node to accept the transfer request.
  • the first node and the second node can be any node in the system, the first node is the node that receives the data processing message, and the second node is in addition to the first node, the data processing message also involves
  • the number of second nodes can be one or more.
  • node A is the first node and node B is the second node, in other scenarios, node A is the second node, and node B is the first node.
  • Step 202 The first node parses the data processing message, determines the main process, and determines whether the main process contains N sub-processes.
  • the first node after receiving the data processing message, the first node establishes the main process according to the data processing message, and determines N subprocesses according to the involved execution process, where N ⁇ 0.
  • the main process is a transfer
  • the transfer process calls other processes, the called process is a sub-process.
  • the debit node needs to perform the following process:
  • the lender node needs to perform the following process:
  • the sub-process needs to be called for the transfer request.
  • the main process is transfer, and the transfer calls debit check, then debit check is a sub-process.
  • debit check is the main process. Therefore, it can be determined that the transfer request involves the following processes:
  • Sub-process debit check, dr-check
  • Sub-process debit processing, dr-process
  • Sub-process credit processing, cr-process.
  • each process is given a unique transaction code, that is, the transaction code for transfer is fund-transfer, the debit check is dr-check, and so on.
  • Step 203 The first node executes the main process, and sequentially determines nodes corresponding to the N sub-processes.
  • the first node executes the main process, and the sub-processes need to be called sequentially during the execution of the main process.
  • the call of the sub-process can be executed in parallel or serially.
  • Step 204 For a first sub-process, the first node executes the first sub-process, and the first sub-process is a sub-process in which the corresponding node of the N sub-processes is the first node.
  • the first sub-process here is a type of sub-process, that is, the corresponding node is a sub-process of the first node, and the main process may include one first sub-process or multiple first sub-processes.
  • the second sub-process is also a type of sub-process, that is, the corresponding node is a sub-process of the first node, and the main process may include one second sub-process or multiple second sub-processes.
  • Step 205 For the second sub-process, the first node generates a message to be processed according to the second sub-process, and sends the message to be processed to the second node, so that the second node The message to be processed executes the second sub-process; the second sub-process is a sub-process in which the corresponding node in the N sub-processes is a second node, and the second node is a sub-process except the first node Outside the node.
  • step 204 may be executed before step 205, or step 204 may be executed after step 205, or step 204 and step 205 may be executed simultaneously.
  • the first node after receiving the data processing message of the peripheral system, determines the main process according to the data processing message, and determines whether the main process includes sub-processes. If the main process includes N sub-processes, the first node executes the main process and sequentially determines the nodes corresponding to the N sub-processes. According to the nodes corresponding to the sub-processes, the N sub-processes can be divided into a first sub-process and a second sub-process, wherein the node corresponding to the first sub-process is the first node, and the node corresponding to the second sub-process is the second node.
  • the first node since the corresponding node is the first node, the first node directly executes the first sub-process.
  • the first node For the second sub-process, the first node generates a message to be processed according to the second sub-process and sends it to the second node so that the second node executes the second sub-process according to the message to be processed.
  • the peripheral system does not need to frequently interact with nodes, and only needs to send data processing messages to one node, and subsequent processes are solved internally between nodes, and the execution process is simple and does not require human intervention. This reduces the data transmission pressure of peripheral systems and nodes and saves network resources.
  • the transaction processing standards can be uniformly formulated and ensured by the system, thereby ensuring the consistency of distributed transactions.
  • the method further includes:
  • the first node sequentially determining the nodes corresponding to the N sub-processes includes:
  • the first node obtains the routing information of the sub-process from the configuration information of the sub-process;
  • the first node determines the node corresponding to the sub-process according to the routing information of the sub-process.
  • a call interface is defined, and the peripheral system sends a data processing message in a specified format to the node.
  • the data processing message can obtain the corresponding process and the configuration information of the process through the call interface.
  • the interface name is Flow ⁇ I,O>
  • the interface contains a definition of an O execute (I InputDTO) method, where I represents the input data type, namely InputDTO; O represents the output data type, namely OutputDTO.
  • I InputDTO O execute
  • the output type can be in the form of a table, and the specific output content and output format can be defined by the developer as needed, for example, as shown in Table 1:
  • routing_keys is divided into dynamic routing keywords and static routing keywords.
  • the dynamic routing keyword is InputDTO, that is, the attribute identifier in the input data processing message, such as card number (cardNo), account number (accountNo), etc.
  • the node identifier corresponding to the attribute identifier can be found from the routing service system, and then routing is performed according to the node identifier.
  • Static routing keywords include two types, namely GSL (Global Service Location) and LOCAL (or null).
  • GSL Global Service Location
  • LOCAL or null
  • GSL means that the message middleware automatically finds the node ID, that is, the process is not executed locally, and the corresponding node needs to be called remotely.
  • LOCAL means that the process is executed locally without routing.
  • remote_service_id is the service number of the remote service called when sending a message through the message middleware.
  • has_rev_event mark whether the process has registered the corresponding reversal event in the database, you can use "1" to indicate registered, and "null” to indicate not registered.
  • the reversal event is the reverse operation of the current process, used for abnormal reversal or post-event reversal transactions.
  • txn_code routing_keys remote_service_id has_rev_event description fund-transfer null null null Transfer dr-check cardNo,accountNo 01000001 null Debit check cr-check cardNo,accountNo 01000002 null Credit check dr-process cardNo,accountNo 01000003 1 Debit processing cr-process cardNo,accountNo 01000004 1 Credit processing
  • the content of Table 2 can be converted into a HashMap, named flowDefMap and saved.
  • the configuration information shown in Table 2 is obtained by parsing. Further according to the routing information in the configuration information, namely routing_keys, the node corresponding to the sub-process is determined.
  • the first node determining the node corresponding to the sub-process according to the routing information of the sub-process includes:
  • routing information of the sub-process is a local message, determine that the node corresponding to the sub-process is the first node;
  • routing information of the sub-process is the global service location GSL, determining that the node corresponding to the sub-process is the second node;
  • routing information of the sub-process is a specific identifier
  • look up the correspondence between the specific identifier and the node identifier and if the specific identifier corresponds to the identifier of the first node, determine the node corresponding to the sub-process Is the first node; if the specific identifier corresponds to the identifier of the second node, it is determined that the node corresponding to the sub-process is the second node.
  • the routing information of the sub-process is a local message, that is, the content of routing_keys in Table 2 is LOCAL or null, it means that the node corresponding to the sub-process is the first node and is directly executed locally. If the routing information of the sub-process is GSL, it means that the message middleware needs to find the corresponding node identifier for the sub-process. Therefore, the node corresponding to the sub-process is the second node.
  • routing information of the sub-process is a specific identifier, that is, cardNo, accountNo in Table 2, which means that the routing information of the sub-process is a dynamic routing key
  • the routing service system Find the corresponding node ID. If the corresponding node identifier is the identifier of the current first node, it is still executed locally; if the node identifier is not the current first node identifier, it indicates that the node corresponding to the sub-process is the second node, and the remote call is converted. In particular, if the node ID is null, it means that the input is incorrect and the execution process is stopped. In addition, when there are multiple routing information, the node ID found first shall prevail.
  • the relationship between routing information and node identification can be stored in the thread cache, and can be queried from the cache next time.
  • the first node generates a message to be processed according to the sub-process, and before sending the message to be processed to the second node, the method further includes :
  • the first node determines that the corresponding node is the operation data of the sub-process of the first node
  • the first node submits the operation data to the database of the first node.
  • the method further includes:
  • the first node monitors the execution process of the main process and the sub-processes
  • the entire main process and the execution process of each sub-process need to be monitored.
  • the transaction in the local database is rolled back, and then it is judged whether there is a cross-node sub-process in the sub-process before the M-th sub-process. If not, it means that all previous sub-processes are executed at the current first node. Therefore, for the first sub-process that has been processed in the same node under the same main process, there is only one transaction in the local database and it has been Roll back, so you can directly report error feedback and end the process.
  • the current first node has already submitted the database transaction for the first sub-process previously processed.
  • the first sub-process previously processed and the first sub-process that has been rolled back are not the same in the database. Transaction, so you need to perform the reverse operation on the first sub-process previously processed.
  • the remote second node may also have committed the database transaction. Therefore, the second sub-process of the second node also needs to perform a reverse operation.
  • the main process includes sub-process A, sub-process B, sub-process C, and sub-process D, where sub-process A, sub-process B, and sub-process C are processed in the first node, and sub-process C is processed in the second node . If an exception occurs during the execution of sub-process B, since both sub-process A and sub-process B are processed in the first node, and there is no cross-node sub-process in between, then sub-process A and sub-process B are in the database of the first node It is stored in one transaction, so it can be rolled back directly.
  • sub-process D since the sub-process before sub-process D includes the sub-process C processed by the second node, the reverse operation of sub-process C needs to be performed, that is, the correction of sub-process C .
  • the reverse operation of sub-process C since there is a cross-node behavior between sub-process B and sub-process D, it is necessary to make corrections for sub-process A and sub-process B.
  • performing a reverse operation on the first sub-process to the M-1th sub-process includes:
  • the first node obtains the operation data of the sub-process from the database of the first node;
  • the sub-process is the first sub-process, directly perform a reverse operation on the first sub-process;
  • the sub-process is the second sub-process, perform a remote reverse operation on the second sub-process.
  • the correction mechanism is more complicated because of the database transactions involving multiple nodes. Therefore, in the embodiment of the present invention, the hedging mechanism is uniformly prescribed in advance, and the correction process involves the sub-process log table and the correction event table.
  • General reconciliation service general reconciliation process. among them:
  • the sub-process log table is used to record the information of the sub-processes that have been executed, including whether it contains a reversal event, whether it is a remote call, remote call node number, remote call serial number, etc.
  • Reverse event table when the sub-process is executed, the business developer records the reverse operation in the database, which is the reversal event.
  • the reversal event When a reversal or reversal of the sub-process needs to be performed, the reversal event will be executed, so that the transaction in the database of the sub-process is offset.
  • General reversal service traverse the specified sub-process log table, perform reverse operations for reversal or reversal according to the historical execution records of the sub-process.
  • the general correction process is used to call the general correction service.
  • the general reconciliation process is not only suitable for cross-node reconciliation, but also for reconciliation transactions initiated by peripheral systems.
  • the first node needs to query the historical execution records of each sub-process from the sub-process log table of the local database. If the sub-processes that have been processed do not include transaction-type sub-processes, that is, sub-processes that affect the consistency of the database transaction, there is no need to process them. For example, the sub-processes that have been processed are all query-type sub-processes, and there is no need to perform a correction, and abnormal feedback can be directly sent to the peripheral system. If a transaction sub-process is included, it is also necessary to determine whether the transaction sub-process is executed in the first node or in the second node.
  • the first sub-process then directly perform the reverse operation on the first sub-process. Specifically, it may be to find the reversal event corresponding to the first sub-process from the local database of the first node, and perform the reversal to the first sub-process. The execution of a sub-process is offset. If it is the second sub-process, perform a remote reverse operation on the second sub-process, that is, determine the serial number, node identification and other information corresponding to the second sub-process, thereby determining the second node corresponding to the second sub-process, and then call For the general correction service of the second node, the second node corrects the second sub-process.
  • the reconciliation process initiated by the peripheral system is also called the general reconciliation process to perform the reconciliation.
  • the embodiment of the present invention realizes local automatic correction and remote correction after a transaction failure.
  • the bottom-level correction mechanism is completely transparent to the peripheral system, and users only need to record the correction event when writing the process.
  • the system architecture includes client, transaction processing system, and deposit core system. And the financial management system, where the deposit core system and the financial management system are the corresponding subsystems of the sub-transactions.
  • Step S301 The peripheral system sends a transfer request to the message middleware, and the transfer request includes the debit account identifier and the credit account identifier.
  • Step S302 The message middleware sends the transfer request to the first node where the debit account is located according to the debit account identifier.
  • Step S303 According to the transfer request, the first node determines that the main process is transfer, and the four sub-processes are debit check, credit check, debit processing, and credit processing in sequence, and at the same time establish and save the configuration information corresponding to the transfer request table.
  • Step S304 the first node executes the main process.
  • Step S305 The first node obtains the debit check routing information from the configuration information table as the debit account identifier, and then finds the node corresponding to the debit account identifier from the routing service system as the first node, and then performs the debit check. If the debit check passes, step 306 is executed, otherwise the processing failure result is fed back to the peripheral system.
  • Step S306 The first node obtains the routing information of the credit check from the configuration information table as the credit account identifier, and then finds the node corresponding to the credit account identifier from the routing service system as the second node, and then sets the operation data corresponding to the debit check Submit to the local database, and then generate a credit check message and send it to the second node.
  • Step S307 The first node receives the credit check result sent by the second node, and if the credit check passes, step 308 is executed, otherwise the processing failure result is fed back to the peripheral system.
  • Step S308 The first node obtains the routing information of the debit processing as the debit account identifier from the configuration information table, determines that the node corresponding to the debit account identifier is the first node, and then executes the debit processing. If there is no abnormality in the debit processing, step 309 is executed, otherwise, the debit processing is rolled back and the abnormal result of the processing is fed back to the peripheral system.
  • Step S309 The first node obtains the routing information of the credit processing as the credit account identifier from the configuration information table, determines that the node corresponding to the credit account identifier is the second node, then submits the operation data corresponding to the debit processing to the local database, and regenerates Send a credit processing message to the second node.
  • Step S310 The first node receives the credit processing result sent by the second node. If the credit processing is successful, it will feed back the successful result to the peripheral system; if the credit processing is abnormal, the debit processing will be corrected and sent to the peripheral system Feedback processing failure results.
  • the embodiment of the present invention also provides a process guarantee device for distributed transactions, as shown in FIG. 3, including:
  • the transceiver unit 31 is configured to receive data processing messages
  • the parsing unit 32 is configured to parse the data processing message, determine the main process and determine whether the main process contains N sub-processes, N ⁇ 1;
  • the execution unit 33 is configured to execute the main process if the main process includes N sub-processes, and sequentially determine the nodes corresponding to the N sub-processes; for the first sub-process, execute the first sub-process, and the first sub-process A sub-process is a sub-process in which the corresponding node in the N sub-processes is the first node;
  • the transceiver unit 31 is further configured to generate a message to be processed according to the second sub-process for a second sub-process, and send the message to be processed to the second node, so that the second node
  • the second sub-process is executed according to the to-be-processed message; the second sub-process is a sub-process in which the corresponding node of the N sub-processes is the second node, and the second node is a sub-process except the first A node other than the node.
  • the parsing unit 32 is further configured to determine the configuration information of the N sub-processes if the main process includes N sub-processes;
  • the execution unit is further configured to obtain the routing information of the sub-process from the configuration information of the sub-process for any one of the N sub-processes; determine the routing information of the sub-process according to the routing information of the sub-process The node corresponding to the sub-process.
  • the execution unit 33 is specifically configured to:
  • routing information of the sub-process is a local message, determine that the node corresponding to the sub-process is the first node;
  • routing information of the sub-process is the global service location GSL, determining that the node corresponding to the sub-process is the second node;
  • routing information of the sub-process is a specific identifier
  • look up the correspondence between the specific identifier and the node identifier and if the specific identifier corresponds to the identifier of the first node, determine the node corresponding to the sub-process Is the first node; if the specific identifier corresponds to the identifier of the second node, it is determined that the node corresponding to the sub-process is the second node.
  • the execution unit 33 is further configured to:
  • a monitoring unit 34 for:
  • the monitoring unit 34 is specifically configured to:
  • the sub-process is the first sub-process, directly perform a reverse operation on the first sub-process;
  • the sub-process is the second sub-process, perform a remote reverse operation on the second sub-process.
  • the present invention also provides an electronic device, as shown in FIG. 4, including:
  • It includes a processor 401, a memory 402, a transceiver 403, and a bus interface 404, wherein the processor 401, the memory 402 and the transceiver 403 are connected through the bus interface 404;
  • the processor 401 is configured to read the program in the memory 402 and execute the following method:
  • the transceiver 403 is configured to receive data processing messages under the control of the processor 401;
  • the processor 401 is configured to read the program in the memory 402 and execute the following method: parse the data processing message, determine the main flow and determine whether the main flow contains N sub-flows, N ⁇ 1; if the main flow contains N sub-processes, the main process is executed, and the nodes corresponding to the N sub-processes are sequentially determined; for the first sub-process, the first sub-process is executed, and the first sub-process is among the N sub-processes The corresponding node is a sub-process of the first node; for the second sub-process, a message to be processed is generated according to the second sub-process; the second sub-process is that the corresponding node in the N sub-processes is the second node The second node is a node other than the first node;
  • the transceiver 403 is further configured to send the message to be processed to the second node under the control of the processor 401, so that the second node executes the second sub-process according to the message to be processed ;
  • the memory 402 is configured to store one or more executable programs, and can store data used by the processor 401 when performing operations;
  • the bus interface 404 provides an interface, and the processor is responsible for managing the bus architecture and general processing.
  • the bus architecture may include any number of interconnected buses and bridges. Specifically, one or more processors represented by the processor 401 and various circuits of the memory represented by the memory 402 are linked together.
  • the bus architecture can also link various other circuits such as peripherals, voltage regulators, power management circuits, etc., which are all known in the art, and therefore, will not be further described herein.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种跨节点的数据处理方法及装置,涉及计算机技术领域,用以降低外围系统的远程调用难度。方法包括:第一节点接收数据处理消息(201);第一节点解析数据处理消息,确定主流程并判断主流程是否含有N个子流程(202);若主流程包含N个子流程,则第一节点执行主流程,并依次确定N个子流程对应的节点(203);针对第一子流程,第一节点执行第一子流程,第一子流程为N个子流程中对应的节点为第一节点的子流程(204);针对第二子流程,第一节点根据第二子流程生成待处理报文,将待处理报文向第二节点发送,以使第二节点根据待处理报文执行子流程(205);第二子流程为N个子流程中对应的节点为第二节点的子流程,第二节点为除第一节点之外的节点。

Description

一种跨节点的数据处理方法及装置
相关申请的交叉引用
本申请要求在2019年06月28日提交中国专利局、申请号为201910579312.5、申请名称为“一种跨节点的数据处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及金融科技(Fintech)中的计算机技术领域,尤其涉及一种跨节点的数据处理方法及装置。
背景技术
随着金融科技,尤其是互联网科技金融的不断发展,越来越多的技术(如分布式、区块链Blockchain、人工智能等)应用在金融领域,但金融业也对技术提出了更高的要求,如针对分布式事务的事务保障过程。
分布式事务提供一种机制将一个活动涉及的所有操作纳入到一个不可分割的执行单元,组成事务的所有操作只有在所有操作均能正常执行的情况下方能提交,只要其中任一操作执行失败,都将导致整个事务的回滚。
在分布式系统中,由于存在多个节点,同一个消息涉及的数据可能存储在不同的节点中。对于这类跨节点的数据,现有技术中由外围系统分别调用节点,即先调用第一个节点,第一个节点处理完成后,再调用第二个节点。这种方式,需要外围系统与不止一个节点多次交互,外围系统与节点之间的交互过程复杂繁琐,且难以保证事务的一致性。
发明内容
本申请提供一种跨节点的数据处理方法及装置,用以降低外围系统的远程调用难度。
本发明实施例提供的一种跨节点的数据处理方法,包括:
第一节点接收数据处理消息;
所述第一节点解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;
若所述主流程包含N个子流程,则所述第一节点执行所述主流程,并依次确定所述N个子流程对应的节点;
针对第一子流程,所述第一节点执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为第一节点的子流程;
针对第二子流程,所述第一节点根据所述第二子流程生成待处理报文,将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述子流程;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点。
一种可选的实施例中,在所述第一节点解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程之后,还包括:
若所述主流程包含N个子流程,则所述第一节点确定所述N个子流程的配置信息;
所述第一节点依次确定所述N个子流程对应的节点,包括:
针对所述N个子流程中的任一子流程,所述第一节点从所述子流程的配置信息中获取所述子流程的路由信息;
所述第一节点根据所述子流程的路由信息确定所述子流程对应的节点。
一种可选的实施例中,所述第一节点根据所述子流程的路由信息确定所述子流程对应的节点,包括:
若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识 的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
一种可选的实施例中,针对对应的节点为第二节点的子流程,所述第一节点根据所述子流程生成待处理报文,将所述待处理报文向所述第二节点发送之前,还包括:
所述第一节点确定对应的节点为所述第一节点的子流程的操作数据;
所述第一节点将所述操作数据向所述第一节点的数据库提交。
一种可选的实施例中,所述第一节点解析所述数据处理消息,确定主流程以及所述主流程包含的N个子流程之后,还包括:
所述第一节点对所述主流程以及子流程的执行过程进行监控;
当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
确定第一个子流程至第M-1个子流程中包含第二子流程;
对所述第一个子流程至第M-1个子流程执行反向操作。
一种可选的实施例中,所述对所述第一个子流程至第M-1个子流程执行反向操作,包括:
针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
所述第一节点从所述第一节点的数据库中获取所述子流程的操作数据;
根据所述子流程的操作数据,确定所述子流程为事务类子流程;
判断所述子流程对应的节点;
若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
一种跨节点的数据处理装置,包括:
收发单元,用于接收数据处理消息;
解析单元,用于解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;
执行单元,用于若主流程包含N个子流程,则执行所述主流程,并依次确定所述N个子流程对应的节点;针对第一子流程,执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为所述第一节点的子流程;
所述收发单元,还用于针对第二子流程,根据所述第二子流程生成待处理报文,将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点。
一种可选的实施例中,所述解析单元,还用于若所述主流程包含N个子流程,则确定所述N个子流程的配置信息;
所述执行单元,还用于针对所述N个子流程中的任一子流程,从所述子流程的配置信息中获取所述子流程的路由信息;根据所述子流程的路由信息确定所述子流程对应的节点。
一种可选的实施例中,所述执行单元,具体用于:
若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
一种可选的实施例中,针对对应的节点为第二节点的子流程,所述执行单元,还用于:
确定对应的节点为所述第一节点的子流程的操作数据;
将所述操作数据向所述第一节点的数据库提交。
一种可选的实施例中,还包括监控单元,用于:
对所述主流程以及子流程的执行过程进行监控;
当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
确定第一个子流程至第M-1个子流程中包含第二子流程;
对所述第一个子流程至第M-1个子流程执行反向操作。
一种可选的实施例中,所述监控单元,具体用于:
针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
从所述第一节点的数据库中获取所述子流程的操作数据;
根据所述子流程的操作数据,确定所述子流程为事务类子流程;
判断所述子流程对应的节点;
若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
本发明实施例还提供一种电子设备,包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如上所述的方法。
本发明实施例还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行如上所述的方法。
本发明实施例中,第一节点接收外围系统的数据处理消息后,根据数据处理消息,确定主流程,并判断主流程是否包含子流程。若主流程包含N个子流程,则第一节点执行主流程,并依次确定N个子流程对应的节点。根据子流程对应的节点,可以将N个子流程分为第一子流程和第二子流程,其中,第一子流程对应的节点为第一节点,第二子流程对应的节点为第二节点。针对第一子流程,由于其对应的节点为第一节点,第一节点直接执行第一子流程。针对第二子流程,第一节点根据第二子流程生成待处理报文,并向第二节点发送,以使第二节点根据待处理报文执行第二子流程,第二节点为系统 中除第一节点之外的节点。本发明实施例中,外围系统无需频繁与节点进行交互,只需将数据处理消息发送给一个节点,后续的流程均由节点之间内部解决,执行过程简洁且无需人为干涉。从而减少了外围系统与节点的数据传输压力,节省了网络资源。同时,可以由系统内部统一制定并确保事务的处理标准,从而保证了分布式事务的一致性。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种可能的系统构架的结构示意图;
图2为本发明实施例提供的一种跨节点的数据处理方法的流程示意图;
图3为本发明实施例提供的一种跨节点的数据处理方法装置的结构示意图;
图4为本发明实施例提供的电子设备的结构示意图。
具体实施方式
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
如图1所示,本发明实施例所适用的一种系统架构,包括外围系统101以及N个账户节点102。其中,外围系统101可以为安装于终端上的客户端,也可以为安装于服务器上的操作系统,终端可以是手机、平板电脑或者是专用的手持设备等具有无线通信功能的电子设备,也可以是个人计算机(personal  computer,简称PC),笔记本电脑,服务器等有线接入方式连接上网的设备。终端可以是一个独立的设备,也可以是多个终端所形成的终端集群。优选地,终端可以采用云计算技术进行信息处理。账户节点102可以是计算机等网络设备,可以是一个独立的设备,也可以是多个服务器所形成的服务器集群。N个账户节点102可以分别安装于N个服务器上,也可以安装于少于N个服务器上,即存在两个或多个账户节点102安装于同一个服务器上的情况。优选地,账户节点102可以采用云计算技术进行信息处理。
外围系统101可以通过INTERNET网络与账户节点102进行通信,也可以通过全球移动通信系统(Global System for Mobile Communications,简称GSM)、长期演进(long term evolution,简称LTE)系统等移动通信系统与账户节点102进行通信。外围系统101还可以通过RMB的方式远程调用账户节点102,也可以通过其它方式如RPC进行调用。
为了便于理解,下面对本发明实施例中可能涉及的名词进行定义和解释。
消息中间件:负责消息传输的基础架构系统,比如:ESB,Dubbo,RocketMQ,Kafka,Solace等,适用于需要可靠的数据传送的分布式环境。采用消息中间件机制的系统中,不同的对象之间通过传递消息来激活对方的事件,完成相应的操作。发送者将消息发送给消息服务器,消息服务器将消息存放在若干队列中,在合适的时候再将消息转发给接收者。消息中间件能在不同平台之间通信,它常被用来屏蔽掉各种平台及协议之间的特性,实现应用程序之间的协同,其优点在于能够在客户和服务器之间提供同步和异步的连接,并且在任何时刻都可以将消息进行传送或者存储转发。
路由服务系统:一种基础架构系统,用于维护卡号、账号、客户号等与节点号的关系。分布式服务架构是集群组网,这意味着集群中存在某个服务的多实例部署,路由服务系统可以从服务列表中选择合适的服务提供者进行调用。分布式服务框架要能够满足用户灵活的路由需求。
Spring:一种开源的、基于Java程序语言的应用程序框架。
AOP:面向切面的编程技术,用于定义拦截器。
冲正:交易因为异常而失败后,被迫将之前的操作全部回滚的行为。
冲账:交易成功后,外围系统主动发起的回滚交易。
传统的银行存款核心系统,都是单节点模型,账户数据都集中存储在一个数据库节点中,交易都在同一个数据库中完成,不存在跨节点交易的场景。
分布式存款核心系统,是多节点模型,账户数据分布在多个数据库节点中,账户之间的交易可能出现跨节点的场景。比如:账户A存储在账户节点1的数据库中,账户B存储在账户节点2的数据库中,要实现账户A到账户B的转账,即形成了跨节点交易的场景。
现有技术中,若要实现账户A到账户B的转账,外围系统先调用账户节点1的借记接口执行账户A的资金转出操作,再调用账户节点2的贷记接口执行账户B的资金转入操作。执行资金操作之前,还需对账户A和账户B的情况进行检验。因此,外围系统需要频繁与账户节点1以及账户节点2进行交互。且不同的外围系统会与账户节点交互,就很难保证分布式事务的一致性。
为了解决上述问题,基于上述架构,本发明实施例提供了一种跨节点的数据处理方法,如图2所示,本发明实施例提供的跨节点的数据处理方法包括以下步骤:
步骤201、第一节点接收数据处理消息。
具体地,数据处理消息中包含该消息涉及的账户信息,在跨节点的场景下,数据处理消息涉及不止一个账户,且这些账户分布于不同的账户节点中。外围系统可以通过消息中间件查找账户标识与节点标识的对应关系,确定数据处理消息具体涉及的账户节点,并向其中任一账户节点发送该数据处理消息。以跨节点转账交易为例,外围系统可以将转账请求向借方节点发送,也可以向贷方节点发送。较佳地,外围系统将转账请求发送至消息中间件,由消息中间件从借方节点和贷方节点中选择一个接受该转账请求。
其中,第一节点与第二节点可以为系统中的任一节点,第一节点为接收到该数据处理消息的节点,第二节点为除了第一节点之外,该数据处理消息 还涉及到的其它的节点,因此,第二节点的数量可以为一个,也可以为多个。例如某些场景下,节点A是第一节点,节点B是第二节点,在其它的场景下,节点A为第二节点,节点B为第一节点。
步骤202、所述第一节点解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程。
具体实施过程中,第一节点接收到数据处理消息后,根据数据处理消息,建立主流程,并依据涉及到的执行过程确定N个子流程,其中N≥0。当然,在本发明实施例针对的跨节点场景中,子流程的数量至少为1。若N=0,则表明该数据处理消息仅在一个节点中执行,例如查询请求、开户请求等,这种流程不在本发明讨论范围之内。
仍以跨节点转账交易为例进行说明,主流程为转账,因为该转账流程调用了其他流程,则被调用流程为子流程。
如果转账请求发往借方节点,则借方节点需要执行以下流程:
a1、调用本地借记检查接口检查借记账户A的状态和余额,如果状态异常或余额不足则停止交易;
a2、调用远程贷记检查接口检查贷记账户B的状态,如果状态异常则停止交易;
a3、调用本地借记接口执行账户A借记;
a4、调用远程贷记接口执行账户B贷记。
如果转账请求发往贷方节点,则贷方节点需要执行以下流程:
b1、调用远程借记检查接口检查借记账户A的状态和余额,如果状态异常或余额不足则停止交易;
b2、调用本地贷记检查接口检查贷记账户B的状态,如果状态异常则停止交易;
b3、调用远程借记接口执行账户A的借记;
b4、调用本地贷记接口执行账户B的贷记。
由上述可以看出,无论转账请求发往借方节点还是贷方节点,针对该转 账请求,均需要调用子流程。比如,执行转账交易时,主流程为转账,转账调用了借记检查,则借记检查为子流程。需要说明的是,当单独执行借记检查时,借记检查为主流程。从而,可以确定出该转账请求涉及以下流程:
主流程:转账,fund-transfer;
子流程:借记检查,dr-check;
子流程:贷记检查,cr-check;
子流程:借记处理,dr-process;
子流程:贷记处理,cr-process。
其中,为每个流程赋予唯一的交易码,即转账的交易码为fund-transfer,借记检查为dr-check,等等。
步骤203、所述第一节点执行所述主流程,并依次确定所述N个子流程对应的节点。
具体实施过程中,第一节点执行该主流程,执行主流程的过程中需要依次对子流程进行调用。这里,子流程的调用可以为并行执行,也可以为串行执行。
步骤204、针对第一子流程,所述第一节点执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为所述第一节点的子流程。
这里的第一子流程为一种类型的子流程,即对应的节点为第一节点的子流程,主流程中可以包括一个第一子流程,也可以包括多个第一子流程。同理,第二子流程也为一种类型的子流程,即对应的节点为第一节点的子流程,主流程中可以包括一个第二子流程,也可以包括多个第二子流程。
步骤205、针对第二子流程,所述第一节点根据所述第二子流程生成待处理报文,将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点。
需要说明的是,步骤204与步骤205之间并没有时间先后的限制。即可以为步骤204在步骤205之前执行,也可以为步骤204在步骤205之后执行, 或者步骤204与步骤205同时执行。
本发明实施例中,第一节点接收外围系统的数据处理消息后,根据数据处理消息,确定主流程,并判断主流程是否包含子流程。若主流程包含N个子流程,则第一节点执行主流程,并依次确定N个子流程对应的节点。根据子流程对应的节点,可以将N个子流程分为第一子流程和第二子流程,其中,第一子流程对应的节点为第一节点,第二子流程对应的节点为第二节点。针对第一子流程,由于其对应的节点为第一节点,第一节点直接执行第一子流程。针对第二子流程,第一节点根据第二子流程生成待处理报文,并向第二节点发送,以使第二节点根据待处理报文执行第二子流程,第二节点为系统中除第一节点之外的节点。本发明实施例中,外围系统无需频繁与节点进行交互,只需将数据处理消息发送给一个节点,后续的流程均由节点之间内部解决,执行过程简洁且无需人为干涉。从而减少了外围系统与节点的数据传输压力,节省了网络资源。同时,可以由系统内部统一制定并确保事务的处理标准,从而保证了分布式事务的一致性。
进一步地,本发明实施例中通过对数据处理消息进行解析,除了确定包含的子流程外,还可以获取子流程的配置消息。所述第一节点解析所述数据处理消息,确定主流程以及所述主流程包含的N个子流程之后,还包括:
所述第一节点确定所述N个子流程的配置信息;
所述第一节点依次确定所述N个子流程对应的节点,包括:
针对所述N个子流程中的任一子流程,所述第一节点从所述子流程的配置信息中获取所述子流程的路由信息;
所述第一节点根据所述子流程的路由信息确定所述子流程对应的节点。
具体实施过程中,定义调用接口,外围系统向节点发送规定格式的数据处理消息,数据处理消息经调用接口可得到对应的流程以及流程的配置信息。举例来说,接口名称为Flow<I,O>,该接口包含了一个O execute(I InputDTO)方法的定义,其中I表示输入数据类型,即InputDTO;O表示输出数据类型,即OutputDTO。要实现Flow<I,O>接口,需要定义O execute(I InputDTO)方法, 即制定具体的输入输出类型,并在方法中实现业务逻辑。然后,在实现类上加上注释以定义交易码,比如@Controller(“dr-check”)。需要调用子流程时,可直接调用子流程的方法。输出的类型可以为表格的形式,并根据需要由开发人员定义具体的输出内容和输出格式,举例如表1所示:
表1
Figure PCTCN2019117516-appb-000001
其中,routing_keys分为动态路由关键字和静态路由关键字。
动态路由关键字为InputDTO即输入的数据处理消息中的属性标识,例如卡号(cardNo)、账号(accountNo)等。可以从路由服务系统中查找出与属性标识对应的节点标识,再根据节点标识进行路由。
静态路由关键字包括两类,分别为GSL(Global Service Location,全球服务地点)和LOCAL(或null)。其中,GSL表示由消息中间件自动查找节点标识,即流程不在本地执行,对应的节点需远程调用。LOCAL表示流程在本地执行,不进行路由。
remote_service_id,为通过消息中间件发送消息时,调用的远程服务的服务号。
has_rev_event,标记流程是否在数据库中登记了对应的冲账事件,可以用“1”表示已登记,“null”表示未登记。冲账事件即当前流程的反向操作,用于异常冲正或事后的冲账交易。
根据上述表1,对于转账交易的过程中涉及到的几个流程,可以得到如表2的配置信息:
表2
txn_code routing_keys remote_service_id has_rev_event description
fund-transfer null null null 转账
dr-check cardNo,accountNo 01000001 null 借记检查
cr-check cardNo,accountNo 01000002 null 贷记检查
dr-process cardNo,accountNo 01000003 1 借记处理
cr-process cardNo,accountNo 01000004 1 贷记处理
较佳地,为了节省内存,可以将表2的内容转换为一个HashMap,命名为flowDefMap进行保存。
本发明实施例中,针对每一个数据处理消息,解析得到如表2所示的配置信息。进一步根据配置信息中的路由信息,即routing_keys,确定子流程对应的节点。所述第一节点根据所述子流程的路由信息确定所述子流程对应的节点,包括:
若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
具体执行过程中,若子流程的路由信息为本地消息,即表2中的routing_keys内容为LOCAL或null,则表示该子流程对应的节点为第一节点,直接在本地执行。若子流程的路由信息为GSL,则表示该子流程需由消息中间件查找对应的节点标识,因此,子流程对应的节点为第二节点。若子流程的路由信息为具体标识,即如表2中的cardNo,accountNo,表示该子流程的路由信息为动态路由关键字,则根据配置表中具体的卡号和/或账号,从路由服务系统中查找对应的节点标识。若对应的节点标识为当前第一节点的标识, 则仍然在本地执行;若节点标识不为当前的第一节点标识,则表明子流程对应的节点为第二节点,转为远程调用。特殊的,若节点标识为null,则说明输入有误,停止执行流程。此外,当有多个路由信息时,以首先找到的节点标识为准。路由信息与节点标识的关系可保存在线程缓存中,下次可先从缓存里查询。
较佳地,针对对应的节点为第二节点的子流程,所述第一节点根据所述子流程生成待处理报文,将所述待处理报文向所述第二节点发送之前,还包括:
所述第一节点确定对应的节点为所述第一节点的子流程的操作数据;
所述第一节点将所述操作数据向所述第一节点的数据库提交。
具体实施过程中,由于本地执行的子流程均需将操作数据递交本地数据库。因此,远程调用前,先将已执行的子流程进行本地数据库事务提交,以防事务时间太长而影响数据库性能。
此外,需要说明的是,远程调用时,先从flowDefMap中找到对应的服务号,将该子流程的InputDTO转换为报文,再通过消息中间件向指定的第二节点发送报文进行远程调用。远程调用结束后,识别调用结果,并将返回报文转换为该子流程的OutputDTO。不管是本地调用,还是远程调用,调用结束后,控制权都将返还给主流程。
由上述可以看出,本发明实施例中,实现了节点标识的自动查找、系统决定流程是本地执行还是远程执行、调用远程接口、报文转换与结果识别等。底层机制对外围系统完全透明,外围系统只需调用本地接口即可。
进一步地,为了保证事务的一致性,流程的执行过程中若出现异常,需要将之前的操作全部回滚,返回到未处理时的状态。所述第一节点解析所述数据处理消息,确定主流程以及所述主流程包含的N个子流程之后,还包括:
所述第一节点对所述主流程以及子流程的执行过程进行监控;
当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
确定第一个子流程至第M-1个子流程中包含第二子流程;
对所述第一个子流程至第M-1个子流程执行反向操作。
具体实施过程中,对整个主流程以及每个子流程的执行过程均需进行监控。当确定第M个子流程发生异常,则将本地数据库中的事务进行回滚,然后判断第M个子流程之前的子流程中是否存跨节点的子流程。若没有,即代表之前的所有子流程均在当前的第一节点执行,因此对于同一个主流程下一直在同一节点中处理的第一子流程,在本地数据库中只存在一个事务,且已被回滚,从而可以直接进行报错反馈并结束流程。而对于存在了跨节点的子流程,则当前第一节点已经就之前处理的第一子流程递交了数据库事务,之前处理的第一子流程与已回滚的第一子流程在数据库中不是一条事务,因此需要对之前处理的第一子流程执行反向操作。此外,远程的第二节点也有可能发生过数据库事务的提交,因此,第二节点的第二子流程也需要执行反向操作。
举例来说,主流程中包括子流程A、子流程B、子流程C和子流程D,其中子流程A、子流程B和子流程C在第一节点中处理,子流程C在第二节点中处理。若子流程B的执行过程中出现了异常,由于子流程A和子流程B均在第一节点中处理,且中间没有出现跨节点的子流程,则子流程A和子流程B在第一节点的数据库中是以一条事务进行存储,因此直接进行回滚即可。若子流程D的执行过程出现了异常,由于子流程D之前的子流程中包括了第二节点处理的子流程C,因此,需要对子流程C执行反向操作,即进行子流程C的冲正。此外,由于子流程B与子流程D之间出现了跨节点的行为,因此,针对子流程A和子流程B也需要进行冲正。
进一步地,所述对所述第一个子流程至第M-1个子流程执行反向操作,包括:
针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
所述第一节点从所述第一节点的数据库中获取所述子流程的操作数据;
根据所述子流程的操作数据,确定所述子流程为事务类子流程;
判断所述子流程对应的节点;
若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
对于跨节点流程,因为涉及到多个节点的数据库事务,冲正机制较为复杂,因此,本发明实施例中对冲正机制进行预先统一规定,冲正过程涉及到子流程日志表、冲正事件表、通用冲正服务、通用冲正流程。其中:
子流程日志表,用于记录已经执行的子流程信息,包括:是否包含冲正事件、是否为远程调用、远程调用节点号、远程调用流水号等。
冲正事件表,子流程在执行时,由业务开发人员将反向操作记录在数据库中,即为冲正事件。当需要对子流程执行冲正或冲账时,将执行冲正事件,使得子流程在数据库中的事务被抵消。
通用冲正服务,遍历指定的子流程日志表,根据子流程的历史执行记录,执行反向操作进行冲正或冲账。
通用冲正流程,用于调用通用冲正服务。通用冲正流程不仅适用于跨节点冲正,对于外围系统主动发起的冲账交易,仍然适用。
具体实施过程中,调用通用冲正服务进行冲正时,第一节点需要从本地数据库的子流程日志表中查询各子流程的历史执行记录。如果已经处理过的子流程中不包括事务类子流程,即对数据库的事务一致性产生影响的子流程,则不用进行处理。例如已经处理过的子流程均为查询类子流程,则无需执行冲正,可以直接向外围系统进行异常反馈。如果包括事务类子流程,则还需判断该事务类子流程是在第一节点中执行还是在第二节点中执行。若为第一子流程,则直接对第一子流程执行反向操作,具体可以为从第一节点的本地数据库中查找到第一子流程对应的冲正事件,通过执行该冲正事件对第一子流程执行冲正。若为第二子流程,则对该第二子流程执行远程反向操作,即确定第二子流程对应的流水号、节点标识等信息,从而确定第二子流程对应的第二节点,再调用第二节点的通用冲正服务,由第二节点对第二子流程进行冲正。
此外,对于数据对应流程成功处理后,外围系统又主动发起的冲账流程,也是调用通用冲正流程,进行冲账。
由上述描述可知,本发明实施例中实现了交易失败后的本地自动冲正、远程冲正。冲正底层机制对外围系统完全透明,用户只需要在编写流程时记录冲正事件即可。
为了更清楚地理解本发明,下面以具体实施例对上述流程进行详细描述,本发明具体实施例中,具体场景为用户使用手机进行快捷支付,系统架构包括客户端、交易处理系统、存款核心系统和理财系统,其中,存款核心系统和理财系统分别为子交易对应的子系统。
具体实施例的步骤如下所示,包括:
步骤S301:外围系统向消息中间件发送转账请求,该转账请求中包含借方账户标识和贷方账户标识。
步骤S302:消息中间件根据借方账户标识,将转账请求向借方账户所在的第一节点发送。
步骤S303:第一节点根据该转账请求,确定主流程为转账,以及四个子流程依次为借记检查、贷记检查、借记处理和贷记处理,同时建立并保存该转账请求对应的配置信息表。
步骤S304:第一节点执行主流程。
步骤S305:第一节点从配置信息表中获取借记检查的路由信息为借方账户标识,则从路由服务系统中找到借方账户标识对应的节点即为第一节点,则执行借记检查。若借记检查通过,则执行步骤306,否则向外围系统反馈处理失败结果。
步骤S306:第一节点从配置信息表中获取贷记检查的路由信息为贷方账户标识,则从路由服务系统中找到贷方账户标识对应的节点为第二节点,则将借记检查对应的操作数据向本地数据库提交,再生成贷记检查报文向第二节点发送。
步骤S307:第一节点接收第二节点发送的贷记检查结果,若贷记检查通 过,则执行步骤308,否则向外围系统反馈处理失败结果。
步骤S308:第一节点从配置信息表中获取借记处理的路由信息为借方账户标识,确定借方账户标识对应的节点即为第一节点,则执行借记处理。若借记处理未发生异常,则执行步骤309,否则对借记处理进行回滚,并向外围系统反馈处理异常结果。
步骤S309:第一节点从配置信息表中获取贷记处理的路由信息为贷方账户标识,确定贷方账户标识对应的节点为第二节点,则将借记处理对应的操作数据向本地数据库提交,再生成贷记处理报文向第二节点发送。
步骤S310:第一节点接收第二节点发送的贷记处理结果,若贷记处理成功,则向外围系统反馈成功结果;若贷记处理异常,则对借记处理进行冲正,并向外围系统反馈处理失败结果。
本发明实施例还提供了一种分布式事务的流程保障装置,如图3所示,包括:
收发单元31,用于接收数据处理消息;
解析单元32,用于解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;
执行单元33,用于若主流程包含N个子流程,则执行所述主流程,并依次确定所述N个子流程对应的节点;针对第一子流程,执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为所述第一节点的子流程;
所述收发单元31,还用于针对第二子流程,根据所述第二子流程生成待处理报文,将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点。
可选的,所述解析单元32,还用于若所述主流程包含N个子流程,则确定所述N个子流程的配置信息;
所述执行单元,还用于针对所述N个子流程中的任一子流程,从所述子 流程的配置信息中获取所述子流程的路由信息;根据所述子流程的路由信息确定所述子流程对应的节点。
可选的,所述执行单元33,具体用于:
若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
可选的,针对对应的节点为第二节点的子流程,所述执行单元33,还用于:
确定对应的节点为所述第一节点的子流程的操作数据;
将所述操作数据向所述第一节点的数据库提交。
可选的,还包括监控单元34,用于:
对所述主流程以及子流程的执行过程进行监控;
当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
确定第一个子流程至第M-1个子流程中包含第二子流程;
对所述第一个子流程至第M-1个子流程执行反向操作。
可选的,所述监控单元34,具体用于:
针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
从所述第一节点的数据库中获取所述子流程的操作数据;
根据所述子流程的操作数据,确定所述子流程为事务类子流程;
判断所述子流程对应的节点;
若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
基于相同的原理,本发明还提供一种电子设备,如图4所示,包括:
包括处理器401、存储器402、收发机403、总线接口404,其中处理器401、存储器402与收发机403之间通过总线接口404连接;
所述处理器401,用于读取所述存储器402中的程序,执行下列方法:
收发机403,用于在处理器401的控制下接收数据处理消息;
处理器401,用于读取存储器402中的程序,执行下列方法:解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;若所述主流程包含N个子流程,则执行所述主流程,并依次确定所述N个子流程对应的节点;针对第一子流程,执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为第一节点的子流程;针对第二子流程,根据所述第二子流程生成待处理报文;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点;
收发机403,还用于在处理器401的控制下将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;
存储器402,用于存储一个或多个可执行程序,可以存储处理器401在执行操作时所使用的数据;
总线接口404提供接口,处理器负责管理总线架构和通常的处理。
其中,在图4中,总线构架可以包括任意数量的互联的总线和桥,具体由处理器401代表的一个或多个处理器和存储器402代表的存储器的各种电路链接在一起。总线架构还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包括这些改动和变型在内。

Claims (19)

  1. 一种跨节点的数据处理方法,其特征在于,包括:
    第一节点接收数据处理消息;
    所述第一节点解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;
    若所述主流程包含N个子流程,则所述第一节点执行所述主流程,并依次确定所述N个子流程对应的节点;
    针对第一子流程,所述第一节点执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为所述第一节点的子流程;
    针对第二子流程,所述第一节点根据所述第二子流程生成待处理报文,将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点。
  2. 如权利要求1所述的方法,其特征在于,在所述第一节点解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程之后,还包括:
    若所述主流程包含N个子流程,则所述第一节点确定所述N个子流程的配置信息;
    所述第一节点依次确定所述N个子流程对应的节点,包括:
    针对所述N个子流程中的任一子流程,所述第一节点从所述子流程的配置信息中获取所述子流程的路由信息;
    所述第一节点根据所述子流程的路由信息确定所述子流程对应的节点。
  3. 如权利要求2所述的方法,其特征在于,所述第一节点根据所述子流程的路由信息确定所述子流程对应的节点,包括:
    若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
    若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
    若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
  4. 如权利要求1所述的方法,其特征在于,针对对应的节点为第二节点的子流程,所述第一节点根据所述子流程生成待处理报文,将所述待处理报文向所述第二节点发送之前,还包括:
    所述第一节点确定对应的节点为所述第一节点的子流程的操作数据;
    所述第一节点将所述操作数据向所述第一节点的数据库提交。
  5. 如权利要求1所述的方法,其特征在于,所述第一节点解析所述数据处理消息,确定主流程以及所述主流程包含的N个子流程之后,还包括:
    所述第一节点对所述主流程以及子流程的执行过程进行监控;
    当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
    确定第一个子流程至第M-1个子流程中包含第二子流程;
    对所述第一个子流程至第M-1个子流程执行反向操作。
  6. 如权利要求5所述的方法,其特征在于,所述对所述第一个子流程至第M-1个子流程执行反向操作,包括:
    针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
    所述第一节点从所述第一节点的数据库中获取所述子流程的操作数据;
    根据所述子流程的操作数据,确定所述子流程为事务类子流程;
    判断所述子流程对应的节点;
    若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
    若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
  7. 一种跨节点的数据处理装置,其特征在于,包括:
    收发单元,用于接收数据处理消息;
    解析单元,用于解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;
    执行单元,用于若主流程包含N个子流程,则执行所述主流程,并依次确定所述N个子流程对应的节点;针对第一子流程,执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为所述第一节点的子流程;
    所述收发单元,还用于针对第二子流程,根据所述第二子流程生成待处理报文,将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点。
  8. 如权利要求7所述的装置,其特征在于,所述解析单元,还用于若所述主流程包含N个子流程,则确定所述N个子流程的配置信息;
    所述执行单元,还用于针对所述N个子流程中的任一子流程,从所述子流程的配置信息中获取所述子流程的路由信息;根据所述子流程的路由信息确定所述子流程对应的节点。
  9. 如权利要求8所述的装置,其特征在于,所述执行单元,具体用于:
    若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
    若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
    若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
  10. 如权利要求7所述的装置,其特征在于,针对对应的节点为第二节点的子流程,所述执行单元,还用于:
    确定对应的节点为所述第一节点的子流程的操作数据;
    将所述操作数据向所述第一节点的数据库提交。
  11. 如权利要求7所述的装置,其特征在于,还包括监控单元,用于:
    对所述主流程以及子流程的执行过程进行监控;
    当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
    确定第一个子流程至第M-1个子流程中包含第二子流程;
    对所述第一个子流程至第M-1个子流程执行反向操作。
  12. 如权利要求11所述的装置,其特征在于,所述监控单元,具体用于:
    针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
    从所述第一节点的数据库中获取所述子流程的操作数据;
    根据所述子流程的操作数据,确定所述子流程为事务类子流程;
    判断所述子流程对应的节点;
    若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
    若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
  13. 一种电子设备,其特征在于,包括:处理器、存储器、收发机、总线接口,其中处理器、存储器与收发机之间通过总线接口连接;
    所述收发机,用于在所述处理器的控制下接收数据处理消息;
    所述处理器,用于读取所述存储器中的程序,执行下列方法:解析所述数据处理消息,确定主流程并判断所述主流程是否含有N个子流程,N≥1;若所述主流程包含N个子流程,则执行所述主流程,并依次确定所述N个子流程对应的节点;针对第一子流程,执行所述第一子流程,所述第一子流程为所述N个子流程中对应的节点为第一节点的子流程;针对第二子流程,根据所述第二子流程生成待处理报文;所述第二子流程为所述N个子流程中对应的节点为第二节点的子流程,所述第二节点为除所述第一节点之外的节点;
    所述收发机,还用于在所述处理器的控制下将所述待处理报文向所述第二节点发送,以使所述第二节点根据所述待处理报文执行所述第二子流程;
    所述存储器,用于存储一个或多个可执行程序,可以存储所述处理器在 执行操作时所使用的数据;
    所述总线接口,用于提供接口。
  14. 如权利要求13所述的电子设备,其特征在于,所述处理器,用于:
    若所述主流程包含N个子流程,则确定所述N个子流程的配置信息;
    针对所述N个子流程中的任一子流程,从所述子流程的配置信息中获取所述子流程的路由信息;
    根据所述子流程的路由信息确定所述子流程对应的节点。
  15. 如权利要求14所述的电子设备,其特征在于,所述处理器,具体用于:
    若所述子流程的路由信息为本地消息,则确定所述子流程对应的节点为所述第一节点;
    若所述子流程的路由信息为全球服务地点GSL,则确定所述子流程对应的节点为第二节点;
    若所述子流程的路由信息为具体标识,则查找所述具体标识与节点标识的对应关系,若所述具体标识与所述第一节点的标识相对应,则确定所述子流程对应的节点为所述第一节点;若所述具体标识与第二节点的标识相对应,则确定所述子流程对应的节点为所述第二节点。
  16. 如权利要求13所述的电子设备,其特征在于,针对对应的节点为第二节点的子流程,所述处理器,还用于:
    确定对应的节点为所述第一节点的子流程的操作数据;
    将所述操作数据向所述第一节点的数据库提交。
  17. 如权利要求13所述的电子设备,其特征在于,所述处理器,还用于:
    对所述主流程以及子流程的执行过程进行监控;
    当确定第M个子流程的执行发生异常,则对所述第一节点的数据库执行回滚操作,1≤M≤N;
    确定第一个子流程至第M-1个子流程中包含第二子流程;
    对所述第一个子流程至第M-1个子流程执行反向操作。
  18. 如权利要求17所述的电子设备,其特征在于,所述处理器,具体用于:
    针对所述第一个子流程至第M-1个子流程中的任一子流程执行以下流程:
    从所述第一节点的数据库中获取所述子流程的操作数据;
    根据所述子流程的操作数据,确定所述子流程为事务类子流程;
    判断所述子流程对应的节点;
    若所述子流程为第一子流程,则直接对所述第一子流程执行反向操作;
    若所述子流程为第二子流程,则对所述第二子流程执行远程反向操作。
  19. 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1-6任一所述的方法。
PCT/CN2019/117516 2019-06-28 2019-11-12 一种跨节点的数据处理方法及装置 Ceased WO2020258653A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910579312.5 2019-06-28
CN201910579312.5A CN110287267A (zh) 2019-06-28 2019-06-28 一种跨节点的数据处理方法及装置

Publications (1)

Publication Number Publication Date
WO2020258653A1 true WO2020258653A1 (zh) 2020-12-30

Family

ID=68019792

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117516 Ceased WO2020258653A1 (zh) 2019-06-28 2019-11-12 一种跨节点的数据处理方法及装置

Country Status (2)

Country Link
CN (1) CN110287267A (zh)
WO (1) WO2020258653A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287267A (zh) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 一种跨节点的数据处理方法及装置
CN111796950B (zh) * 2020-07-16 2023-06-30 网易(杭州)网络有限公司 数据处理方法和系统
CN111949337B (zh) * 2020-08-07 2023-11-07 中国建设银行股份有限公司 一种账务的处理方法、装置、终端及存储介质
CN112835688A (zh) * 2021-02-01 2021-05-25 北京星网锐捷网络技术有限公司 分布式事务处理方法、设备及存储介质
CN119045957B (zh) * 2024-09-02 2025-09-23 四川农村商业联合银行股份有限公司 分布式事务的处理方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104572077A (zh) * 2014-12-12 2015-04-29 百度在线网络技术(北京)有限公司 数据库事务的处理方法及业务系统
US20160352843A1 (en) * 2014-03-18 2016-12-01 Huawei Technologies Co., Ltd. Data Processing Method, Device, and ESB System
CN108074076A (zh) * 2017-12-08 2018-05-25 上海壹账通金融科技有限公司 基于esb的服务提供方法、装置、设备及可读存储介质
CN109756481A (zh) * 2018-11-30 2019-05-14 广州因特信息科技有限公司 基于互联网异地分布式对接第三方系统的实现方法及系统
CN110287267A (zh) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 一种跨节点的数据处理方法及装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104793988B (zh) * 2014-01-20 2019-01-22 阿里巴巴集团控股有限公司 跨数据库分布式事务的实现方法和装置
CN107045454B (zh) * 2016-02-06 2020-06-26 华为技术有限公司 跨进程分布式事务控制方法及相关系统
CN108090664A (zh) * 2017-12-13 2018-05-29 北京网博视界科技股份有限公司 一种工作流适配调度方法、装置、设备和存储介质
CN109241186A (zh) * 2018-08-29 2019-01-18 深圳市小牛在线互联网信息咨询有限公司 分布式事务的管理方法、系统、计算机设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160352843A1 (en) * 2014-03-18 2016-12-01 Huawei Technologies Co., Ltd. Data Processing Method, Device, and ESB System
CN104572077A (zh) * 2014-12-12 2015-04-29 百度在线网络技术(北京)有限公司 数据库事务的处理方法及业务系统
CN108074076A (zh) * 2017-12-08 2018-05-25 上海壹账通金融科技有限公司 基于esb的服务提供方法、装置、设备及可读存储介质
CN109756481A (zh) * 2018-11-30 2019-05-14 广州因特信息科技有限公司 基于互联网异地分布式对接第三方系统的实现方法及系统
CN110287267A (zh) * 2019-06-28 2019-09-27 深圳前海微众银行股份有限公司 一种跨节点的数据处理方法及装置

Also Published As

Publication number Publication date
CN110287267A (zh) 2019-09-27

Similar Documents

Publication Publication Date Title
WO2020258653A1 (zh) 一种跨节点的数据处理方法及装置
EP3869434B1 (en) Blockchain-based data processing method and apparatus, device, and medium
CN106503974B (zh) 交易数据处理方法及装置
CN107045454A (zh) 跨进程分布式事务控制方法及相关系统
CN112288577B (zh) 分布式服务的交易处理方法、装置、电子设备和介质
US12346733B2 (en) Batch processing and error resolution management
US10673953B2 (en) Transport channel via web socket for OData
CN110599305A (zh) 业务处理方法、装置及存储介质
CN111399851B (zh) 基于分布式系统的批处理执行方法
CN113111077A (zh) 一致性的控制方法、装置、电子设备、介质和程序产品
CN111694620A (zh) 第三方业务的交互方法、装置、设备及计算机存储介质
CN113326196A (zh) 一种测试用例的方法及装置
US20080005747A1 (en) System and method for object state management
WO2021052237A1 (zh) 事务处理方法、装置、设备、存储介质、数据库
CN111367934A (zh) 数据一致性的检验方法、装置、服务器和介质
CN113364806B (zh) 一种服务接口迁移的校验方法及装置
CN110764933B (zh) 一种消息处理方法、装置、系统及计算设备
CN112261072B (zh) 一种服务调用方法、装置、设备和存储介质
CN112801771A (zh) 授信处理方法、装置、设备和介质
CN112711602A (zh) 一种存储过程的运行方法、装置,数据库系统及存储介质
CN114218240B (zh) 数据变更方法、装置、设备、介质和程序产品
CN114218313B (zh) 数据管理方法、装置、电子设备、存储介质及产品
CN117827943A (zh) 数据映射方法、装置及电子设备、存储介质
CN115640345A (zh) 数据处理方法、装置、系统、设备、存储介质及产品
CN115396536A (zh) 报文分发方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19934616

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.04.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19934616

Country of ref document: EP

Kind code of ref document: A1