A reconciliation method, reconciliation application cluster and related client
By selecting the target client according to the client status in the reconciliation application cluster and storing the actual serial number, the problems of low reconciliation efficiency and duplicate reconciliation are solved, efficient and reconciliation processing is achieved, and the reconciliation system is improved utilization rate.
Patent Information
- Application Number
- CN202110788105.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-13
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2041-07-13
AI Technical Summary
The reconciliation efficiency in the existing technology is low, and the high utilization rate of the reconciliation system cannot be guaranteed, and there is a problem of repeated reconciliation.
In the reconciliation application cluster, the client selects the target client that can perform reconciliation based on the status, and stores the actual serial number and the identification of transaction data to the preset storage system, ensuring that only one client will be allowed to each reconciliation. Handle and avoid repeated reconciliation.
It improves the reconciliation efficiency, ensures the high utilization rate of the reconciliation system, avoids duplicate reconciliation, and improves the performance of the overall reconciliation system.
Smart Images

Figure CN113421163B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an account reconciliation method, an account reconciliation application cluster and a related client. Background Art
[0002] There are currently two solutions for account reconciliation: Solution 1 is offline reconciliation, that is, after all reconciliation participants (such as transaction systems, financial systems, capital systems, etc.) have completely issued accounts and closed accounts, offline billing data is generated, and the reconciliation system extracts files or data from each participant and performs reconciliation according to the reconciliation logic; Solution 2 is real-time reconciliation, that is, when each reconciliation participant generates data to be reconciled, the reconciliation system polls data based on the real-time billing data of one or more parties until the data to be reconciled of all participants is obtained, and then reconciliation is performed uniformly.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] The reconciliation efficiency is low, the high utilization rate of the reconciliation system cannot be guaranteed, and there is a problem of duplicate reconciliation. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a reconciliation method, a reconciliation application cluster and a related client, which can improve the reconciliation efficiency, ensure the high utilization rate of the reconciliation system, and avoid repeated reconciliation.
[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a reconciliation method is provided.
[0007] A reconciliation method comprises: after receiving transaction data, a first client in a reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster; the first client associates the actual serial number of the target client with the identifier of the received transaction data and stores it in a preset storage system for query by each client in the reconciliation application cluster; after a second client in the reconciliation application cluster inquires that the actual serial number of the target client is the actual serial number of the second client, the second client performs reconciliation on the received transaction data.
[0008] Optionally, it also includes: each client in the reconciliation application cluster registers as a temporary ordered node with the distributed service cluster to obtain its own actual serial number, and saves the corresponding relationship between the actual serial number of the client and the status of the client in the distributed service cluster.
[0009] Optionally, after receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster, including: after receiving the transaction data, the first client in the reconciliation application cluster obtains the status of each client in the reconciliation application cluster from the distributed service cluster to select idle clients from the reconciliation application cluster, wherein the idle clients are clients with an idle status; the first client sorts the obtained idle clients to determine the logical serial numbers of the idle clients, and saves the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers; determines the logical serial numbers of the one or more target clients according to a preset algorithm using the identifier of the transaction data and the logical serial number of the idle client; determines the actual serial numbers of the one or more target clients according to the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, so as to select the one or more target clients according to the actual serial numbers.
[0010] Optionally, the identifier of the transaction data is the serial number of the transaction data; the method of using the identifier of the transaction data and the logical serial number of the idle client to determine the logical serial number of the one or more target clients according to a preset algorithm includes: calculating the hash value of the serial number of the transaction data, taking the modulus of the number of the idle clients by the hash value of the serial number of the transaction data, and obtaining the logical serial number of the one or more target clients.
[0011] Optionally, the first client associates the actual serial number of the target client with the identifier of the received transaction data and stores them in a preset storage system, including: the first client generates a task execution identifier including the actual serial number of the target client and the identifier of the received transaction data; queries in the preset storage system whether the task execution identifier already exists, and if the task execution identifier does not exist, adds the task execution identifier to the preset storage system.
[0012] Optionally, the first client generates the task execution identifier by concatenating the actual serial number of the target client with the identifier of the received transaction data, and after adding the task execution identifier to the preset storage system, sets the state of the task execution identifier to an unlocked state.
[0013] Optionally, before querying the preset storage system for the association between the actual serial number of the client and the transaction data identifier, each client in the reconciliation application cluster queries the distributed service cluster for its own status and determines that its own status is idle.
[0014] Optionally, before the second client performs reconciliation on the received transaction data, it includes: the second client determines that the state of the task execution identifier including the actual serial number of the second client is an unlocked state, and then changes the state of the task execution identifier to a locked state; after the second client performs reconciliation on the received transaction data, it includes: if the reconciliation is successful, the second client deletes the task execution identifier including the actual serial number of the second client from the preset storage system; if the reconciliation is unsuccessful, the second client changes the state of the task execution identifier including the actual serial number of the second client to an unlocked state.
[0015] Optionally, it also includes: monitoring the change events of the distributed service cluster through a scheduled task, and when the actual serial number of the client is monitored to change, resetting the association between the actual serial number of the client and the transaction data identifier in the preset storage system according to the updated actual serial number of the client.
[0016] According to another aspect of an embodiment of the present invention, a reconciliation application cluster is provided.
[0017] A reconciliation application cluster includes multiple clients, wherein: a first client is used to select one or more target clients that can perform reconciliation on the transaction data after receiving transaction data, according to the status of each client in the reconciliation application cluster; the first client is also used to associate the actual serial number of the target client with the identifier of the received transaction data and store it in a preset storage system for query by each client in the reconciliation application cluster; and a second client is used to perform reconciliation on the received transaction data after querying that the actual serial number of the target client is the actual serial number of the second client.
[0018] Optionally, each of the clients is registered as a temporary ordered node with the distributed service cluster to obtain its own actual serial number, and the corresponding relationship between the actual serial number of the client and the state of the client is stored in the distributed service cluster.
[0019] Optionally, the first client is also used to: after receiving the transaction data, obtain the status of each client in the reconciliation application cluster from the distributed service cluster to select an idle client from the reconciliation application cluster, wherein the idle client is a client with an idle status; sort the obtained idle clients to determine the logical serial number of the idle client, and save the corresponding relationship between the logical serial number of the idle client and the actual serial number; use the identifier of the transaction data and the logical serial number of the idle client to determine the logical serial number of the one or more target clients according to a preset algorithm; determine the actual serial number of the one or more target clients according to the corresponding relationship between the logical serial number of the idle client and the actual serial number, so as to select the one or more target clients according to the actual serial number.
[0020] Optionally, the identifier of the transaction data is the serial number of the transaction data; the first client is also used to: calculate the hash value of the serial number of the transaction data, modulo the number of the idle clients by the hash value of the serial number of the transaction data, and obtain the logical serial number of the one or more target clients.
[0021] Optionally, the first client is also used to: generate a task execution identifier including the actual serial number of the target client and an identifier of the received transaction data; query whether the task execution identifier already exists in the preset storage system, and if the task execution identifier does not exist, add the task execution identifier to the preset storage system.
[0022] Optionally, the first client is also used to generate the task execution identifier by concatenating the actual serial number of the target client with the identifier of the received transaction data, and after adding the task execution identifier to the preset storage system, set the status of the task execution identifier to an unlocked state.
[0023] Optionally, before querying the preset storage system for the association between the actual serial number of the client and the transaction data identifier, each client in the reconciliation application cluster is further configured to: query the distributed service cluster for their respective statuses, and determine that their respective statuses are idle.
[0024] Optionally, before performing reconciliation on the received transaction data, the second client is also used to: determine that the state of the task execution identifier including the actual serial number of the second client is an unlocked state, and then change the state of the task execution identifier to a locked state; after performing reconciliation on the received transaction data, the second client is also used to: if the reconciliation is successful, delete the task execution identifier including the actual serial number of the second client from the preset storage system; if the reconciliation is unsuccessful, change the state of the task execution identifier including the actual serial number of the second client to an unlocked state.
[0025] Optionally, the change events of the distributed service cluster are monitored through a scheduled task. When the actual serial number of the client is monitored to have changed, the first client is also used to: reset the association between the actual serial number of the client and the transaction data identifier in the preset storage system according to the updated actual serial number of the client.
[0026] According to yet another aspect of an embodiment of the present invention, a client in a reconciliation application cluster is provided.
[0027] A client in a reconciliation application cluster, comprising: a reconciliation client selection module, which is used to select one or more target clients that can perform reconciliation on the received transaction data according to the status of each client in the reconciliation application cluster after receiving transaction data; an association storage module, which is used to associate the actual serial number of the target client with the identifier of the received transaction data and store it in a preset storage system for query by each client in the reconciliation application cluster, wherein the preset storage system is used to save the association relationship between the actual serial number of each client and the identifier of each transaction data; and a reconciliation execution module, which is used to obtain the detailed data of the corresponding transaction data for reconciliation according to the identifier of the transaction data associated with the queried actual serial number after the actual serial number queried from the preset storage system is the actual serial number of the client.
[0028] According to yet another aspect of the embodiments of the present invention, an electronic device is provided.
[0029] An electronic device comprises: one or more processors; and a memory for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the reconciliation method provided in an embodiment of the present invention.
[0030] According to yet another aspect of an embodiment of the present invention, a computer readable medium is provided.
[0031] A computer-readable medium stores a computer program, which, when executed by a processor, implements the reconciliation method provided in an embodiment of the present invention.
[0032] One embodiment of the above invention has the following advantages or beneficial effects: after receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster; the first client associates the actual serial number of the target client with the identifier of the received transaction data and stores it in a preset storage system for query by each client in the reconciliation application cluster; after the second client in the reconciliation application cluster queries that the actual serial number of the target client is the actual serial number of the second client, the second client performs reconciliation on the received transaction data. It can improve the efficiency of reconciliation, ensure the high utilization rate of the reconciliation system, and avoid repeated reconciliation.
[0033] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0035] Figure 1 is a schematic diagram of main steps of a reconciliation method according to an embodiment of the present invention;
[0036] Figure 2 is a schematic diagram of client registration according to an embodiment of the present invention;
[0037] Figure 3 is a flowchart of a reconciliation method according to an embodiment of the present invention;
[0038] Figure 4 is a schematic diagram of a process of selecting a target client according to an embodiment of the present invention;
[0039] Figure 5 is a schematic diagram of a process for obtaining a reconciliation task according to an embodiment of the present invention;
[0040] Figure 6 is a schematic diagram of a process for executing a reconciliation task according to an embodiment of the present invention;
[0041] Figure 7 is a schematic diagram of a process for monitoring change events according to an embodiment of the present invention;
[0042] Figure 8 is an architecture diagram of a reconciliation application cluster according to an embodiment of the present invention;
[0043] Fig. 9 is a schematic diagram of main modules of a client in a reconciliation application cluster according to an embodiment of the present invention;
[0044] Fig.10is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0045] Fig.11 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0047] like Figure 1 As shown, the reconciliation method according to an embodiment of the present invention mainly includes the following steps S101 to S103.
[0048] Step S101: after receiving transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster.
[0049] Each client in the reconciliation application cluster registers as a temporary ordered node with the distributed service cluster to obtain its own actual sequence number, and saves the corresponding relationship between the actual sequence number of the client and the status of the client in the distributed service cluster.
[0050] After receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster, which may include: after receiving the transaction data, the first client in the reconciliation application cluster obtains the status of each client in the reconciliation application cluster from the distributed service cluster to select idle clients from the reconciliation application cluster, where the idle clients are clients with an idle status; the first client sorts the obtained idle clients to determine the logical serial numbers of the idle clients, which are the client serial numbers determined by sorting the idle clients, and saves the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers; using the identifier of the transaction data and the logical serial number of the idle client, according to a preset algorithm, determines the logical serial numbers of one or more target clients; according to the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, determines the actual serial numbers of one or more target clients, so as to select one or more target clients according to the actual serial numbers.
[0051] The identifier of the transaction data is the serial number of the transaction data; using the identifier of the transaction data and the logical serial number of the idle client, determining the logical serial number of one or more target clients according to a preset algorithm may include: calculating the hash value of the serial number of the transaction data, taking the modulus of the number of idle clients by the hash value of the serial number of the transaction data, and obtaining the logical serial number of one or more target clients.
[0052] By monitoring the change events of the distributed service cluster through a scheduled task, when the actual serial number of the client is monitored to be changed, the association between the actual serial number of the client and the transaction data identifier in the preset storage system can be reset according to the updated actual serial number of the client.
[0053] Step S102: The first client associates the actual serial number of the target client with the identifier of the received transaction data and stores it in a preset storage system for query by each client in the reconciliation application cluster.
[0054] The first client associates the actual serial number of the target client with the identifier of the received transaction data and stores them in a preset storage system, which may include: the first client generates a task execution identifier including the actual serial number of the target client and the identifier of the received transaction data; queries the preset storage system to see whether the task execution identifier already exists, and if the task execution identifier does not exist, adds the task execution identifier to the preset storage system.
[0055] The first client may generate a task execution identifier by concatenating the actual serial number of the target client with the identifier of the received transaction data, and after adding the task execution identifier to the preset storage system, set the state of the task execution identifier to an unlocked state.
[0056] Step S103: After the second client in the reconciliation application cluster inquires that the actual serial number of the target client is the actual serial number of the second client, the second client performs reconciliation on the received transaction data.
[0057] Before querying the association between the actual serial number of the client and the transaction data identifier from the preset storage system, each client in the reconciliation application cluster can query the distributed service cluster for its own status and determine that its own status is idle.
[0058] Before the second client performs reconciliation on the received transaction data, the process may include: the second client determines that the state of the task execution identifier including the actual serial number of the second client is an unlocked state, and then changes the state of the task execution identifier to a locked state.
[0059] After the second client performs reconciliation on the received transaction data, it may include: if the reconciliation is successful, the second client deletes the task execution identifier including the actual serial number of the second client from the preset storage system; if the reconciliation is unsuccessful, the second client changes the state of the task execution identifier including the actual serial number of the second client to an unlocked state.
[0060] Each client in the account reconciliation application cluster may serve as a first client or a second client.
[0061] Figure 2 is a schematic diagram of client registration according to an embodiment of the present invention.
[0062] like Figure 2 As shown, a distributed service cluster is, for example, a zookeeper cluster (abbreviated as zk cluster), and a reconciliation application cluster is a cluster composed of various clients, each of which is a reconciliation application. Each client in the reconciliation application cluster registers as a temporary ordered node with the distributed service cluster to obtain its own actual serial number, and saves the corresponding relationship between the actual serial number of the client and the status of the client in the distributed service cluster. Specifically, all application clients (i.e., clients) participating in the reconciliation register with the zk cluster as temporary ordered nodes when registering. Each client obtains the actual serial number assigned by the zk cluster, such as Figure 2 As shown in {znodeName}_0000000001, znodeName is the name of the temporary node, 0000000001 is the serial number assigned by the zk cluster's own mechanism, that is, the actual serial number of a client; the first key-value pair is established for each client, the key of the first key-value pair is the actual serial number of the client, and the value is the client's IP address and the client's status. The client's status can be idle (IDLE) or busy (BUSY), and the client's status defaults to idle. The first key-value pair is as follows Figure 2 As shown in client_0000000069:192.168.1.1&IDLE, 0000000069 is the actual serial number of the current client, 192.168.1.1 is the IP address of the current client, and IDLE is the status of the current client.
[0063] Figure 3 The figure is a flowchart of a reconciliation method according to an embodiment of the present invention.
[0064] like Figure 3As shown, the system architecture for implementing the reconciliation method of the embodiment of the present invention mainly includes a data receiving module, a data preloading module, a core reconciliation logic module, a reset worker module, a data cache (redis), and a database (DB). Among them, the data receiving module is responsible for receiving transaction data, and selecting one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster, and associating the actual serial number of the target client with the identifier of the received transaction data to store in a preset storage system for query by each client in the reconciliation application cluster; the data preloading module is mainly responsible for determining whether the current client is in an idle state on the zk cluster. If so, it obtains a preset number (such as 1000) of task execution identifiers from redis without any conditions, determines the locking state and the actual transaction serial number in the task execution identifier, and if it is in the unlock state and the actual transaction serial number is the actual serial number of the current client on the zk cluster, then the task execution in redis is The lock state of the identifier is changed from unlocked to locked, and the task execution identifier is placed in the memory queue of the current client. The current client's own transaction detail loading thread obtains the corresponding transaction data in batches from the database according to the actual transaction serial number in the task execution identifier, and then loads the transaction data into the memory of the current client; the core reconciliation logic module is mainly responsible for completing the reconciliation logic according to the business rules for the transaction data to be reconciled, and generating reconciliation result information; the reset worker module is mainly responsible for monitoring the change events of the distributed service cluster through scheduled tasks. When the actual serial number of the client is monitored to change, the association between the actual serial number of the client and the transaction data identifier in the preset storage system is reset according to the updated actual serial number of the client.
[0065] Each client in the reconciliation application cluster of the embodiment of the present invention can have the functions of the above-mentioned data receiving module, data preloading module, core reconciliation logic module, and reset worker module. Specifically, the data receiving module has the functions of the reconciliation client selection module and the associated storage module of the client in the embodiment below, and the core reconciliation logic module has the function of the reconciliation execution module of the client in the embodiment below. The functions of each module mentioned in this embodiment can be found in the introduction of the embodiment below.
[0066] Each client can receive transaction data and can also reconcile certain transaction data. The transaction data received by the same client and the transaction data actually reconciled may be different or the same, that is, the first client and the second client in the above embodiment may be the same or different clients.
[0067] For the same transaction data, the transaction data is received, and according to the status of each client in the reconciliation application cluster, one or more target clients that can perform reconciliation on the transaction data are selected as the first client, and the client that actually performs reconciliation on the transaction data is the second client.
[0068] Figure 4 The figure is a schematic diagram of a process of selecting a target client according to an embodiment of the present invention.
[0069] like Figure 4 As shown, the first client in the reconciliation application cluster receives transaction data, and the received transaction data is specifically actually received transaction data. Then, according to the status of each client in the reconciliation application cluster, one or more target clients that can perform reconciliation on the transaction data are selected. The embodiment of the present invention performs reconciliation, specifically reconciling the transaction data received by the first client (i.e., actually received transaction data) with the receivable transaction data obtained through the RPC interface or from the local memory. Since the actually received transaction data is generated after the receivable transaction data is generated, the actually received transaction data is used as the trigger point of the process. After receiving the actually received transaction data, any client obtains the actual serial numbers (i.e., the actual serial numbers of all idle clients on the zk cluster) Figure 4 ), and logically sort all idle clients to obtain the logical serial numbers of idle clients, and save the association between the logical serial numbers of idle clients and the actual serial numbers. According to the preset algorithm, the logical serial number of the client (i.e., the target client) that processes the reconciliation task corresponding to the actual transaction serial number is determined through the actual transaction serial number (i.e., the identifier of the transaction data), and the actual serial number of the client on the zk cluster is determined through the association between the client's logical serial number and the actual serial number, wherein the preset algorithm can be to take the modulus of the number of idle clients through the hash value (hash value) of the actual transaction serial number to obtain the logical serial number of the client that processes the reconciliation task corresponding to the actual transaction serial number.
[0070] The actual serial number of the target client is associated with the identifier of the received transaction data and stored in the preset storage system. The preset storage system can be redis. Specifically, a second key-value pair is established for each reconciliation task, wherein the key of the second key-value pair is the task execution identifier, which is specifically generated by concatenating the actual serial number of the target client and the actual transaction serial number. See Figure 4The step of assembling the transaction data serial number clientSeq_transcationId, the assembled transaction data serial number is the task execution identifier, wherein clientSeq represents the actual serial number of the client, transcationId represents the actual transaction serial number, and the value of the second key-value pair is the status of the reconciliation task, that is, the status of the task execution identifier, which can be a locked state (locked) or an unlocked state (unlocked). The status of the reconciliation task defaults to an unlocked state. The format of the second key-value pair stored in redis can be: clientSeq_transcationId: unlock, wherein clientSeq represents the actual serial number of the client, transcationId represents the actual transaction serial number, and unlock represents the status of the reconciliation task is an unlocked state. After redis locks the task execution identifier, the second key-value pair key: clientSeq_transcationId, value: lock_status is the locked state (locked). Retrieve whether the task execution identifier exists in redis. If not, save the task execution identifier to redis. If it exists, do not save the task execution identifier to redis to prevent duplication. The detailed data of the actual transaction flow corresponding to the actual transaction flow number (ie, the actual transaction data) is saved (persisted) in the database (DB).
[0071] Figure 5 The figure is a flowchart of obtaining a reconciliation task according to an embodiment of the present invention.
[0072] like Figure 5 As shown, each client (i.e., application client) in the reconciliation application cluster queries the distributed service cluster for its own status, and after determining that its own status is idle, queries the association between the client's actual serial number and the transaction data identifier from the preset storage system. Specifically, it determines whether the current client is in an idle state on the zk cluster. If not, terminate this process; if so, the current client obtains a preset number (such as 1000) of task execution identifiers from redis without any conditions (see Figure 5Steps to get the transaction serial number from redis). Determine the lock status and the actual transaction serial number in the task execution identifier. If it is unlocked and the actual transaction serial number is the actual serial number of the current client on the zk cluster, change the lock status of the task execution identifier in redis from unlocked to locked, and put the task execution identifier in the memory queue of the current client. The current client uses its own transaction detail loading thread to batch obtain the corresponding transaction data (referring to the actual transaction data) from the database according to the actual transaction serial number in the task execution identifier. See Figure 5 The steps of getting data in DB according to the serial number. Then load the transaction data into the client's memory for reconciliation.
[0073] Figure 6 The figure is a flowchart of executing a reconciliation task according to an embodiment of the present invention.
[0074] like Figure 6 As shown, the client performs reconciliation on the received transaction data. Specifically, the current client takes out the task execution identifier to be reconciled from a fixed end of the memory queue through its own reconciliation thread, see Figure 6 The step of retrieving data from the queue in the client memory; according to the actual transaction serial number in the task execution identifier, the corresponding receivable transaction data and actual transaction data are obtained through the RPC interface or local memory, and reconciliation is performed according to the reconciliation logic to determine whether the reconciliation is successful. If the reconciliation is successful, the task execution identifier is deleted from redis, see the step of removing the serial number from redis, and the reconciliation result is saved in the database, that is, the reconciliation result is persisted to the DB; if the reconciliation is unsuccessful, the state of the task execution identifier in redis is changed from locked to unlock, that is, the lock in redis is released.
[0075] Figure 7 It is a schematic diagram of a process of monitoring change events according to an embodiment of the present invention.
[0076] like Figure 7 As shown, the change event of the distributed service cluster (zk) is monitored by a scheduled task. When the actual serial number of the client is monitored to change, the association relationship between the actual serial number of the client and the transaction data identifier in the preset storage system is reset according to the updated actual serial number of the client. Specifically, the status change event of the zk cluster is monitored by a scheduled task, and the actual serial number of the client before the change (i.e. Figure 7According to the actual serial number (clientSeq) of the target client contained in the task execution identifier in redis, the actual transaction serial number corresponding to the actual serial number of the changed client before the change is re-selected as the target client that can perform reconciliation on the transaction data, and the actual serial number of the target client is associated with the identifier of the received transaction data and stored in the preset storage system, that is, Figure 7 The step in which the data is redistributed to the client sequence number according to the latest number of clients on zk.
[0077] Figure 8 4 is an architecture diagram of a reconciliation application cluster according to an embodiment of the present invention.
[0078] like Figure 8 As shown, the reconciliation application cluster 800 of one embodiment of the present invention includes multiple clients. Figure 8 The first client 801 and the second client 802 are exemplarily shown in FIG.
[0079] After receiving the transaction data, the first client 801 is used to select one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster.
[0080] The first client 801 is further used to associate the actual serial number of the target client with the identifier of the received transaction data and store it in a preset storage system for query by each client in the reconciliation application cluster.
[0081] The second client 802 is used to perform reconciliation on the received transaction data after querying that the actual serial number of the target client is the actual serial number of the second client.
[0082] In one embodiment, each client registers as a temporary ordered node with the distributed service cluster to obtain its own actual sequence number, and the corresponding relationship between the actual sequence number of the client and the state of the client is stored in the distributed service cluster.
[0083] In one embodiment, the first client is also used to: after receiving the transaction data, obtain the status of each client in the reconciliation application cluster from the distributed service cluster to select an idle client from the reconciliation application cluster, where the idle client is a client with an idle status; sort the obtained idle clients to determine the logical serial number of the idle client, and save the corresponding relationship between the logical serial number of the idle client and the actual serial number; use the identifier of the transaction data and the logical serial number of the idle client to determine the logical serial number of one or more target clients according to a preset algorithm; determine the actual serial number of one or more target clients according to the corresponding relationship between the logical serial number of the idle client and the actual serial number, so as to select one or more target clients according to the actual serial number.
[0084] In one embodiment, the identifier of the transaction data is the serial number of the transaction data; the first client is also used to: calculate the hash value of the serial number of the transaction data, modulo the number of idle clients by the hash value of the serial number of the transaction data, and obtain the logical serial number of one or more target clients.
[0085] In one embodiment, the first client is also used to: generate a task execution identifier including the actual serial number of the target client and an identifier of the received transaction data; query whether the task execution identifier already exists in the preset storage system, and if the task execution identifier does not exist, add the task execution identifier to the preset storage system.
[0086] In one embodiment, the first client is also used to generate a task execution identifier by concatenating the actual serial number of the target client with the identifier of the received transaction data, and after adding the task execution identifier to a preset storage system, set the status of the task execution identifier to an unlocked state.
[0087] In one embodiment, before querying the association between the actual serial number of the client and the transaction data identifier from the preset storage system, each client in the reconciliation application cluster is further configured to: query the distributed service cluster for their respective status and determine that their respective status is idle.
[0088] In one embodiment, before performing reconciliation on the received transaction data, the second client is also used to: determine that the state of the task execution identifier including the actual serial number of the second client is an unlocked state, and then change the state of the task execution identifier to a locked state; after performing reconciliation on the received transaction data, the second client is also used to: if the reconciliation is successful, delete the task execution identifier including the actual serial number of the second client from a preset storage system; if the reconciliation is unsuccessful, change the state of the task execution identifier including the actual serial number of the second client to an unlocked state.
[0089] In one embodiment, the change events of the distributed service cluster are monitored through a scheduled task. When the actual serial number of the client is monitored to have changed, the first client is also used to: reset the association between the actual serial number of the client and the transaction data identifier in the preset storage system according to the updated actual serial number of the client.
[0090] In addition, the specific implementation content of the reconciliation application cluster in the embodiment of the present invention has been described in detail in the above reconciliation method, so the repeated content will not be described again here.
[0091] Fig. 9 4 is a schematic diagram of main modules of a client in a reconciliation application cluster according to an embodiment of the present invention.
[0092] like Fig. 9 As shown, the client 900 in the account reconciliation application cluster of one embodiment of the present invention mainly includes: an account reconciliation client selection module 901, an association storage module 902, and an account reconciliation execution module 903.
[0093] The reconciliation client selection module 901 is used to select one or more target clients that can perform reconciliation on the received transaction data according to the status of each client in the reconciliation application cluster after receiving the transaction data.
[0094] The associated storage module 902 is used to associate the actual serial number of the target client with the identifier of the received transaction data and store them in a preset storage system for query by each client in the reconciliation application cluster, wherein the preset storage system is used to save the association relationship between the actual serial number of each client and the identifier of each transaction data.
[0095] The reconciliation execution module 903 is used to obtain the detailed data of the corresponding transaction data for reconciliation according to the identifier of the transaction data associated with the queried actual serial number after the actual serial number queried from the preset storage system is the actual serial number of the client.
[0096] The client 900 may further include a data preloading module and a worker resetting module. For specific functions, please refer to the introduction of the above embodiment.
[0097] In addition, the specific implementation content of the client in the reconciliation application cluster in the embodiment of the present invention has been described in detail in the above reconciliation method, so the repeated content will not be described again here.
[0098] Fig.10 An exemplary system architecture 1000 is shown to which the reconciliation method, reconciliation application cluster or related client according to an embodiment of the present invention can be applied.
[0099] like Fig.10As shown, the system architecture 1000 may include terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 is used to provide a medium for communication links between the terminal devices 1001, 1002, 1003 and the server 1005. The network 1004 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0100] Users can use terminal devices 1001, 1002, 1003 to interact with server 1005 through network 1004 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1001, 1002, 1003, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0101] The terminal devices 1001 , 1002 , and 1003 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0102] The server 1005 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 1001, 1002, and 1003. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0103] It should be noted that the reconciliation method provided in the embodiment of the present invention is generally executed by the server 1005 , and accordingly, the reconciliation application cluster or the related client is generally set in the server 1005 .
[0104] It should be understood that Fig.10 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0105] Reference below Fig.11 , which shows a schematic diagram of the structure of a computer system 1100 of a terminal device or a server suitable for implementing an embodiment of the present invention. Fig.11 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0106] like Fig.11As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage part 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the system 1100 are also stored. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0107] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed, so that a computer program read therefrom is installed into the storage section 1108 as needed.
[0108] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1109, and / or installed from the removable medium 1111. When the computer program is executed by the central processing unit (CPU) 1101, the above-mentioned functions defined in the system of the present invention are executed.
[0109] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0110] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0111] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a reconciliation client selection module, an associated storage module, and a reconciliation execution module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the reconciliation client selection module may also be described as "a module for selecting one or more target clients that can perform reconciliation on the received transaction data according to the status of each client in the reconciliation application cluster after receiving the transaction data."
[0112] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: after receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster; the first client associates the actual serial number of the target client with the identifier of the received transaction data and stores it in a preset storage system for query by each client in the reconciliation application cluster; after the second client in the reconciliation application cluster queries that the actual serial number of the target client is the actual serial number of the second client, the second client performs reconciliation on the received transaction data.
[0113] According to the technical solution of the embodiment of the present invention, after receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster; the first client associates the actual serial number of the target client with the identifier of the received transaction data and stores it in a preset storage system for query by each client in the reconciliation application cluster; after the second client in the reconciliation application cluster queries that the actual serial number of the target client is the actual serial number of the second client, the second client performs reconciliation on the received transaction data. This can improve the efficiency of reconciliation, ensure the high utilization rate of the reconciliation system, and avoid repeated reconciliation.
[0114] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A reconciliation method, characterized in that: include: After receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster; The first client associates the actual serial number of the target client with the identifier of the received transaction data and stores them in a preset storage system for query by each client in the reconciliation application cluster; After the second client in the reconciliation application cluster inquires that the actual serial number of the target client is the actual serial number of the second client, the second client performs reconciliation on the received transaction data; After receiving the transaction data, the first client in the reconciliation application cluster selects one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster, including: after receiving the transaction data, the first client in the reconciliation application cluster obtains the status of each client in the reconciliation application cluster from the distributed service cluster to select idle clients from the reconciliation application cluster, and the idle clients are clients with an idle status; the first client sorts the obtained idle clients to determine the logical serial numbers of the idle clients, and saves the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, and the actual serial numbers are obtained by each client registering as a temporary ordered node with the distributed service cluster; using the identifier of the transaction data and the logical serial number of the idle client, according to a preset algorithm, the logical serial numbers of the one or more target clients are determined; according to the corresponding relationship between the logical serial number of the idle client and the actual serial number, the actual serial numbers of the one or more target clients are determined to select the one or more target clients according to the actual serial numbers.
2. The method according to claim 1, characterized in that Also includes: Each client in the reconciliation application cluster is registered as a temporary ordered node with the distributed service cluster to obtain its own actual serial number, and the corresponding relationship between the actual serial number of the client and the status of the client is stored in the distributed service cluster.
3. The method according to claim 1, characterized in that The identifier of the transaction data is the serial number of the transaction data; The determining the logical serial numbers of the one or more target clients according to a preset algorithm by using the identifier of the transaction data and the logical serial number of the idle client includes: A hash value of the serial number of the transaction data is calculated, and the number of the idle clients is modulo the hash value of the serial number of the transaction data to obtain a logical serial number of the one or more target clients.
4. The method according to claim 2, characterized in that: The first client associates the actual serial number of the target client with the identifier of the received transaction data and stores them in a preset storage system, including: The first client generates a task execution identifier including an actual serial number of the target client and an identifier of the received transaction data; The preset storage system is queried to determine whether the task execution identifier already exists. If the task execution identifier does not exist, the task execution identifier is added to the preset storage system.
5. The method according to claim 4, characterized in that The first client generates the task execution identifier by concatenating the actual serial number of the target client with the identifier of the received transaction data, and after adding the task execution identifier to the preset storage system, sets the state of the task execution identifier to an unlocked state.
6. The method according to claim 5, characterized in that Before querying the preset storage system for the association between the actual serial number of the client and the transaction data identifier, each client in the reconciliation application cluster queries the distributed service cluster for its own status and determines that its own status is idle.
7. The method according to claim 5, characterized in that Before the second client performs account reconciliation on the received transaction data, the process includes: The second client determines that the state of the task execution identifier including the actual serial number of the second client is an unlocked state, and then changes the state of the task execution identifier to a locked state; After the second client performs account reconciliation on the received transaction data, the following steps are performed: If the reconciliation is successful, the second client will delete the task execution identifier including the actual serial number of the second client from the preset storage system; if the reconciliation is unsuccessful, the second client will change the state of the task execution identifier including the actual serial number of the second client to an unlocked state.
8. The method according to claim 2, characterized in that: Also includes: The change events of the distributed service cluster are monitored by a scheduled task. When the actual serial number of the client is monitored to be changed, the association between the actual serial number of the client and the transaction data identifier in the preset storage system is reset according to the updated actual serial number of the client.
9. A reconciliation application cluster, characterized in that: Includes multiple clients, including: The first client is used to select one or more target clients that can perform reconciliation on the transaction data according to the status of each client in the reconciliation application cluster after receiving the transaction data; The first client is further used to associate the actual serial number of the target client with the identifier of the received transaction data and store it in a preset storage system for query by each client in the reconciliation application cluster; The second client is used to perform reconciliation on the received transaction data after querying that the actual serial number of the target client is the actual serial number of the second client; The first client is also used to: after receiving the transaction data, obtain the status of each client in the reconciliation application cluster from the distributed service cluster to select an idle client from the reconciliation application cluster, wherein the idle client is a client with an idle status; sort the obtained idle clients to determine the logical serial numbers of the idle clients, and save the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, wherein the actual serial numbers are obtained when each client registers as a temporary ordered node with the distributed service cluster; determine the logical serial numbers of the one or more target clients according to a preset algorithm using the identifier of the transaction data and the logical serial number of the idle client; determine the actual serial numbers of the one or more target clients according to the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, so as to select the one or more target clients according to the actual serial numbers.
10. The account reconciliation application cluster according to claim 9, characterized in that: Each of the clients is registered as a temporary ordered node with the distributed service cluster to obtain its own actual serial number, and the corresponding relationship between the actual serial number of the client and the state of the client is stored in the distributed service cluster.
11. The account reconciliation application cluster according to claim 9, characterized in that: The identifier of the transaction data is the serial number of the transaction data; The first client is also used for: A hash value of the serial number of the transaction data is calculated, and the number of the idle clients is modulo the hash value of the serial number of the transaction data to obtain a logical serial number of the one or more target clients.
12. The account reconciliation application cluster according to claim 10, characterized in that: The first client is also used for: generating a task execution identifier including an actual serial number of the target client and an identifier of the received transaction data; The preset storage system is queried to determine whether the task execution identifier already exists. If the task execution identifier does not exist, the task execution identifier is added to the preset storage system.
13. The account reconciliation application cluster according to claim 12, characterized in that: The first client is also used for: The task execution identifier is generated by concatenating the actual serial number of the target client with the identifier of the received transaction data, and after the task execution identifier is added to the preset storage system, the state of the task execution identifier is set to an unlocked state.
14. The account reconciliation application cluster according to claim 13, characterized in that: Before querying the preset storage system for the association between the actual serial number of the client and the transaction data identifier, each client in the reconciliation application cluster is further configured to query the distributed service cluster for their respective status and determine that their respective status is idle.
15. The account reconciliation application cluster according to claim 13, characterized in that: Before performing reconciliation on the received transaction data, the second client is further used to: Determining that the state of the task execution identifier including the actual serial number of the second client is an unlocked state, and then changing the state of the task execution identifier to a locked state; After reconciliation is performed on the received transaction data, the second client is further used to: If the reconciliation is successful, the task execution identifier including the actual serial number of the second client will be deleted from the preset storage system; if the reconciliation is unsuccessful, the state of the task execution identifier including the actual serial number of the second client will be changed to an unlocked state.
16. The account reconciliation application cluster according to claim 10, characterized in that: The change event of the distributed service cluster is monitored by a scheduled task. When the actual serial number of the client is monitored to be changed, the first client is further used to: According to the updated actual serial number of the client, the association relationship between the actual serial number of the client and the transaction data identifier in the preset storage system is reset.
17. The client in the account reconciliation application cluster according to any one of claims 10 to 16, characterized in that: include: A reconciliation client selection module is used to select one or more target clients that can perform reconciliation on the received transaction data according to the status of each client in the reconciliation application cluster after receiving the transaction data, including: after receiving the transaction data, obtaining the status of each client in the reconciliation application cluster from the distributed service cluster to select idle clients from the reconciliation application cluster, where the idle clients are clients with an idle status; sorting the obtained idle clients to determine the logical serial numbers of the idle clients, and saving the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, where the actual serial numbers are obtained by each client registering as a temporary ordered node with the distributed service cluster; using the identifier of the transaction data and the logical serial number of the idle client, determining the logical serial numbers of one or more target clients according to a preset algorithm; determining the actual serial numbers of one or more target clients according to the corresponding relationship between the logical serial numbers of the idle clients and the actual serial numbers, so as to select one or more target clients according to the actual serial numbers; An association storage module, used for associating and storing the actual serial number of the target client with the identifier of the received transaction data in a preset storage system for query by each client in the reconciliation application cluster, wherein the preset storage system is used for storing the association relationship between the actual serial number of each client and the identifier of each transaction data; The reconciliation execution module is used to obtain the detailed data of the corresponding transaction data for reconciliation according to the identifier of the transaction data associated with the queried actual serial number after the actual serial number queried from the preset storage system is the actual serial number of the client.
18. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
19. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Automatic account checking method and automatic account checking system
CN105719182A
System data account checking method and device, storage medium and electronic equipment
CN107729553A