CN112612807B - Distributed transaction data consistency system design method - Google Patents

Distributed transaction data consistency system design method Download PDF

Info

Publication number
CN112612807B
CN112612807B CN202011628921.4A CN202011628921A CN112612807B CN 112612807 B CN112612807 B CN 112612807B CN 202011628921 A CN202011628921 A CN 202011628921A CN 112612807 B CN112612807 B CN 112612807B
Authority
CN
China
Prior art keywords
message
service
payment
state
polling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011628921.4A
Other languages
Chinese (zh)
Other versions
CN112612807A (en
Inventor
黄建平
张琴
石雄伟
何静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Rongxiang Digital Technology Co ltd
Original Assignee
Zhejiang Rongxiang Digital Technology Holding Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Rongxiang Digital Technology Holding Co ltd filed Critical Zhejiang Rongxiang Digital Technology Holding Co ltd
Priority to CN202011628921.4A priority Critical patent/CN112612807B/en
Publication of CN112612807A publication Critical patent/CN112612807A/en
Application granted granted Critical
Publication of CN112612807B publication Critical patent/CN112612807B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3821Electronic credentials
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0222During e-commerce, i.e. online transactions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention provides a distributed transaction data consistency system design method, which comprises a payment module, a data processing module and a timer polling module, wherein the payment module comprises payment service, coupon service, card service, point service and order service, the data processing module comprises message service and message middleware, the timer polling module starts timed polling on the whole system, when a user clicks a payment button, a message triggered by a payment request in the payment module is sent to the data processing module, the message middleware monitors a consumption message, and the message service changes the message state into a finished state; the invention ensures the data consistency between payment and coupons, cards and credits by polling the message state by the timer; the distributed data consistency based on the message service ensures the data consistency.

Description

Design method of distributed transaction data consistency system
Technical Field
The invention relates to the technical field of data processing, in particular to a payment transaction data consistency system design method based on distributed transactions.
Background
Along with the great promotion of the efficiency of various industries in the payment industry, points, coupons and vouchers are often used in the payment process, the problem of inconsistent data often occurs during payment, the payment fails, the coupons and points are used up, the business execution success or the payment success is failed, the calling of the coupons or points service fails, the problem that the consistency of distributed transaction data needs to be solved by technicians in the field is solved, the distributed cooperative processing is carried out by splitting the business function into a plurality of services, namely, a distributed micro-service rack forms a trend, and the problem that how to ensure the consistency and the integrity of data among multiple services becomes non-neglectable is solved; chinese patent document CN110955670A discloses a method and system for controlling consistency of payment transaction data based on distributed transactions, which changes payment order information and corresponding business logic processing according to channel response data obtained in real time by obtaining real-time response data such as refund, withdrawal, shortcut and the like during channel synchronous response, returns a payment processing result to a client, generates corresponding original transaction voucher information at the same time, sends the original transaction voucher information to an accounting system for accounting processing, obtains the payment transaction data in real time, performs synchronous processing on the obtained real-time data, and uses an automatic timeout mechanism and a transaction compensation algorithm as assistance to ensure timeliness and consistency of data processing, effectively realizes high concurrency and high consistency of data transmission, and simultaneously ensures integrity of the data; the invention adopts an independent message service and timer polling method to ensure the consistency of payment transaction data.
Disclosure of Invention
The invention aims to provide a system design method for the consistency of distributed transaction data, which realizes the consistency of the distributed transaction data by polling messages to be sent through an independent message service and a timer.
In order to achieve the purpose, the invention provides the following technical scheme:
the invention provides a distributed transaction data consistency system design, which comprises a payment module, a data processing module and a timer polling module, wherein the payment module comprises payment service, coupon service, card service, point service and order service, the data processing module comprises message service and message middleware, the timer polling module starts timed polling on the whole system, when a user clicks a payment button, a message triggered by a payment request in the payment module is sent to the data processing module, the data processing module calls the message service to change the message state into a to-be-sent state, the payment service creates an order and calls a third-party payment interface, the data processing module calls the message service to change the message state into a sent state, and the data processing module delivers the message to the message middleware, the message middleware monitors consumption messages, the coupon service, the card ticket service, the point service or the order service deducts corresponding coupons, cards or points and updates the order state, the coupon service, the card ticket service, the point service or the order service informs the message service, and the message service changes the message state into a finished state;
when the polling finds that the message in the state of 'waiting to be sent' is expired, the message service initiates state inquiry to the payment service, and the payment service returns to the message middleware to continue to execute the operation of creating an order and calling a third-party payment interface;
when the message in the 'sent' state is found to be expired through polling, the message service sends the message in the 'sent' state to the message middleware MQ, after the coupon service, the card ticket service and the score service monitor the message, the message middleware returns to the message middleware to continue to execute coupon, card ticket or score deduction operation under the condition of ensuring idempotency, meanwhile, the message middleware monitors consumption and notifies the message service, and the message service updates the message to be in the 'finished' state or directly deletes the message.
Further, the payment request includes at least one of a load order information request, a coupon information request, a card information request, and a points information request.
Further, the message service is used for updating the state of the message sent by the payment module and message storage, wherein the state of the message comprises a status message of 'to send', 'sent' and 'completed'; the message store stores the data order and the state information of the message into a database.
Further, the message is sent according to the topic of the message middleware when the message is delivered.
Further, the listening to the consumption message is used for increasing the user points, deducting the user coupons or cards and increasing the records of the user using the coupons.
Further, the polling is a type of query compensation.
Further, the polling is to execute a timing task, and whether the time for creating the message triggered by the payment request is expired when the timing task is executed is compared; if the time difference between the message creation triggered by the payment request and the time when the polling task is executed is less than the time set by service execution, polling the next message, and judging that the message is in an unexpired state; if the difference between the time of message creation triggered by the payment request and the time of polling task execution is greater than the time set by service execution, the message is judged to be in an expired state;
in some preferred schemes, the time set by the service execution can be set to be 2 min.
Further, the time timed by the timer is set to be the time limit according to the business rule, and may be set to be 30 seconds, 1 minute or 2 minutes, and the timer performs timed polling on the whole system with distributed transaction data consistency.
Further, the distributed transaction data consistency design method is used for designing the system, and comprises the following steps under the normal condition of timer polling:
(1) the user clicks a payment button;
(2) a payment request trigger message;
(3) calling the message service to change the message state into a to-be-sent state;
(4) creating an order and calling a third party payment interface;
(5) invoking the message service to change a message state to a 'sent' state;
(6) the message middleware monitors consumption messages;
(7) coupon, coupon or credit deduction;
(8) the message service changes the message status to a "sent" status.
Further, the timer polling is to poll each message in the system, and the step (3) and the step (5) are the key to determine whether the payment data are consistent in the payment process, so that when the message in the state of "to send" in the timer polling step (3) and the message in the state of "sent" in the step (5) are abnormal, the operation is repeated in time, and the consistency of the data between the payment and the coupon, the card coupon and the credit is ensured.
The invention has the following beneficial effects: (1) the invention ensures the data consistency between payment and coupons, coupons and credits by polling the message state by the timer; (2) the distributed data consistency based on the message service guarantees the consistency of the data.
Drawings
FIG. 1 is a block diagram of the system of the present invention.
Fig. 2 is a flow chart of the present invention polling a "to send" message at a timer.
Fig. 3 is a flow chart of the present invention polling for a "sent" message at a timer.
Fig. 4 is a flow chart of a method of the present invention for polling for a normal condition at a timer.
Detailed Description
The following detailed description of the embodiments of the present invention is provided in conjunction with the accompanying drawings, and it should be noted that the embodiments are merely specific illustrations of the present invention, and should not be considered as limitations of the present invention, and the purpose of the embodiments is to make technical solutions of the present invention better understood and reproduced by those skilled in the art, and the protection scope of the present invention should be subject to the scope defined by the claims.
The invention is further described with reference to the following detailed description and accompanying drawings:
as shown in fig. 1, the present invention provides a distributed transaction data consistency system design, which includes a payment module 1, a data processing module 2, and a timer polling module 3, where the payment module 1 includes a payment service 11, a coupon service 12, a card service 13, a credit service 14, and an order service 15, the data processing module 2 includes a message service 21 and a message middleware 22, the timer polling module 3 starts timed polling on the entire system, when a user clicks a payment button, a message triggered by a payment request in the payment module 1 is sent to the data processing module 2, the data processing module 2 invokes the message service to change a message status to a "to be sent" status, the payment service 11 creates an order and invokes a third party payment interface, the data processing module 2 invokes the message service 21 to change a message status to a "sent" status, the data processing module 2 delivers a message to the message middleware 22, the message middleware 22 monitors a consumption message, the coupon service 12, the card service 13, the score service 14 or the order service 15 deducts corresponding coupons, cards or scores and updates the order state, the coupon service 12, the card service 13, the score service 14 or the order service 15 notifies the message service 21, and the message service 21 changes the message state to a 'completed' state;
as shown in fig. 2, when polling the message in the "to send" state, the message service 21 initiates a state query to the payment service, and the payment service 11 returns to the message middleware 22 to continue to perform the operations of creating an order and invoking a third party payment interface, if the operations of creating an order and invoking a third party payment interface are successful, the message middleware 22 sends an MQ message to the message service 21 and updates the message state to the "sent" state, otherwise, deletes the message;
as shown in fig. 3, when polling finds the message in the "sent" status, the message service 21 sends the message in the "sent" status that expires to the message middleware MQ, and after the coupon service 12, the card service 13, and the credit service 14 listen to the message, the message middleware 22 returns to continue to perform the coupon, card or credit deduction operation while ensuring the idempotency, and meanwhile, the message middleware listens for consumption and notifies the message service 21, and the message service 21 updates the message to the "completed" status or directly deletes the message.
Further, the payment request includes at least one of a load order information request, a coupon information request, a card information request, and a points information request.
Further, the message service 21 is configured to update the status of the message sent by the payment module 1 and the message storage, where the status of the message includes a "to send" status message, a "sent" status message, and a "completed" status message; the message store stores the data order and the state information of the message into a database.
Further, the message is sent according to the topic of the message middleware when the message is delivered.
Further, the listening to the consumption message is used for increasing the user points, deducting the user coupons or cards and increasing the records of the user using the coupons.
Further, the polling is a type of query compensation.
Further, the polling is to execute a timing task, and whether the time of message creation triggered by the payment request is expired when the timing task is executed is compared; if the time difference between the message creation triggered by the payment request and the time when the polling task is executed is less than the time set by service execution, polling the next message, and judging that the message is in an unexpired state; if the difference between the time of message creation triggered by the payment request and the time of polling task execution is greater than the time set by service execution, the message is judged to be in an expired state;
in some preferred schemes, the time set by the service execution can be set to be 2 min.
Further, the time timed by the timer is set to be the time limit according to the business rule, and can be set to be 30 seconds, 1 minute and 2 minutes.
As shown in fig. 4, the distributed transaction data consistency design method is used to design the system, and under the normal condition of timer polling, the method comprises the following steps:
s1, clicking a payment button by a user;
s2, payment request trigger message;
s3, calling the message service to change the message state to a 'to be sent' state;
s4, creating an order and calling a third party payment interface;
s5, calling the message service to change the message state to the sent state;
s6, the message middleware monitors the consumption message;
s7, coupon or credit deduction;
s8, the message service changes the message status to "sent" status.
Further, the timer polling is to poll each message in the system, and the step (3) and the step (5) are the key to determine whether the payment data are consistent in the payment process, so that when the timer polling message in the "to be sent" state in the step (3) and the message in the "sent" state in the step (5) find abnormality in time, the operation is repeated in time, and the consistency of the data between the payment and the coupon, the card and the credit is ensured.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the present application.

Claims (9)

1. The distributed transaction data consistency system is characterized by comprising a payment module, a data processing module and a timer polling module, wherein the payment module comprises payment service, coupon service, card service, point service and order service, the data processing module comprises message service and message middleware, the timer polling module starts timed polling on the whole system, when a user clicks a payment button, a message triggered by a payment request in the payment module is sent to the data processing module, the data processing module calls the message service to change the message state into a to-be-sent state, the payment service creates an order and calls a third-party payment interface, the data processing module calls the message service to change the message state into a sent state, and the data processing module sends a message to the message middleware, the message middleware monitors consumption messages, the coupon service, the card ticket service, the point service or the order service deducts corresponding coupons, cards or points and updates the order state, the coupon service, the card ticket service, the point service or the order service informs the message service, and the message service changes the message state into a finished state;
when the polling finds that the message in the state of 'waiting to be sent' is expired, the message service initiates state inquiry to the payment service, and the payment service returns to the message middleware to continue to execute the operation of creating an order and calling a third-party payment interface;
when the message in the 'sent' state is found to be expired through polling, the message service sends the message in the 'sent' state to the message middleware MQ, after the coupon service, the card ticket service and the score service monitor the message, the message middleware returns to the message middleware to continue to execute coupon, card ticket or score deduction operation under the condition of ensuring idempotency, meanwhile, the message middleware monitors consumption and notifies the message service, and the message service updates the message to be in the 'finished' state or directly deletes the message.
2. The distributed transaction data consistency system of claim 1, wherein the payment request comprises at least one of a load order information request, a coupon information request, a card information request, and a points information request.
3. The distributed transaction data consistency system of claim 1, wherein the message service is configured to update a status of messages sent by the payment module and a message save, the status of the messages comprising a "pending send" status message, a "sent" status message, and a "completed" status message; the message store stores the data order and the state information of the message into a database.
4. The distributed transaction data consistency system of claim 1, wherein the posted message is sent according to a topic of the message middleware.
5. The distributed transaction data consistency system of claim 1, wherein the listening for consumption messages is a record for increasing user points, deducting user coupons or tickets, and increasing user usage coupons.
6. The distributed transactional data consistency system of claim 1, wherein said polling is a query compensation.
7. The distributed transaction data consistency system of claim 6, wherein the polling is the execution of a timed task, and wherein the time of message creation compared to a payment request trigger has expired when the timed task was executed; if the time difference between the message creation triggered by the payment request and the time when the polling task is executed is less than the time set by service execution, polling the next message, and judging that the message is in an unexpired state; and if the difference between the time of message creation triggered by the payment request and the time of polling task execution is greater than the time set by service execution, judging that the message is in an expired state.
8. The distributed transaction data consistency system of claim 7, wherein the timer times a time that is self-set by a business rule, and the timer polls the system for the consistency of the entire distributed transaction data.
9. Distributed transaction data consistency design method for a system according to any of claims 1 to 8, comprising the following steps in normal case of timer polling:
(1) the user clicks a payment button;
(2) a payment request trigger message;
(3) calling the message service to change the message state into a state of 'waiting to be sent';
(4) creating an order and calling a third party payment interface;
(5) invoking the message service to change a message state to a 'sent' state;
(6) the message middleware monitors consumption messages;
(7) coupon, coupon or credit deduction;
(8) the message service changes the message status to a "completed" status.
CN202011628921.4A 2020-12-31 2020-12-31 Distributed transaction data consistency system design method Active CN112612807B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011628921.4A CN112612807B (en) 2020-12-31 2020-12-31 Distributed transaction data consistency system design method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011628921.4A CN112612807B (en) 2020-12-31 2020-12-31 Distributed transaction data consistency system design method

Publications (2)

Publication Number Publication Date
CN112612807A CN112612807A (en) 2021-04-06
CN112612807B true CN112612807B (en) 2022-07-05

Family

ID=75253243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011628921.4A Active CN112612807B (en) 2020-12-31 2020-12-31 Distributed transaction data consistency system design method

Country Status (1)

Country Link
CN (1) CN112612807B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116132309A (en) * 2023-02-08 2023-05-16 浪潮通信信息系统有限公司 Batch business processing method and system for network management resources

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104426929A (en) * 2013-08-23 2015-03-18 深圳市昆特科技有限公司 monitoring and management system
CN105183879A (en) * 2015-09-22 2015-12-23 浪潮集团有限公司 Method for distributed database to keep transactional consistency under cloud computation
CN106993023A (en) * 2017-03-01 2017-07-28 北京交通大学 Distributed transaction solution under micro services framework
CN111340470A (en) * 2020-02-24 2020-06-26 中国工商银行股份有限公司 Block chain transaction processing method, node and contract container
CN111752970A (en) * 2020-06-26 2020-10-09 武汉众邦银行股份有限公司 Distributed query service response method based on cache and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9818136B1 (en) * 2003-02-05 2017-11-14 Steven M. Hoffberg System and method for determining contingent relevance
US9350629B2 (en) * 2012-08-22 2016-05-24 Oracle International Corporation System and method for ensuring internet protocol (IP) address and node name consistency in a middleware machine environment
CN108306740B (en) * 2018-01-22 2020-07-31 华中科技大学 Intel SGX state consistency protection method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104426929A (en) * 2013-08-23 2015-03-18 深圳市昆特科技有限公司 monitoring and management system
CN105183879A (en) * 2015-09-22 2015-12-23 浪潮集团有限公司 Method for distributed database to keep transactional consistency under cloud computation
CN106993023A (en) * 2017-03-01 2017-07-28 北京交通大学 Distributed transaction solution under micro services framework
CN111340470A (en) * 2020-02-24 2020-06-26 中国工商银行股份有限公司 Block chain transaction processing method, node and contract container
CN111752970A (en) * 2020-06-26 2020-10-09 武汉众邦银行股份有限公司 Distributed query service response method based on cache and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李莎.移动交易容错设计与实现.《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》.2018,I138-469. *

Also Published As

Publication number Publication date
CN112612807A (en) 2021-04-06

Similar Documents

Publication Publication Date Title
CN111459575B (en) Call request processing method and device and computer storage medium
US20030158883A1 (en) Message processing
CN112612807B (en) Distributed transaction data consistency system design method
CN101727647A (en) Multiple bank account consumption information management method and device
CN111125106A (en) Batch running task execution method, device, server and storage medium
CN111177158B (en) Method for matching order with stock consistently
CN113112344A (en) Business processing method, device, storage medium and computer program product
CN111026560B (en) Method, apparatus, computer device and storage medium for processing product data
WO2020243904A1 (en) Refund method, transaction system, account system, and storage medium
US20230206267A1 (en) System and method for omnichannel text-based communication utilizing adaptive instructions
CN114155047A (en) High-concurrency asynchronous electronic coupon sending method based on SaaS platform
CN111242762A (en) Financial product purchasing method, device and system
CN112988775B (en) Method, computing device and storage medium for processing batch transactions
CN108564424B (en) Method for reducing errors in transaction information query and payment transaction system
CN110971679B (en) Conference service scheduling method and device
CN114595071A (en) Security dealer core transaction data synchronization system and method
CN110889765B (en) Transaction information reporting method and device
CN114004701A (en) Method and device for generating transaction result, electronic equipment and storage medium
CN112162988A (en) Distributed transaction processing method and device and electronic equipment
EP1791056A1 (en) Data processing method and system
CN111861746A (en) Method and device for processing transaction data
CN111598699A (en) Divide moist system based on cluster
CN110070442A (en) A kind of refund processing method, server and storage medium
CN111259032A (en) Service processing method and device
CN115134320B (en) Transaction system for determining time sequence based on message distribution

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 315500 floor 1, Weize building, No. 182, Nanshan Road, Jinping street, Fenghua District, Ningbo City, Zhejiang Province (self declaration)

Patentee after: Zhejiang Rongxiang Digital Technology Co.,Ltd.

Address before: Room 1535, 129 Liuhe Road, Xihu District, Hangzhou, Zhejiang 310000

Patentee before: Zhejiang Rongxiang Digital Technology Holding Co.,Ltd.