Transaction posting method and apparatus based on message middleware
By adopting a transaction recording method based on message middleware, the problem of real-time recording delay for single-information transactions in the credit payment system is solved, achieving efficient asynchronous parallel processing and improving transaction timeliness.
Patent Information
- Application Number
- CN202210891276.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-27
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-07-27
AI Technical Summary
The existing credit payment system suffers from a lag in the real-time processing of single-transaction transactions, affecting business timeliness.
The transaction accounting method based on message middleware is adopted. By distributing authorized transaction information to a preset number of information fragments and using a preset number of accounting threads to asynchronously and parallelly process the message queue, it is ensured that high-frequency transaction information of the same customer is processed in sequence.
It improves the correct processing order and speed for continuous high-frequency transactions by the same customer, thereby enhancing the timeliness of real-time settlement.
Smart Images

Figure CN115271738B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a transaction accounting method and apparatus based on message middleware. Background Technology
[0002] In the credit payment solution, the financial transaction processing method for credit card business scenarios is as follows: two transaction lines, authorization and clearing, are used to process financial transaction information sent by international organizations. Authorization transactions mainly involve transaction inspection and credit limit update processing, while clearing transactions mainly involve transaction processing and balance update. Authorization transactions are implemented online, while clearing transactions are mostly implemented in batches.
[0003] Currently, some credit cards (such as UnionPay cards) have single-information transaction characteristics, while others (Visa cards) involve both single-information and dual-information transactions simultaneously. Single-information transactions refer to financial transactions transmitted through the UnionPay channel. For a single financial transaction, UnionPay only sends one request to the issuing institution, while other international organizations send two requests: authorization and clearing. Currently, for single-information credit cards, when a transaction occurs, the issuing institution stores the account information and then processes it in batches at a specified time. This account update lags behind the transaction occurrence, affecting the timeliness of business support. Summary of the Invention
[0004] The purpose of this application is to provide a transaction recording method and apparatus based on message middleware to solve the problem that the order information in existing credit payment cannot be recorded in real time, which affects the timeliness of business support.
[0005] Firstly, a transaction posting method based on message middleware is provided, which may include:
[0006] After obtaining the consumption information from the consumption request of the authorized transaction customer, the consumption information is identified as authorized transaction information; the consumption information includes the consumption time and customer identifier;
[0007] Based on the customer identifier, the authorized transaction information is allocated to a pre-configured preset number of information segments, wherein each allocated information segment includes authorized transaction information corresponding to at least one customer identifier, arranged in chronological order of the consumption time;
[0008] According to the preset number, the number of message queues of the message middleware is configured to obtain message queues that correspond one-to-one with the allocated information segments of the preset number. For each information segment, the corresponding authorized transaction information is transmitted to the message queue corresponding to the information segment according to the order of the authorized transaction information in the information segment.
[0009] The preset number of entry threads are used to read authorization transaction information in the preset number of message queues, and the read authorization transaction information is subjected to entry processing.
[0010] In an optional implementation, after the consumption information is determined as the authorization transaction information, the method further includes:
[0011] The authorization transaction information is subjected to authorization transaction registration in chronological order of consumption time;
[0012] The authorization transaction information is distributed into a preset number of information shards pre-configured based on the customer identifier, including:
[0013] The registered authorization transaction information is distributed into the preset number of information shards pre-configured based on the customer identifier.
[0014] In an optional implementation, the authorization transaction information is distributed into the preset number of information shards pre-configured based on the customer identifier, including:
[0015] A preset hash algorithm is used to perform hash operation on the customer identifier to obtain a hash value corresponding to the customer identifier;
[0016] The hash value corresponding to the customer identifier and a value obtained by taking the preset number as a remainder are determined as a shard number corresponding to the customer identifier;
[0017] The authorization transaction information corresponding to the customer identifier is distributed into an information shard corresponding to the shard number.
[0018] In an optional implementation, the authorization transaction information is distributed into the preset number of information shards pre-configured based on the customer identifier, including:
[0019] If the target customer identifier is contained in a mapping relationship between the pre-recorded customer identifiers and shard numbers corresponding to the preset number of information shards, a target shard number corresponding to the target customer identifier is found according to the mapping relationship between the customer identifier and the shard number, and the authorization transaction information corresponding to the target customer identifier is distributed into an information shard corresponding to the target shard number;
[0020] If the target customer identifier is not contained in the mapping relationship between the pre-recorded customer identifiers and the shard numbers corresponding to the preset number of information shards, a mapping relationship between a target shard number with the least number of customer identifiers and the target customer identifier is established based on the number of customer identifiers corresponding to each shard number in the mapping relationship between the customer identifier and the shard number, and the authorization transaction information corresponding to the target customer identifier is distributed into an information shard corresponding to the target shard number.
[0021] In an optional implementation, the preset number of entry threads are used to read the authorization transaction information in the preset number of message queues, including:
[0022] Obtaining the thread number of each entry thread and the queue number of each message queue;
[0023] Based on the number matching relationship between the thread number and the queue number, the preset number of entry threads are used to read the authorization transaction information in the preset number of message queues.
[0024] In an optional implementation, after the read authorization transaction information is processed for entry, the method further includes:
[0025] For each message queue, the authorization transaction information processed for entry is deleted in the message queue.
[0026] In an optional implementation, the consumption information includes the consumption amount of this time;
[0027] Obtaining the consumption information in the consumption request of the customer authorized transaction, including:
[0028] Obtaining the consumption information in the consumption request of the customer;
[0029] Authorizing and verifying the consumption information, if the verification result meets the preset authorization condition, the consumption information is authorized for transaction to obtain the consumption information in the consumption request of the customer authorized transaction; the preset authorization condition refers to whether the account balance of the customer is greater than the consumption amount of this time, whether the card state of the credit card used for payment is normal, and whether the risk control rule verification result is risk-free.
[0030] In a second aspect, a transaction entry device based on a message middleware is provided, which can include:
[0031] A determination unit is configured to determine the consumption information in the consumption request of the customer authorized transaction as authorization transaction information after obtaining the consumption information; the consumption information includes a consumption time and a customer identifier;
[0032] An allocation unit is configured to allocate the authorization transaction information to a preset number of information shards pre-configured based on the customer identifier, wherein each information shard after allocation includes at least one customer identifier corresponding to the authorization transaction information arranged in the order of the consumption time;
[0033] A configuration unit is configured to configure the number of message queues of the message middleware according to the preset number, to obtain the message queue corresponding to the information shard after allocation in one-to-one manner.
[0034] The transmission unit is used to transmit the corresponding authorized transaction information to the message queue corresponding to each information segment according to the order of the authorized transaction information in the information segment.
[0035] The reading unit is used to read authorized transaction information from the preset number of message queues using a preset number of accounting threads;
[0036] The posting unit is used to post the authorized transaction information that has been read.
[0037] In an optional implementation, the apparatus further includes a registration unit;
[0038] The registration unit is used to register the authorized transaction information in chronological order of consumption time.
[0039] The allocation unit is specifically used to allocate the registered authorized transaction information to a pre-configured preset number of information segments based on the customer identifier.
[0040] In an optional implementation, the allocation unit is further specifically used for:
[0041] A preset hash algorithm is used to perform a hash operation on the customer identifier to obtain the hash value corresponding to the customer identifier;
[0042] The hash value corresponding to the customer identifier and the remainder of the preset quantity are determined as the shard number corresponding to the customer identifier;
[0043] The authorized transaction information corresponding to the customer identifier is allocated to the information fragment corresponding to the fragment number.
[0044] In an optional implementation, the allocation unit is further specifically used for:
[0045] If the mapping relationship between the pre-recorded customer identifier and the segment number corresponding to the preset number of information segments contains the target customer identifier, then according to the mapping relationship between the customer identifier and the segment number, the target segment number corresponding to the target customer identifier is found, and the authorized transaction information corresponding to the target customer identifier is allocated to the information segment corresponding to the target segment number.
[0046] If the target customer identifier is not included in the mapping relationship between the pre-recorded customer identifier and the corresponding shard number of information shards, then based on the number of customer identifiers corresponding to each shard number in the mapping relationship between the customer identifier and the shard number, a mapping relationship between the target shard number with the minimum number of identifiers and the target customer identifier is established, and the authorized transaction information corresponding to the target customer identifier is allocated to the information shard corresponding to the target shard number.
[0047] In an optional implementation, the reading unit is specifically configured to:
[0048] obtain thread numbers of the account-in threads and queue numbers of the message queues;
[0049] based on a number matching relationship between the thread numbers and the queue numbers, use a preset number of account-in threads to read authorized transaction information in a preset number of message queues.
[0050] In an optional implementation, the apparatus further includes a deleting unit.
[0051] The deleting unit is configured to, for each message queue, delete the authorized transaction information after account processing in the message queue.
[0052] In an optional implementation, the consumption information includes a current consumption amount; and the apparatus further includes an obtaining unit.
[0053] The obtaining unit is configured to obtain consumption information in a consumption request of a customer.
[0054] The consumption information is subjected to authorization verification, and if a verification result satisfies a preset authorization condition, the consumption information is subjected to an authorized transaction to obtain the consumption information in the consumption request of the customer authorized for the transaction; the preset authorization condition refers to whether an account balance of the customer is greater than the current consumption amount, whether a card state of a credit card used for payment is normal, and whether a risk control rule verification result is risk-free.
[0055] In a third aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus.
[0056] The memory is configured to store a computer program.
[0057] The processor is configured to execute the program stored on the memory to implement the method steps of any of the first aspect.
[0058] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the method steps of any of the first aspect.
[0059] The table lookup-based transaction entry method provided in the application determines the consumption information as authorized transaction information after obtaining the consumption information of the consumption request of the client of the authorized transaction; the consumption information includes consumption time and client identification; based on the client identification, the authorized transaction information is distributed into a preset number of information slices pre-configured, each information slice after distribution includes at least one client identification corresponding to the authorized transaction information arranged in the order of consumption time; according to the preset number, the number of message queues of the message middleware is configured, the message queues corresponding to the information slices after distribution in the preset number are obtained, and for each information slice, the corresponding authorized transaction information is transmitted into the message queue corresponding to the information slice according to the arrangement order of the authorized transaction information in the information slice; the preset number of entry threads are used to read the authorized transaction information in the preset number of message queues, and the read authorized transaction information is subjected to entry processing. The method is to execute asynchronous and parallel real-time entry processing on the consumption information of the authorized transaction, ensures the correct processing order of the consumption information in the parallel mode under the multi-threading when the same client continuously and frequently trades, and improves the processing speed, that is, improves the timeliness of real-time entry. BRIEF DESCRIPTION OF DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments of the application. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0061] Figure 1 A schematic diagram of a credit card transaction process provided by the embodiments of the application;
[0062] Figure 2 A flowchart of a message middleware-based method provided by the embodiments of the application;
[0063] Figure 3 A structural schematic diagram of a transaction entry device based on message middleware provided by the embodiments of the application;
[0064] Figure 4 A structural schematic diagram of an electronic device provided by the embodiments of the application. DETAILED DESCRIPTION
[0065] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. Based on the embodiments of the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0066] For the convenience of understanding, the transaction process of the credit card shown in the drawings will be described as follows: Figure 1
[0067] 1. The cardholder uses the POS device of the merchant to swipe the card and make a payment.
[0068] 2. The acquirer sends a request for receiving the payment to the bank after receiving the bank card information through the POS device, and the request includes the payment information.
[0069] 3. The acquirer requires the card organization to obtain the payment permission (authorization) from the card issuer.
[0070] 4. The card organization submits the payment information to the card issuer and requests to obtain the payment authorization (permission).
[0071] 5. The card issuer authorizes the merchant to collect the payment from the cardholder.
[0072] 6. The card issuer settles the money to the acquirer (or the merchant's account bank), and then the acquirer deposits the payment into the account.
[0073] Among them, the cardholder refers to the consumer; the merchant refers to the person selling goods; the acquirer refers to the account bank of the merchant; the card issuer refers to the account bank of the cardholder; the card organization refers to the network for building the payment information flow and the clearing information flow, such as VISA, MasterCard, etc.
[0074] The transaction entry method based on the message middleware provided by the embodiments of the present application can be applied to a server of an issuing bank. After obtaining consumption information in a consumption request of a client of an authorized transaction, the method determines the consumption information as authorized transaction information; the consumption information includes consumption time and a client identifier; based on the client identifier, the authorized transaction information is distributed into a preset number of information shards pre-configured, and each information shard after distribution includes at least one client identifier corresponding to the authorized transaction information arranged in a chronological order according to the consumption time; according to the preset number, the number of message queues of the message middleware is configured to obtain the message queues corresponding to the information shards after distribution in a one-to-one manner, and for each information shard, the corresponding authorized transaction information is transmitted into the message queue corresponding to the information shard according to the arrangement order of the authorized transaction information in the information shard; and the preset number of entry threads are used to read the authorized transaction information in the preset number of message queues, and the read authorized transaction information is subjected to entry processing.
[0075] That is, the method is to perform asynchronous and parallel real-time entry processing on the consumption information of the authorized transaction, which ensures the correct processing order of the consumption information in the parallel mode under multi-threading when the same client continuously transacts at a high frequency, and improves the processing speed.
[0076] The preferred embodiments of the present application are described below in conjunction with the accompanying drawings of the specification, and it should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application, and the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0077] Figure 2 A flowchart of a transaction entry method based on a lookup table provided by the embodiments of the present application is shown in FIG. 1. As shown in FIG. 1, the method can include the following steps. Figure 2
[0078] In step S210, after obtaining consumption information in a consumption request of a client of an authorized transaction, the consumption information is determined as authorized transaction information.
[0079] Before performing the step, the consumption information in the consumption request of the client of the authorized transaction needs to be obtained, which can specifically include the following steps.
[0080] In step S201, consumption information in a consumption request of a client is obtained; wherein the consumption request of the client can be a consumption request corresponding to at least one client.
[0081] Specifically, after the credit card is handled, the background server receives the consumption information of the current consumption when the credit card is used. The consumption information is in the form of a message. The data information in the field in the consumption information message is used to represent the consumption information of the current consumption, such as consumption card (bank card or credit card) information, consumption time, consumption amount, consumption product, current consumption amount, and customer identification information. The consumption card information can be a bank card or a credit card number. Since the consumption card information in the consumption information corresponding to each customer is unique, the customer identification can be the card number in the consumption card information, or the customer number corresponding to the card number.
[0082] The consumption information is authorized and verified. If the verification result meets the preset authorization condition, the corresponding consumption information is authorized for transaction, so as to obtain the consumption information in the consumption request of the customer authorized for transaction. The preset authorization condition refers to whether the account balance of the customer is greater than the current consumption amount, whether the card state of the credit card used for payment is normal, and whether the risk control rule verification result is no risk, which indicates that the consumption information is normal information.
[0083] In specific implementation, after obtaining the consumption information in the consumption request of the customer authorized for transaction, the consumption information is determined as the authorized transaction information.
[0084] In some embodiments, after the consumption information is determined as the authorized transaction information, the authorized transaction information can be registered for authorized transaction in the order of the consumption time.
[0085] Step S220, based on the customer identification, the authorized transaction information is distributed to the pre-configured preset number of information fragments.
[0086] In order to correctly handle the sequence and processing speed of the mode under multi-threading when the same customer continuously transacts at a high frequency, all authorized transaction information corresponding to each customer identification in the plurality of customer identifications can be distributed in the same information fragment, and the authorized transaction information corresponding to each customer identification is sorted in the order of the consumption time, that is, each information fragment after distribution includes consumption information corresponding to each customer identification in at least one customer identification arranged in the order of the consumption time.
[0087] Further, in order to balance the load of the information fragment, the authorized transaction information corresponding to the customer identification needs to be evenly distributed to realize that the preset number of information fragments each contains authorized transaction information, and the authorized transaction information corresponding to the same customer identification is distributed in the same information fragment.
[0088] In specific implementation, the following two distribution methods can be included:
[0089] Method one, a preset hash algorithm is used to perform hash operation on the customer identification to obtain a hash value corresponding to the customer identification.
[0090] The hash value corresponding to the customer identifier and the value obtained by taking the remainder of the preset number of information shards are determined as the shard number corresponding to the customer identifier. Then, the authorization transaction information corresponding to the customer identifier is allocated to the information shard corresponding to the shard number.
[0091] For example, taking the customer identifier 2455 and the preset number of information shards 100 as an example, since the value obtained by taking the remainder of 2455 and 100 is 55, the shard number corresponding to the customer identifier 2455 is 55. At this time, the authorization transaction information corresponding to the customer identifier 2455 is allocated to the information shard corresponding to the 55th shard number.
[0092] Method two, pre-record the mapping relationship between the customer identifier and the shard number corresponding to the preset number of information shards;
[0093] If the target customer identifier is included in the mapping relationship between the customer identifier and the shard number, the target shard number corresponding to the target customer identifier is found according to the mapping relationship between the customer identifier and the shard number, and the authorization transaction information corresponding to the target customer identifier is allocated to the information shard corresponding to the target shard number.
[0094] If the target customer identifier is not included in the mapping relationship between the customer identifier and the shard number, the mapping relationship between the target shard number with the least number of identifiers and the target customer identifier is established based on the number of identifiers of the customer identifier corresponding to each shard number in the mapping relationship between the customer identifier and the shard number, and the authorization transaction information corresponding to the target customer identifier is allocated to the information shard corresponding to the target shard number.
[0095] If there are multiple shard numbers with the least number of identifiers, a shard number can be randomly selected as the target shard number, or the smallest shard number can be selected as the target shard number according to the order of the shard number, etc.
[0096] For example, the pre-recorded mapping relationship between the customer identifier and the three shard numbers includes: the mapping relationship between the customer identifier 1 and the shard number 1; the mapping relationship between the customer identifier 2 and the shard number 1; the mapping relationship between the customer identifier 3 and the shard number 2; and the mapping relationship between the customer identifier 4 and the shard number 3.
[0097] When the target customer identifier is 2, the mapping relationship between the customer identifier and the three shard numbers is found, and the target shard number corresponding to the target customer identifier 2 is obtained as 1. Then, the authorization transaction information corresponding to the target customer identifier 2 is allocated to the information shard corresponding to the target shard number 1.
[0098] When the target customer identifier is 5, it is found that the target customer identifier 5 is not contained in the mapping relationship between the customer identifier and the three shard numbers, at this time, the number of identifiers of the customer identifier corresponding to each shard number is obtained; the shard number 3 and the shard number 2 with the least number of identifiers are taken as candidate shard numbers, and one of the shard number 3 and the shard number 2 is randomly selected as a target shard number corresponding to the target customer identifier 5, such as the target shard number 2, the mapping relationship between the target shard number 2 and the target customer identifier 5 is established, and then the authorized transaction information corresponding to the target customer identifier 5 is distributed to the information shard corresponding to the target shard number 2.
[0099] It should be noted that, since the above-mentioned mode two needs to create and record the mapping relationship of the new customer identifier in real time, it not only occupies resources, but also has high cost, therefore, the above-mentioned mode one is the optimal distribution mode of the present application.
[0100] Step S230, the number of message queues of the message middleware is configured according to the preset number, to obtain the message queue corresponding to the information shard after distribution of the preset number, and for each information shard, the corresponding authorized transaction information is transmitted to the message queue corresponding to the information shard according to the arrangement order of the authorized transaction information in the information shard.
[0101] In a specific implementation, the number of message queues of the message middleware is configured according to the preset number of information shards, a preset number of account entry threads are configured, and one thread corresponds to one message queue. Then, for each information shard, the corresponding authorized transaction information is transmitted to the message queue corresponding to the information shard according to the arrangement order of the authorized transaction information in the information shard, so as to ensure that the order of the authorized transaction information in the corresponding message queue is unchanged.
[0102] Step S240, the authorized transaction information in the preset number of message queues is read by using the preset number of account entry threads, and the read authorized transaction information is subjected to account entry processing.
[0103] The number matching relationship refers to the relationship with the same number.
[0104] In a specific implementation, the thread number of each account entry thread and the queue number of each message queue are obtained.
[0105] Then, based on the number matching relationship between the thread number and the queue number, the authorized transaction information in the preset number of message queues is read by using the preset number of account entry threads.
[0106] For example, the thread number 1 and the queue number 1 have a number matching relationship, then the account entry thread corresponding to the thread number 1 only reads the authorized transaction information in the information shard corresponding to the shard number 1 from the message queue corresponding to the queue number 1.
[0107] Since the authorized transaction information in the message queue is sorted according to the consumption time of each customer identifier, and the authorized transaction information corresponding to the same customer identifier is ensured to be distributed in the same message queue, the account entry thread can realize the correct processing order and processing speed under the multi-thread mode when the same account is continuously traded at a high frequency.
[0108] Further, in order to ensure that the authorized transaction information will not be repeatedly processed, it is necessary to delete the authorized transaction information after the account entry processing of the read authorized transaction information.
[0109] The method provided by the application is based on a table-based transaction account entry method. After obtaining the consumption information in the consumption request of the customer authorized transaction, the consumption information is determined as authorized transaction information. The consumption information includes consumption time and customer identifier. Based on the customer identifier, the authorized transaction information is distributed to a pre-configured preset number of information fragments. Each information fragment after distribution includes at least one customer identifier corresponding to the authorized transaction information arranged in order of consumption time. According to the preset number, the number of message queues of the message middleware is configured to obtain the message queue corresponding to the distributed information fragment of the preset number, and for each information fragment, the corresponding authorized transaction information is transmitted to the message queue corresponding to the information fragment according to the arrangement order of the authorized transaction information in the information fragment. The preset number of account entry threads are used to read the authorized transaction information in the preset number of message queues, and the read authorized transaction information is processed. This method improves the timeliness of real-time account entry through parallel asynchronous account processing.
[0110] Corresponding to the above method, the application embodiment also provides a transaction account entry device based on a message middleware, as shown in Figure 3 The transaction account entry device based on the message middleware includes a determination unit 310, an allocation unit 320, a configuration unit 330, a transmission unit 340, a reading unit 350 and an account entry unit 360.
[0111] The determination unit 310 is used to determine the consumption information as authorized transaction information after obtaining the consumption information in the consumption request of the customer authorized transaction. The consumption information includes consumption time and customer identifier.
[0112] The allocation unit 320 is used to distribute the authorized transaction information to a pre-configured preset number of information fragments based on the customer identifier. Each information fragment after distribution includes at least one customer identifier corresponding to the authorized transaction information arranged in order of the consumption time.
[0113] The configuration unit 330 is configured to configure a quantity of message queues of a message middleware according to the preset quantity, to obtain message queues corresponding to the information shards after allocation of the preset quantity one by one.
[0114] The transmission unit 340 is configured to, for each information shard, transmit corresponding authorized transaction information to the message queue corresponding to the information shard according to an arrangement order of the authorized transaction information in the information shard.
[0115] The reading unit 350 is configured to read the authorized transaction information in the preset quantity of message queues by using a preset quantity of account threads.
[0116] The account unit 360 is configured to perform account processing on the read authorized transaction information.
[0117] In an optional implementation, the apparatus further includes a registration unit 370.
[0118] The registration unit 370 is configured to perform authorized transaction registration on the authorized transaction information according to a chronological order of consumption times.
[0119] The allocation unit 320 is specifically configured to allocate the registered authorized transaction information to a preset quantity of information shards pre-configured based on the customer identifier.
[0120] In an optional implementation, the allocation unit 320 is further specifically configured to:
[0121] perform hash operation on the customer identifier by using a preset hash algorithm to obtain a hash value corresponding to the customer identifier;
[0122] determine a shard number corresponding to the customer identifier by using the hash value corresponding to the customer identifier and a value obtained by taking the preset quantity as a remainder; and
[0123] allocate the authorized transaction information corresponding to the customer identifier to an information shard corresponding to the shard number.
[0124] In an optional implementation, the allocation unit 320 is further specifically configured to:
[0125] if the target customer identifier is included in a mapping relationship between the pre-recorded customer identifier and shard numbers corresponding to the preset quantity of information shards, find a target shard number corresponding to the target customer identifier according to the mapping relationship between the customer identifier and the shard number, and allocate the authorized transaction information corresponding to the target customer identifier to an information shard corresponding to the target shard number.
[0126] If the target customer identifier is not included in the mapping relationship between the pre-recorded customer identifier and the corresponding shard number of information shards, then based on the number of customer identifiers corresponding to each shard number in the mapping relationship between the customer identifier and the shard number, a mapping relationship between the target shard number with the minimum number of identifiers and the target customer identifier is established, and the authorized transaction information corresponding to the target customer identifier is allocated to the information shard corresponding to the target shard number.
[0127] In an optional implementation, read unit 350 is specifically used for:
[0128] Get the thread number of each accounting thread and the queue number of each message queue;
[0129] Based on the matching relationship between the thread number and the queue number, a preset number of accounting threads are used to read the authorized transaction information in the preset number of message queues.
[0130] In an optional implementation, the apparatus further includes a deletion unit 380;
[0131] The deletion unit 380 is used to delete the authorized transaction information after the accounting process in each message queue.
[0132] In an optional implementation, the consumption information includes the amount of the current consumption; the device further includes an acquisition unit 390;
[0133] The acquisition unit 390 is used to acquire consumption information from the customer's consumption request;
[0134] In addition, the consumption information is authorized and verified. If the verification result meets the preset authorization conditions, the consumption information is authorized for transaction in order to obtain the consumption information in the consumption request of the authorized transaction customer. The preset authorization conditions refer to whether the customer's account balance is greater than the consumption amount, whether the card status of the credit card used for payment is normal, and whether the risk control rule verification result is risk-free.
[0135] The functions of each functional unit in the message middleware-based transaction accounting device provided in the above embodiments of this application can be implemented through the above method steps. Therefore, the specific working process and beneficial effects of each unit in the message middleware-based transaction accounting device provided in the embodiments of this application will not be repeated here.
[0136] This application also provides an electronic device, such as... Figure 4 As shown, it includes a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440.
[0137] a memory 430 for storing a computer program;
[0138] a processor 410 for implementing the following steps when executing the program stored in the memory 430:
[0139] determining the consumption information in the consumption request of the client as the authorized transaction information after obtaining the consumption information in the consumption request of the client authorized transaction; the consumption information includes consumption time and client identification;
[0140] based on the client identification, the authorized transaction information is distributed to a preset number of information fragments pre-configured, wherein each information fragment after distribution includes at least one client identification corresponding to the authorized transaction information arranged in the order of the consumption time;
[0141] According to the preset number, the number of message queues of the message middleware is configured, and the message queues corresponding to the distributed information fragments of the preset number are obtained, and for each information fragment, the corresponding authorized transaction information is transmitted to the message queue corresponding to the information fragment according to the arrangement order of the authorized transaction information in the information fragment;
[0142] A preset number of entry threads are used to read the authorized transaction information in the preset number of message queues, and the read authorized transaction information is processed.
[0143] In an optional implementation, after the consumption information is determined as the authorized transaction information, the method further comprises:
[0144] According to the order of consumption time, the authorized transaction information is registered for authorized transaction;
[0145] Based on the client identification, the authorized transaction information is distributed to a preset number of information fragments pre-configured, including:
[0146] Based on the client identification, the registered authorized transaction information is distributed to a preset number of information fragments pre-configured.
[0147] In an optional implementation, based on the client identification, the authorized transaction information is distributed to a preset number of information fragments pre-configured, including:
[0148] A preset hash algorithm is used to hash the client identification to obtain a hash value corresponding to the client identification;
[0149] The hash value corresponding to the client identification and the value after the preset number is taken as a remainder are determined as the fragment number corresponding to the client identification;
[0150] Assign the authorization transaction information corresponding to the customer identifier to the information shard corresponding to the shard number.
[0151] In an optional implementation, based on the customer identifier, the authorization transaction information is assigned to a preset number of information shards, including:
[0152] If the target customer identifier is contained in the mapping relationship between the pre-recorded customer identifiers and the shard numbers corresponding to the preset number of information shards, then according to the mapping relationship between the customer identifier and the shard number, a target shard number corresponding to the target customer identifier is found, and the authorization transaction information corresponding to the target customer identifier is assigned to the information shard corresponding to the target shard number.
[0153] If the target customer identifier is not contained in the mapping relationship between the pre-recorded customer identifiers and the shard numbers corresponding to the preset number of information shards, then based on the number of identifiers of the customer identifiers corresponding to each shard number in the mapping relationship between the customer identifier and the shard number, a mapping relationship between a target shard number with the least number of identifiers and the target customer identifier is established, and the authorization transaction information corresponding to the target customer identifier is assigned to the information shard corresponding to the target shard number.
[0154] In an optional implementation, the authorization transaction information in the preset number of message queues is read by a preset number of entry threads, including:
[0155] Obtaining the thread number of each entry thread and the queue number of each message queue;
[0156] Based on the number matching relationship between the thread number and the queue number, the authorization transaction information in the preset number of message queues is read by a preset number of entry threads.
[0157] In an optional implementation, after the read authorization transaction information is processed for entry, the method further includes:
[0158] For each message queue, the authorization transaction information processed for entry is deleted in the message queue.
[0159] In an optional implementation, the consumption information includes the consumption amount of this time;
[0160] Obtaining the consumption information in the consumption request of the customer authorized for transaction, including:
[0161] Obtaining the consumption information in the consumption request of the customer;
[0162] The consumption information is authorized and verified, and if the verification result meets a preset authorization condition, the consumption information is authorized and traded to obtain the consumption information in the consumption request of the customer authorized to trade.
[0163] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0164] The communication interface is used for communication between the electronic device and other devices.
[0165] The memory can include a Random Access Memory (RAM) and can also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.
[0166] The processor mentioned above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; can also be a Digital Signal Processing (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0167] Since the implementation manners and beneficial effects of the electronic device in the above-mentioned embodiments can be achieved by the steps in the embodiments shown in the above-mentioned embodiments, the specific working process and beneficial effects of the electronic device provided by the embodiments of the present application will not be repeated here. Figure 2 The specific working process and beneficial effects of the electronic device provided by the embodiments of the present application will not be repeated here.
[0168] In a further example provided in the present application, a computer readable storage medium is provided, and the computer readable storage medium stores instructions which, when executed on a computer, cause the computer to perform the message middleware based transaction crediting method according to any one of the examples described above.
[0169] In a further example provided in the present application, a computer program product is provided, and the computer program product contains instructions which, when executed on a computer, cause the computer to perform the message middleware based transaction crediting method according to any one of the examples described above.
[0170] Those skilled in the art should understand that the examples in the present application can be provided in the form of a method, a system or a computer program product. Therefore, the examples in the present application can be in the form of an entirely hardware example, an entirely software example or an example combining software and hardware aspects. Moreover, the examples in the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0171] The examples in the present application are described with reference to flowcharts and / or block diagrams of the method, device (system) and computer program product according to the examples in the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0172] These computer program instructions can also be stored in a computer readable memory capable of directing the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce a product including instruction means, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks
[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer implemented process, so that the instructions executed on the computer or other programmable device provide the functions specified in the flowcharts and / or block diagrams. Figure 1one or more processes and / or blocks Figure 1 the steps of the functions specified in the one or more blocks.
[0174] While the preferred embodiments in the application have been described, additional variations and modifications can be made to the embodiments in the application by those of skill in the art once they have the benefit of the present disclosure. Therefore, the appended claims are intended to encompass within their scope all possible embodiments in the application as pertains to the scope of the claims.
[0175] It is apparent that those skilled in the art can make various changes and modifications to the embodiments in the application without departing from the spirit and scope of the embodiments in the application. Therefore, the embodiments in the application also intend to encompass these changes and modifications within the scope of the claims of the embodiments in the application and their equivalents.
Claims
1. A message-middleware based transaction logging method, characterized by, The method comprises: After obtaining consumption information in a consumption request of a client authorized transaction, the consumption information is determined as authorized transaction information; the consumption information comprises a consumption time and a client identifier; Based on the client identifier, the authorized transaction information is distributed into a preset number of information slices configured in advance, wherein each information slice after distribution comprises at least one client identifier corresponding to the authorized transaction information arranged in the order of the consumption time; According to the preset number, the number of message queues of a message middleware is configured to obtain a message queue corresponding to each information slice after distribution of the preset number, and for each information slice, the corresponding authorized transaction information is transmitted into the message queue corresponding to the information slice according to the arrangement order of the authorized transaction information in the information slice; A preset number of account threads are used to read the authorized transaction information in the preset number of message queues, and the read authorized transaction information is subjected to account processing; Wherein, after the consumption information is determined as the authorized transaction information, the method further comprises: According to the order of the consumption time, the authorized transaction information is subjected to authorized transaction registration; Based on the client identifier, the authorized transaction information is distributed into a preset number of information slices configured in advance, comprising: Based on the client identifier, the registered authorized transaction information is distributed into a preset number of information slices configured in advance; Wherein, based on the client identifier, the registered authorized transaction information is distributed into a preset number of information slices configured in advance, comprising: If the target client identifier is contained in the mapping relationship between the pre-recorded client identifier and the slice number corresponding to the preset number of information slices, the target slice number corresponding to the target client identifier is found according to the mapping relationship between the client identifier and the slice number, and the authorized transaction information corresponding to the target client identifier is distributed into the information slice corresponding to the target slice number; the slice number corresponding to the client identifier is determined by processing the corresponding client identifier by using a preset hash algorithm; If the target client identifier is not contained in the mapping relationship between the pre-recorded client identifier and the slice number corresponding to the preset number of information slices, the mapping relationship between the target slice number with the least identifier number and the target client identifier is established based on the identifier number of the client identifier corresponding to each slice number in the mapping relationship between the client identifier and the slice number, and the authorized transaction information corresponding to the target client identifier is distributed into the information slice corresponding to the target slice number; Wherein, if the slice number with the least identifier number is multiple, a slice number is randomly selected as the target slice number, or the smallest slice number is selected as the target slice number according to the slice number order.
2. The method of claim 1, wherein, Based on the client identifier, the authorized transaction information is distributed into a preset number of information slices configured in advance, comprising: A preset hash algorithm is used to hash the client identifier to obtain a hash value corresponding to the client identifier; The hash value corresponding to the client identifier and the value after the preset number is taken as a remainder are determined as the slice number corresponding to the client identifier; The authorization transaction information corresponding to the customer identifier is allocated into the information shard corresponding to the shard number.
3. The method of claim 1, wherein, The authorization transaction information in the preset number of message queues is read by using a preset number of entry threads in correspondence, including: Thread numbers of the entry threads and queue numbers of the message queues are obtained. The authorization transaction information in the preset number of message queues is read by using a preset number of entry threads in correspondence based on the number matching relationship between the thread numbers and the queue numbers.
4. The method of claim 1, wherein, After the read authorization transaction information is processed for entry, the method further includes: For each message queue, the authorization transaction information processed for entry is deleted in the message queue.
5. The method of claim 1, wherein, The consumption information includes the current consumption amount; The consumption information in the consumption request of the customer authorized for transaction is obtained, including: The consumption information in the consumption request of the customer is obtained. The consumption information is authorized and verified, and if the verification result meets the preset authorization condition, the consumption information is authorized for transaction to obtain the consumption information in the consumption request of the customer authorized for transaction. The preset authorization condition refers to whether the account balance of the customer is greater than the current consumption amount, whether the card state of the credit card used for payment is normal, and whether the risk control rule verification result is risk-free.
6. A message-middleware based transaction logging apparatus, characterized by comprising: The device includes: A determination unit is configured to determine the consumption information in the consumption request of the customer authorized for transaction as authorization transaction information after obtaining the consumption information, and the consumption information includes a consumption time and a customer identifier. An allocation unit is configured to allocate the authorization transaction information to a preset number of information shards pre-configured based on the customer identifier, and each information shard after allocation includes authorization transaction information corresponding to each customer identifier in the at least one customer identifier arranged in the order of the consumption time. A configuration unit is configured to configure the number of message queues of a message middleware according to the preset number to obtain message queues corresponding to the information shards after allocation in one-to-one correspondence. A transmission unit is configured to transmit corresponding authorization transaction information to the message queue corresponding to each information shard in the order of the arrangement of the authorization transaction information in the information shard. A reading unit is configured to read the authorization transaction information in the preset number of message queues by using a preset number of entry threads in correspondence. An entry unit is configured to process the read authorization transaction information for entry. After the consumption information is determined as authorization transaction information, the method further includes: The authorization transaction information is registered for authorization transaction in the order of the consumption time. The distribution unit is specifically configured to: if the target customer identifier is contained in the mapping relationship between the pre-recorded customer identifiers and the shard numbers corresponding to the preset number of information shards, then the target shard number corresponding to the target customer identifier is found according to the mapping relationship between the customer identifiers and the shard numbers, and the authorized transaction information corresponding to the target customer identifier is distributed into the information shard corresponding to the target shard number, wherein the shard number corresponding to the customer identifier is determined by processing the corresponding customer identifier by using a preset hash algorithm; if the target customer identifier is not contained in the mapping relationship between the pre-recorded customer identifiers and the shard numbers corresponding to the preset number of information shards, then the mapping relationship between the target shard number with the least number of identifiers and the target customer identifier is established based on the number of identifiers of the customer identifiers corresponding to each shard number in the mapping relationship between the customer identifiers and the shard numbers, and the authorized transaction information corresponding to the target customer identifier is distributed into the information shard corresponding to the target shard number; wherein if the shard number with the least number of identifiers is multiple, then a shard number is randomly selected as the target shard number, or the smallest shard number is selected as the target shard number according to the order of the shard numbers.
7. An electronic device, comprising: The electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store a computer program; The processor is used to execute the program stored on the memory, and realize the method steps of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to realize the method steps of any one of claims 1-5.
Citation Information
Patent Citations
Account entry method, device, computer device and storage medium
CN109472577A
Accounting method, device andapparatus for single information transaction
CN111199393A
Message consumption method and device, electronic equipment and computer readable medium
CN113760498A