CN112184445A - Asynchronous notification method and system based on dynamic configuration - Google Patents

Asynchronous notification method and system based on dynamic configuration Download PDF

Info

Publication number
CN112184445A
CN112184445A CN202011062417.2A CN202011062417A CN112184445A CN 112184445 A CN112184445 A CN 112184445A CN 202011062417 A CN202011062417 A CN 202011062417A CN 112184445 A CN112184445 A CN 112184445A
Authority
CN
China
Prior art keywords
retry
message
time
updating
configuration
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.)
Pending
Application number
CN202011062417.2A
Other languages
Chinese (zh)
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.)
Yinsheng Payment Service Co Ltd
Original Assignee
Yinsheng Payment Service 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 Yinsheng Payment Service Co Ltd filed Critical Yinsheng Payment Service Co Ltd
Priority to CN202011062417.2A priority Critical patent/CN112184445A/en
Publication of CN112184445A publication Critical patent/CN112184445A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides an asynchronous notification method based on dynamic configuration, which comprises the following steps: the method comprises the following steps: subscribing a message queue MQ of channel retry configuration, and updating a cache of the channel retry configuration in the notification service cluster in real time; step two: acquiring a platform notification failure message reaching the retry time, updating an optimistic lock, and notifying a trading system according to different channels; step three: judging a return result of the transaction system, and updating the database in real time; the embodiment of the invention improves the success rate of message delivery and reduces the problem of message loss.

Description

Asynchronous notification method and system based on dynamic configuration
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an asynchronous notification method and system based on dynamic configuration.
Background
With the development of payment services, the number of asynchronous notifications in each channel is multiplied due to the increase of channels of a payment gateway and the multiplication of transaction amount, and the conventional payment gateway cannot deal with the problem of notification loss caused by network problems, notification processing errors and the like, so that the transaction state cannot be updated in time, and the payment gateway is long in money and even complains. And for these problems, only the repeated notification of the channel side can be relied on, but some channels only notify once, and if the above problems occur, the payment gateway cannot solve the problems.
Summary of the invention
In order to overcome the defects of the prior art, the invention provides a problem of how to improve the success rate of message delivery and reduce the message loss by using an asynchronous notification method based on dynamic configuration.
The technical scheme adopted by the invention for solving the technical problems is as follows: an asynchronous notification method based on dynamic configuration comprises the following steps:
the method comprises the following steps: subscribing a message queue MQ of channel retry configuration, and updating a cache of the channel retry configuration in the notification service cluster in real time;
step two: acquiring a platform notification failure message reaching the retry time, updating an optimistic lock, and notifying a trading system according to different channels;
step three: and judging a return result of the transaction system, and updating the database in real time.
Specifically, the step of updating the cache notifying the channel retry configuration in the service cluster in real time includes:
and according to different channels, the retry times and the corresponding retry intervals are in one-to-one correspondence.
Specifically, a platform notification failure message of reaching the retry time is acquired, an optimistic lock is updated, and a trading system is notified according to different channels, wherein the steps specifically include:
traversing the query for configurable data;
after the data are taken out, updating all the optimistic locks of the inquired data at one time, and adding an optimistic lock mark;
and cutting data, and carrying out multithread concurrent asynchronous query on all queried data.
Specifically, the traversing query configurable data satisfies the following conditions, which specifically include:
when the sending state is a failure state;
the current time is greater than the next retry time;
the optimistic lock flag of the database is 0;
the number of remaining retries is greater than 0.
Specifically, the step of judging the return result of the transaction system comprises the following steps:
when the message is successfully sent, updating the message into a successful message;
when the transmission of the message fails, the next retry time is calculated and updated.
Preferably, when the message is successfully sent, after the message is updated to be a successful message, the steps further include:
updating the residual retry times, and subtracting 1 from the current residual retry times;
updating the sending state to be a success state and a success time;
the optimistic lock flag of the update database is 0.
Specifically, when the message transmission fails, the next retry time is calculated and updated, and the steps specifically include:
obtaining the retry configuration data of the channel to which the corresponding failure record belongs;
the next retry time is calculated by the remaining retry number 1 of the current failed message and the current time.
Preferably, after calculating the next retry time by the remaining retry number 1 of the current failed message and the current time, the method further includes:
the next retry time of the update message and the remaining retry number 0;
the optimistic lock flag of the update database is 0.
Preferably, when the remaining number of times of the retry remains 0 times, the transmission status is updated to a retry completion status.
A dynamically configured based asynchronous notification system, the system comprising:
the subscription unit is used for subscribing the message queue MQ of channel retry configuration and updating the cache of the channel retry configuration in the notification service cluster in real time;
the acquisition unit is used for acquiring a platform notification failure message reaching the retry time, updating the optimistic lock and notifying a transaction system according to different channels;
and the judging unit is used for judging the returned result of the transaction system and updating the database in real time.
The invention has the beneficial effects that: subscribing a message queue MQ of channel retry configuration, updating a cache of the channel retry configuration in the notification service cluster in real time, acquiring a platform notification failure message reaching retry time, updating an optimistic lock, notifying a transaction system according to different channels, judging a transaction system return result, and updating a database in real time, so that the message delivery success rate is improved, and the message loss problem is reduced.
Drawings
Fig. 1 is a flow chart of an asynchronous notification method based on dynamic configuration.
FIG. 2 is a functional block diagram of an asynchronous notification system based on dynamic configuration.
FIG. 3 is a flow diagram of a dynamically configured based asynchronous notification system.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The following detailed description of specific implementations of the present invention is provided in conjunction with specific embodiments:
the first embodiment is as follows:
fig. 1 shows an implementation flow of an asynchronous notification method based on dynamic configuration according to a first embodiment of the present invention, and for convenience of description, only the relevant parts related to the embodiment of the present invention are shown, which is detailed as follows:
in step S101, subscribing to a message queue MQ for channel retry configuration, and updating a cache for channel retry configuration in the notification service cluster in real time;
specifically, the step of updating the cache notifying the channel retry configuration in the service cluster in real time includes:
and according to different channels, the retry times and the corresponding retry intervals are in one-to-one correspondence.
In step S102, a platform notification failure message of reaching the retry time is acquired, an optimistic lock is updated, and a trading system is notified according to different channels;
specifically, a platform notification failure message of reaching the retry time is acquired, an optimistic lock is updated, and a trading system is notified according to different channels, wherein the steps specifically include:
traversing the query for configurable data;
after the data are taken out, updating all the optimistic locks of the inquired data at one time, and adding an optimistic lock mark;
and cutting data, and carrying out multithread concurrent asynchronous query on all queried data.
Specifically, the traversing query configurable data satisfies the following conditions, which specifically include:
when the sending state is a failure state;
the current time is greater than the next retry time;
the optimistic lock flag of the database is 0;
the number of remaining retries is greater than 0.
In step S103, it is determined that the transaction system returns a result, and the database is updated in real time.
Specifically, the step of judging the return result of the transaction system comprises the following steps:
when the message is successfully sent, updating the message into a successful message;
when the transmission of the message fails, the next retry time is calculated and updated.
Preferably, when the message is successfully sent, after the message is updated to be a successful message, the steps further include:
updating the residual retry times, and subtracting 1 from the current residual retry times;
updating the sending state to be a success state and a success time;
the optimistic lock flag of the update database is 0.
Specifically, when the message transmission fails, the next retry time is calculated and updated, and the steps specifically include:
obtaining the retry configuration data of the channel to which the corresponding failure record belongs;
the next retry time is calculated by the remaining retry number 1 of the current failed message and the current time.
Preferably, after calculating the next retry time by the remaining retry number 1 of the current failed message and the current time, the method further includes:
the next retry time of the update message and the remaining retry number 0;
the optimistic lock flag of the update database is 0.
Preferably, when the remaining number of times of the retry remains 0 times, the transmission status is updated to a retry completion status.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by relevant hardware instructed by a program, and the program may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc.
Example two:
fig. 2 shows a structure of a dynamic configuration-based asynchronous notification system for mass data query based on a pre-distributed database according to a second embodiment of the present invention, and for convenience of description, only the relevant parts related to the second embodiment of the present invention are shown, which are detailed as follows:
a subscribing unit 201, configured to subscribe to a message queue MQ for channel retry configuration, and update a cache for channel retry configuration in a notification service cluster in real time;
an obtaining unit 202, configured to obtain a platform notification failure message when the retry time is reached, update an optimistic lock, and notify a transaction system according to different channels;
and the judging unit 203 is used for judging the return result of the transaction system and updating the database in real time.
In the embodiment of the application, a message queue MQ for channel retry configuration is subscribed, the cache of the channel retry configuration in a notification service cluster is updated in real time, a platform notification failure message reaching the retry time is obtained, an optimistic lock is updated, a transaction system is notified according to different channels, the return result of the transaction system is judged, and a database is updated in real time, so that the message delivery success rate is improved, and the message loss problem is reduced; the detailed implementation of each unit can refer to the description of the first embodiment, and is not repeated herein.
Example three:
fig. 3 shows a flowchart of an asynchronous notification system based on dynamic configuration according to a third embodiment of the present invention, and for convenience of description, only the parts related to the third embodiment of the present invention are shown, which include:
the method comprises the following steps: subscribing a message queue MQ of channel retry configuration, updating a cache of the channel retry configuration in the notification service cluster in real time, and aiming at different channel retry strategies, wherein the cache is different; such as:
1. channel A: the retry times are 3 times, and each time interval is 30 seconds, 120 seconds and 1200 seconds;
2. channel B: the retry times are 5 times, and each time interval is 30 seconds, 60 seconds, 120 seconds, 300 seconds and 1800 seconds;
step two: acquiring a platform notification failure message of which the retry time is reached, updating an optimistic lock, and notifying a trading system according to a channel;
traverse 100 pieces of (configurable) data per query, condition:
the sending state is a failure state;
the current time is larger than the next retry time, and the addition of the next retry time mainly prevents the time which is not sent from being repeatedly inquired out;
the optimistic lock flag of the database is 0;
the number of remaining retries is more than 0
2. After the data are successfully taken out, the optimistic lock flag of all inquired data is updated to be 1 at one time, and the optimistic lock flag is added to prevent other servers of the cluster from being repeatedly taken out for consumption;
3. data is cut, 100 pieces of data which are inquired are processed asynchronously and concurrently in a multithreading mode, the number of multithreading tasks can be configured according to the configuration of a server, 5 thread tasks are started by default to be executed simultaneously, a transaction system is informed as fast as possible, and the informing efficiency is improved;
step three: judging a return result of the transaction system, and updating database information in real time; if the transmission is successful, updating the message success information; if the retry time fails, calculating and updating the next retry time;
return success (simultaneous update):
updating the residual retry times, and subtracting 1 from the current residual retry times;
time for updating the sending state to be successful and successful;
updating the optimistic lock flag' of the database to 0;
and returning failure:
1. acquiring channel retry configuration data corresponding to the failure records, wherein the retry times of the channel B are assumed to be 5, the retry time intervals are 30 seconds, 60 seconds, 120 seconds, 300 seconds and 1800 seconds, and the array is interval;
2. calculating the next retry time by the remaining retry number 1 of the current failure message and the current time (now)
Calculate the current time interval as: interval [5-1] ═ 1800 seconds
Calculate the next retry time: data 1800 seconds + now
Calculating the remaining times: 1-1 ═ 0
Updating the next retry time data and the residual retry times of the message for 0 time;
simultaneously updating the optimistic lock flag of the database to be 0;
if the residual retry number remains 0 times, updating the sending state to be a retry completion state;
note: the remaining number of retries is 0 at minimum.
In the embodiment of the present invention, an asynchronous notification system based on dynamic configuration may be implemented by corresponding hardware or software units, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the embodiments described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation.
Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention. The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An asynchronous notification method based on dynamic configuration is characterized by comprising the following steps:
the method comprises the following steps: subscribing a message queue MQ of channel retry configuration, and updating a cache of the channel retry configuration in the notification service cluster in real time;
step two: acquiring a platform notification failure message reaching the retry time, updating an optimistic lock, and notifying a trading system according to different channels;
step three: and judging a return result of the transaction system, and updating the database in real time.
2. The asynchronous notification method based on dynamic configuration as claimed in claim 1, wherein the cache of channel retry configuration in the notification service cluster is updated in real time, the steps include:
and according to different channels, the retry times and the corresponding retry intervals are in one-to-one correspondence.
3. The asynchronous notification method based on dynamic configuration according to claim 2, wherein a platform notification failure message reaching a retry time is obtained, an optimistic lock is updated, and a transaction system is notified according to different channels, and the steps specifically include:
traversing the query for configurable data;
after the data are taken out, updating all the optimistic locks of the inquired data at one time, and adding an optimistic lock mark;
and cutting data, and carrying out multithread concurrent asynchronous query on all queried data.
4. The asynchronous notification method based on dynamic configuration as claimed in claim 3, wherein traversing query-configurable data satisfies the following conditions, specifically comprising:
when the sending state is a failure state;
the current time is greater than the next retry time;
the optimistic lock flag of the database is 0;
the number of remaining retries is greater than 0.
5. The asynchronous notification method based on dynamic configuration according to claim 4, wherein the step of judging that the transaction system returns a result specifically comprises:
when the message is successfully sent, updating the message into a successful message;
when the transmission of the message fails, the next retry time is calculated and updated.
6. The asynchronous notification method based on dynamic configuration as claimed in claim 5, wherein when the message is successfully sent, the step of updating the message to a successful message further comprises:
updating the residual retry times, and subtracting 1 from the current residual retry times;
updating the sending state to be a success state and a success time;
the optimistic lock flag of the update database is 0.
7. The asynchronous notification method based on dynamic configuration as claimed in claim 6, wherein when the message transmission fails, the next retry time is calculated and updated, and the steps specifically include:
obtaining the retry configuration data of the channel to which the corresponding failure record belongs;
the next retry time is calculated by the remaining retry number 1 of the current failed message and the current time.
8. The asynchronous notification method based on dynamic configuration as claimed in claim 7, wherein after calculating the next retry time by the remaining retry number 1 of the current failure message and the current time, the steps further comprise:
the next retry time of the update message and the remaining retry number 0;
the optimistic lock flag of the update database is 0.
9. The asynchronous notification method based on dynamic configuration as claimed in claim 8, wherein when the number of remaining sufficient retries remains 0, the sending status is updated to be a retry completion status.
10. An asynchronous notification system based on dynamic configuration, the system comprising:
the subscription unit is used for subscribing the message queue MQ of channel retry configuration and updating the cache of the channel retry configuration in the notification service cluster in real time;
the acquisition unit is used for acquiring a platform notification failure message reaching the retry time, updating the optimistic lock and notifying a transaction system according to different channels;
and the judging unit is used for judging the returned result of the transaction system and updating the database in real time.
CN202011062417.2A 2020-09-30 2020-09-30 Asynchronous notification method and system based on dynamic configuration Pending CN112184445A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011062417.2A CN112184445A (en) 2020-09-30 2020-09-30 Asynchronous notification method and system based on dynamic configuration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011062417.2A CN112184445A (en) 2020-09-30 2020-09-30 Asynchronous notification method and system based on dynamic configuration

Publications (1)

Publication Number Publication Date
CN112184445A true CN112184445A (en) 2021-01-05

Family

ID=73947524

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011062417.2A Pending CN112184445A (en) 2020-09-30 2020-09-30 Asynchronous notification method and system based on dynamic configuration

Country Status (1)

Country Link
CN (1) CN112184445A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112907772A (en) * 2021-01-20 2021-06-04 北京千方科技股份有限公司 Front-loading ETC electronic tag system, method and storage medium
CN113988875A (en) * 2021-11-25 2022-01-28 中国银行股份有限公司 Processing method and system for reservation transaction
CN116361016A (en) * 2023-06-01 2023-06-30 天翼云科技有限公司 Message processing method and system of network controller
CN114884906B (en) * 2022-03-23 2024-05-17 贝壳找房(北京)科技有限公司 Failure retry notification method and device based on quick recovery

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1822533A (en) * 2006-03-27 2006-08-23 阿里巴巴公司 Message reliable informing method and system between systems
CN1829139A (en) * 2006-03-30 2006-09-06 阿里巴巴公司 Message repeating method and system
CN110377433A (en) * 2019-06-04 2019-10-25 威富通科技有限公司 Asynchronous notification method, device and payment gateway, the storage medium of payment result

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1822533A (en) * 2006-03-27 2006-08-23 阿里巴巴公司 Message reliable informing method and system between systems
CN1829139A (en) * 2006-03-30 2006-09-06 阿里巴巴公司 Message repeating method and system
CN110377433A (en) * 2019-06-04 2019-10-25 威富通科技有限公司 Asynchronous notification method, device and payment gateway, the storage medium of payment result

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112907772A (en) * 2021-01-20 2021-06-04 北京千方科技股份有限公司 Front-loading ETC electronic tag system, method and storage medium
CN113988875A (en) * 2021-11-25 2022-01-28 中国银行股份有限公司 Processing method and system for reservation transaction
CN114884906B (en) * 2022-03-23 2024-05-17 贝壳找房(北京)科技有限公司 Failure retry notification method and device based on quick recovery
CN116361016A (en) * 2023-06-01 2023-06-30 天翼云科技有限公司 Message processing method and system of network controller
CN116361016B (en) * 2023-06-01 2023-10-13 天翼云科技有限公司 Message processing method and system of network controller

Similar Documents

Publication Publication Date Title
CN112184445A (en) Asynchronous notification method and system based on dynamic configuration
US8397244B2 (en) Publisher flow control and bounded guaranteed delivery for message queues
US7334001B2 (en) Method and system for data collection for alert delivery
CN105719182B (en) Automatic account checking method and automatic account checking system
US8010840B2 (en) Generation of problem tickets for a computer system
US20040205770A1 (en) Duplicate message elimination system for a message broker
US8615580B2 (en) Message publication feedback in a publish/subscribe messaging environment
US20060053425A1 (en) System and method of intelligent queuing
US20120215872A1 (en) Criteria-based message publication control and feedback in a publish/subscribe messaging environment
US20030110085A1 (en) Maintaining synchronization of information published to multiple subscribers
CN109657152B (en) Push message sending method and device, electronic equipment and readable storage medium
US8793322B2 (en) Failure-controlled message publication and feedback in a publish/subscribe messaging environment
WO2013039799A2 (en) Marketplace for timely event data distribution
CN101711386A (en) Synchronize email message externally and/or between local electronic mail server and/or the wireless device
US20060168080A1 (en) Repeatable message streams for message queues in distributed systems
CN101702943A (en) Apparatus and method for caching email messages within a wireless data service
CN108984333B (en) Method and device for big data real-time calculation
US20120143616A1 (en) System for and method of transaction management
EP2309389A1 (en) Delivery with reconciliation on client side
US7908514B2 (en) Minimizing data loss in asynchronous replication solution using distributed redundancy
US8458725B2 (en) Computer implemented method for removing an event registration within an event notification infrastructure
US20070240170A1 (en) Computer implemented method and system for processing an event notification within a notification infrastructure of a database system using a persistent queue
US20090019116A1 (en) Large distribution message handling
CN112632093A (en) Work order processing method, device, system, storage medium and program product
CN111738728A (en) Transaction compensation method and device

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