CN113849325A - Distributed consumption credit RabbitMQ fusing method and system - Google Patents

Distributed consumption credit RabbitMQ fusing method and system Download PDF

Info

Publication number
CN113849325A
CN113849325A CN202111153619.2A CN202111153619A CN113849325A CN 113849325 A CN113849325 A CN 113849325A CN 202111153619 A CN202111153619 A CN 202111153619A CN 113849325 A CN113849325 A CN 113849325A
Authority
CN
China
Prior art keywords
fusing
consumption
queue
abnormal
rabbit
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
CN202111153619.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.)
Sichuan XW Bank Co Ltd
Original Assignee
Sichuan XW Bank 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 Sichuan XW Bank Co Ltd filed Critical Sichuan XW Bank Co Ltd
Priority to CN202111153619.2A priority Critical patent/CN113849325A/en
Publication of CN113849325A publication Critical patent/CN113849325A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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/03Credit; Loans; Processing thereof
    • 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)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The invention discloses a rabbitMQ fusing method and a system based on distributed consumption credit, wherein the method comprises the following steps: the method comprises the following steps that a Rabbit MQ service end generates a message queue and pushes messages to a Rabbit MQ consumption end one by one for consumption; and the Rabbit MQ consumption end receives the message pushed by the Rabbit MQ service end, the abnormal recording and fusing processing are carried out on the message through the MQ fusing interceptor by adopting an abnormal fusing mechanism method based on the Rabbit Mq, and response information is returned to the Rabbit MQ service end. The invention designs an MQ consumption fusing mechanism to reduce abnormal conditions, effectively controls the abnormal quantity of MQ consumption messages under the condition of calling a downstream channel, reduces the pressure of checking and recovering the abnormality, and is favorable for the quick recovery capability and quick response capability of a system under the condition of the downstream fault.

Description

Distributed consumption credit RabbitMQ fusing method and system
Technical Field
The invention relates to the technical field of distributed consumption credit business, in particular to a rabbitMQ fusing method and a rabbitMQ fusing system based on distributed consumption credit.
Background
Because the distributed consumption credit system is a large-scale distributed framework service based on micro-service, the payment link calls an external channel, the time consumption is long, and generally rabbitMq is adopted to carry out asynchronous decoupling in a payment scene. And receiving the upstream payment initiating request by adopting a payment message queue, calling a payment channel to initiate payment by using the consumption message queue, and sending a payment result to the upstream after obtaining the payment result of the payment channel. However, when the peripheral channel service is not available, a large number of abnormalities occur, and when a large number of abnormalities occur, it is necessary to check information and perform recovery compensation. Restoring the compensation check is often difficult and time consuming in many cases of anomalies.
Disclosure of Invention
The invention aims to solve the technical problem that a distributed consumption credit system is a large-scale distributed framework service based on micro-service, and the time consumption is longer because an external channel is called in a payment link, and generally rabbitMq is adopted to carry out asynchronous decoupling in a payment scene; and receiving the upstream payment initiating request by adopting a payment message queue, calling a payment channel to initiate payment by using the consumption message queue, and sending a payment result to the upstream after obtaining the payment result of the payment channel. However, when the peripheral channel service is not available, a large number of abnormalities occur, and when a large number of abnormalities occur, it is necessary to check information and perform recovery compensation.
In order to solve the workload of checking and recovering compensation caused by a large number of abnormal scenes, namely in order to reduce the occurrence of the abnormality and stop abnormal messages in a distributed consumption credit system, the invention provides a RabbittMQ fusing method and a system based on distributed consumption credit. The invention effectively controls the abnormal quantity of the MQ consumption messages under the condition of calling the downstream channel through the consumption fusing mechanism of the MQ, reduces the pressure of checking and recovering the abnormality, and is favorable for the quick recovery capability and the quick response capability of the system under the condition of the downstream fault.
The invention is realized by the following technical scheme:
in a first aspect, the invention provides a RabbitMQ fusing method based on distributed consumer credit, which comprises the following steps:
the method comprises the following steps that a Rabbit MQ service end generates a message queue and pushes messages to a Rabbit MQ consumption end one by one for consumption;
and the Rabbit MQ consumption end receives the message pushed by the Rabbit MQ service end, the abnormal recording and fusing processing are carried out on the message through the MQ fusing interceptor by adopting an abnormal fusing mechanism method based on the Rabbit Mq, and response information is returned to the Rabbit MQ service end.
The working principle is as follows: in order to reduce the occurrence of abnormity and stop abnormal messages in a distributed consumption credit system, the invention provides a distributed consumption credit RabbitMQ fusing method, the scheme of the method is directly applied to a deduction scene of distributed consumption credit business, a fusing-based AOP interceptor is added at a springboot RabbitListener annotation mode MQ consumption end in a deduction application program of distributed consumption credit, consumption service abnormity at the consumption end is suspended through the interceptor, and re-consumption is attempted after a period of time. The distributed consumption credit payment scene mostly adopts an MQ asynchronous processing mode, and the distributed consumption credit payment scene is automatically fused when a dependent service fails, so that the occurrence of errors is reduced. The rabbitMq-based abnormal fusing mechanism method is that through automatic fusing of the rabbitMq, the abnormal number of MQ consumption messages under the condition of calling a downstream channel is effectively controlled, the pressure of checking and recovering the abnormality is reduced, and the quick recovery capability and the quick response capability of a system under the condition of the downstream fault are facilitated.
The invention designs an MQ consumption fusing mechanism to reduce abnormal conditions, a consumption end checks that a calling channel is abnormal, consumption is automatically suspended, the consumption is tried to be retried after being suspended for a period of time, if subsequent consumption messages are abnormal, the consumption is again in a suspended state, and if the subsequent consumption messages are normally consumed continuously. The invention effectively controls the abnormal quantity of the MQ consumption messages under the condition of calling the downstream channel through the consumption fusing mechanism of the MQ, reduces the pressure of checking and recovering the abnormality, and is favorable for the quick recovery capability and the quick response capability of the system under the condition of the downstream fault.
Further, the message is subjected to exception recording and fusing processing through an MQ fusing interceptor by adopting a rabbitMq-based exception fusing mechanism method; the method specifically comprises the following substeps:
the MQ fusing interceptor checks the abnormal cache and performs MQ queue abnormal record caching; when a certain queue consumes messages and is abnormal, writing or accumulating the queue abnormal constant in the MQ queue abnormal record buffer, and taking the queue abnormal constant as a record number;
judging whether the record number is greater than a preset value fusing differential constant, if so, not consuming the message, sleeping for preset fusing time, manually responding to basic Nack of a Rabbit MQ service end, marking the manual response repeated enqueue as true, returning the message to the message queue again, and continuing to push the message to the Rabbit MQ consuming end by the Rabbit MQ service end for the next time, and repeating the steps until the abnormal record of the MQ queue caches the cache of the queue is overdue;
and if the record number is not greater than the preset value fusing abnormal constant, consuming the message by the Rabbit MQ consumption end, and manually responding to the non-repeated enqueue identifier from false to the Rabbit MQ service end.
Further, the MQ fusion interceptor is an AOP interceptor based on org.springframe.amqp.rabbitt.announcing.rabbitlistener annotation configured at the rabbitt MQ consuming side; the MQ fusion interceptor intercepts the processing of the consumed messages of the rg.
Further, the MQ queue exception record buffer is configured to record the number of times of exception occurrence of each queue consumed message; the memory of the abnormal records of the MQ queue supports the setting of the expiration time, and the memory records which are not modified beyond a certain time are cleared from the memory.
Further, the Rabbit MQ consumption end starts to configure the consumer configuration consumption end ack mode based on the annotation of org.
Further, the method further comprises: performing fusing overtime processing through an MQ fusing interceptor;
if the MQ queue abnormal record cache exceeds the preset value fusing time and is not accumulated or the abnormal number written into the queue is not recorded, the cache is overdue and cleared, and if the queue enters consumption in the follow-up process, the queue abnormal information is checked and found out, and the queue is consumed again.
Further, the method is applied to a deduction scene of the distributed consumption credit business.
In a second aspect, the invention further provides a distributed consumption credit based RabbitMQ fusing system, which supports the distributed consumption credit based RabbitMQ fusing method; the system comprises: a Rabbit MQ service end and a Rabbit MQ consumption end;
the Rabbit MQ service end is used for generating a message queue and pushing messages one by one to the Rabbit MQ consumption end for consumption;
the Rabbit MQ consumption end is used for receiving the message pushed by the Rabbit MQ service end, performing exception recording and fusing processing on the message through the MQ fusing interceptor by adopting a Rabbit Mq-based exception fusing mechanism method, and returning response information to the Rabbit MQ service end.
Further, the Rabbit MQ consumption end adopts a rabbitMq-based abnormal fusing mechanism method to perform abnormal recording and fusing processing on the message through an MQ fusing interceptor; the specific execution process is as follows:
the MQ fusing interceptor checks the abnormal cache and performs MQ queue abnormal record caching; when a certain queue consumes messages and is abnormal, writing or accumulating the queue abnormal constant in the MQ queue abnormal record buffer, and taking the queue abnormal constant as a record number;
judging whether the record number is greater than a preset value fusing differential constant, if so, not consuming the message, sleeping for preset fusing time, manually responding to basic Nack of a Rabbit MQ service end, marking the manual response repeated enqueue as true, returning the message to the message queue again, and continuing to push the message to the Rabbit MQ consuming end by the Rabbit MQ service end for the next time, and repeating the steps until the abnormal record of the MQ queue caches the cache of the queue is overdue;
and if the record number is not greater than the preset value fusing abnormal constant, consuming the message by the Rabbit MQ consumption end, and manually responding to the non-repeated enqueue identifier from false to the Rabbit MQ service end.
Further, the MQ fusion interceptor is an AOP interceptor based on org.springframe.amqp.rabbitt.announcing.rabbitlistener annotation configured at the rabbitt MQ consuming side; the MQ fusing interceptor intercepts the consumption message processing of rg.springframe.amqp.rabbitt.announcing.rabbitListener annotation;
the MQ queue exception record cache is configured to record the number of times of exception of the consumption message of each queue; the memory of the abnormal records of the MQ queue supports the setting of the expiration time, and the memory records which are not modified beyond a certain time are cleared from the memory.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the method and the device are used for stopping the abnormal message in order to reduce the occurrence of the abnormality in the distributed consumption credit system, the scheme of the invention is directly applied to a deduction scene of the distributed consumption credit service, a fusing-based AOP interceptor is added at a springboot RabbitListener annotation mode MQ consumption end in a deduction application program of the distributed consumption credit, the consumption service abnormality at the consumption end is suspended for consumption through the interceptor, and the consumption is tried to be consumed again after a period of time. The distributed consumption credit payment scene mostly adopts an MQ asynchronous processing mode, and the distributed consumption credit payment scene is automatically fused when a dependent service fails, so that the occurrence of errors is reduced.
2. The invention designs an MQ consumption fusing mechanism to reduce abnormal conditions, a consumption end checks that a calling channel is abnormal, consumption is automatically suspended, the consumption is tried to be retried after being suspended for a period of time, if subsequent consumption messages are abnormal, the consumption is again in a suspended state, and if the subsequent consumption messages are normally consumed continuously. The method for the abnormal fusing mechanism based on the rabbitMq effectively controls the abnormal number of MQ consumption messages under the condition of calling a downstream channel by automatic fusing of the rabbitMq, reduces the pressure of checking and recovering the abnormality, and is favorable for the quick recovery capability and quick response capability of a system under the condition of the downstream fault.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
FIG. 1 is a flow chart of a distributed consumption credit RabbitMQ-based fusing method of the invention.
FIG. 2 is a logic interaction diagram of the distributed consumption credit RabbitMQ fusing method.
Fig. 3 is a block diagram of a RabbitMQ fusing system based on distributed consumer credit in the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Example 1
As shown in fig. 1 and fig. 2, the invention is based on a distributed consumption credit RabbitMQ fusing method, and the method is applied to a deduction scene of a distributed consumption credit service. The specific implementation is as follows:
firstly, setting key technologies, including RabbitMQ technical parameter configuration, MQ queue exception record cache design, MQ fusing interceptor configuration and fusing system control parameter configuration;
(1) RabbitMQ technical parameter configuration
The consumer configures the ack mode of the consuming end to manual (manual response mode) based on the annotation of org. After the configuration is carried out in the mode, consumption display is needed, a basic Nack response to the server is initiated through codes, if a certain message is consumed, the basic Nack response parameter request incoming true message is enqueued again, and the message is not enqueued again if false is transmitted.
(2) Fusing the cache: MQ queue exception record cache design
Designing a message cache (MQ queue exception record cache for short) based on a JAVA virtual machine memory, wherein the cache records the number of times of exception of message consumption of each queue. The cache support sets an expiration time and cache records that have not been modified beyond a certain time will be flushed.
(3) MQ melt interceptor configuration
Adding an AOP interceptor (hereinafter abbreviated as MQ fusing interceptor) based on org, spring frame work, amqp annotation
A consumption message process of the robbit.
(4) Fusing system control parameter configuration
2 system parameters were designed: 1) triggering fusing abnormal constant (abbreviation: fusing iso-constant). 2) Fusing time (abbreviation: fusing time, and recording buffer overtime time by the abnormal MQ queue); these 2 parameters can be dynamically modified by parameter configuration. For example, the predetermined triggered fusing constant is 5, and the predetermined fusing time is 60 seconds.
Next, as shown in fig. 1 and 2, the process of the method includes:
the method comprises the following steps that a Rabbit MQ service end generates a message queue and pushes messages to a Rabbit MQ consumption end one by one for consumption;
the message pushed by the Rabbit MQ server side is received by the Rabbit MQ consumption side, exception recording and fusing processing are carried out on the message through an MQ fusing interceptor by adopting an exception fusing mechanism method based on the Rabbit Mq, and fusing timeout processing is carried out through the MQ fusing interceptor; and returning response information to the Rabbit MQ service end.
Specifically, the message is subjected to exception recording and fusing processing through an MQ fusing interceptor by adopting a rabbitMq-based exception fusing mechanism method; the method specifically comprises the following substeps:
the MQ fusing interceptor checks the abnormal cache and performs MQ queue abnormal record caching; when a certain queue consumes messages and is abnormal, writing or accumulating the queue abnormal constant in the MQ queue abnormal record buffer, and taking the queue abnormal constant as a record number; for example, if the queue record number queue _ PAY sends 6 times of exception, the record number queue _ PAY in the cache is 6, and if the cache is not newly added later, the cache will expire after 60 seconds of fusing time and automatically delete the cache;
judging whether the record number is greater than a preset value fusing differential constant, if so, not consuming the message, sleeping for preset fusing time, manually responding to basic Nack of a Rabbit MQ service end, marking a manual response repeated enqueue mark as true, transmitting the true to the true, returning the message to the message queue again, continuing to push the message to the Rabbit MQ consuming end by the Rabbit MQ service end for the next time, and repeating the steps until the memory of the queue is overdue; thus, the fusing of the message is realized in such a way that the queue always reprocesses the current message before expiry.
And if the record number is not greater than the preset value fusing abnormal constant, consuming the message by the Rabbit MQ consumption end, and manually responding to the non-repeated enqueue identifier as false to the Rabbit MQ service end, namely, transmitting the request to the false.
For example, when the queue _ PAY sends 6 times of exceptions, the buffer records that the queue _ PAY is 6, at this time, the consuming side obtains the message MSG _ a, finds that the number of exceptions in the buffer is 6 and is greater than the fuse exception constant 5, at this time, the MQ server side basic nack response is responded, and the request is transmitted into the true, so that the message MSG _ a is enqueued again, and the message acquired next time by the consuming side is also the MSG _ a.
Specifically, the fusing timeout processing is performed through an MQ fusing interceptor; the method comprises the following steps:
if the MQ queue abnormal record cache exceeds the preset value fusing time and is not accumulated or the abnormal number written into the queue is not recorded, the cache is overdue and cleared, and if the queue enters consumption in the follow-up process, the queue abnormal information is checked and found out, and the queue is consumed again.
For example, if the queue _ PAY sends 6 times of exceptions, the queue _ PAY is recorded in the cache as 6, and if no new buffer is added later, the buffer will expire after 60 seconds of fusing time and be automatically deleted from the cache.
The working principle is as follows: in order to reduce the occurrence of abnormity and stop abnormal messages in a distributed consumption credit system, the invention provides a distributed consumption credit RabbitMQ fusing method, the scheme of the method is directly applied to a deduction scene of distributed consumption credit business, a fusing-based AOP interceptor is added at a springboot RabbitListener annotation mode MQ consumption end in a deduction application program of distributed consumption credit, consumption service abnormity at the consumption end is suspended through the interceptor, and re-consumption is attempted after a period of time. The distributed consumption credit payment scene mostly adopts an MQ asynchronous processing mode, and the distributed consumption credit payment scene is automatically fused when a dependent service fails, so that the occurrence of errors is reduced. The rabbitMq-based abnormal fusing mechanism method is that through automatic fusing of the rabbitMq, the abnormal number of MQ consumption messages under the condition of calling a downstream channel is effectively controlled, the pressure of checking and recovering the abnormality is reduced, and the quick recovery capability and the quick response capability of a system under the condition of the downstream fault are facilitated.
The invention designs an MQ consumption fusing mechanism to reduce abnormal conditions, a consumption end checks that a calling channel is abnormal, consumption is automatically suspended, the consumption is tried to be retried after being suspended for a period of time, if subsequent consumption messages are abnormal, the consumption is again in a suspended state, and if the subsequent consumption messages are normally consumed continuously. The invention effectively controls the abnormal quantity of the MQ consumption messages under the condition of calling the downstream channel through the consumption fusing mechanism of the MQ, reduces the pressure of checking and recovering the abnormality, and is favorable for the quick recovery capability and the quick response capability of the system under the condition of the downstream fault.
Example 2
As shown in fig. 3, the present embodiment differs from embodiment 1 in that the present embodiment provides a distributed consumption credit RabbitMQ-based fusing system, which supports the distributed consumption credit RabbitMQ-based fusing method described in embodiment 1; the system comprises: a Rabbit MQ service end and a Rabbit MQ consumption end;
the Rabbit MQ service end is used for generating a message queue and pushing messages one by one to the Rabbit MQ consumption end for consumption;
the Rabbit MQ consumption end is used for receiving the message pushed by the Rabbit MQ service end, carrying out exception recording and fusing processing on the message through an MQ fusing interceptor by adopting a Rabbit Mq-based exception fusing mechanism method, and carrying out fusing timeout processing through the MQ fusing interceptor; and returning response information to the Rabbit MQ service end.
In the embodiment, the Rabbit MQ consumption end adopts a rabbitMq-based abnormal fusing mechanism method to perform abnormal recording and fusing processing on the message through an MQ fusing interceptor; the specific execution process is as follows:
the MQ fusing interceptor checks the abnormal cache and performs MQ queue abnormal record caching; when a certain queue consumes messages and is abnormal, writing or accumulating the queue abnormal constant in the MQ queue abnormal record buffer, and taking the queue abnormal constant as a record number;
judging whether the record number is greater than a preset value fusing differential constant, if so, not consuming the message, sleeping for preset fusing time, manually responding to basic Nack of a Rabbit MQ service end, marking the manual response repeated enqueue as true, returning the message to the message queue again, and continuing to push the message to the Rabbit MQ consuming end by the Rabbit MQ service end for the next time, and repeating the steps until the abnormal record of the MQ queue caches the cache of the queue is overdue;
and if the record number is not greater than the preset value fusing abnormal constant, consuming the message by the Rabbit MQ consumption end, and manually responding to the non-repeated enqueue identifier from false to the Rabbit MQ service end.
In this embodiment, the MQ fusion interceptor is an AOP interceptor based on an org.springframe.amqp.rabbit.annotation configured at a rabbitmq consumption end; the MQ fusing interceptor intercepts the consumption message processing of rg.springframe.amqp.rabbitt.announcing.rabbitListener annotation;
the MQ queue exception record cache is configured to record the number of times of exception of the consumption message of each queue; the memory of the abnormal records of the MQ queue supports the setting of the expiration time, and the memory records which are not modified beyond a certain time are cleared from the memory.
In this embodiment, the rabbitmq consumption end starts to configure the consumer configuration consumption end ack mode based on the org.
In this embodiment, the performing fusing timeout processing by the MQ fusing interceptor includes:
if the MQ queue abnormal record cache exceeds the preset value fusing time and is not accumulated or the abnormal number written into the queue is not recorded, the cache is overdue and cleared, and if the queue enters consumption in the follow-up process, the queue abnormal information is checked and found out, and the queue is consumed again.
The invention provides a RabbittMQ fusing system based on distributed consumption credit, which is directly applied to a deduction scene of a distributed consumption credit service, wherein a fusing-based AOP interceptor is added at a springboot RabbittListener annotation mode MQ consumption end in a deduction application program of the distributed consumption credit, the consumption service exception at the consumption end is realized by the interceptor, the consumption is suspended, and the re-consumption is attempted after a period of time. The distributed consumption credit payment scene mostly adopts an MQ asynchronous processing mode, and the distributed consumption credit payment scene is automatically fused when a dependent service fails, so that the occurrence of errors is reduced. The rabbitMq-based abnormal fusing mechanism method is that through automatic fusing of the rabbitMq, the abnormal number of MQ consumption messages under the condition of calling a downstream channel is effectively controlled, the pressure of checking and recovering the abnormality is reduced, and the quick recovery capability and the quick response capability of a system under the condition of the downstream fault are facilitated.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A rabbitMQ fusing method based on distributed consumption credit is characterized by comprising the following steps:
the method comprises the following steps that a Rabbit MQ service end generates a message queue and pushes messages to a Rabbit MQ consumption end one by one for consumption;
and the Rabbit MQ consumption end receives the message pushed by the Rabbit MQ service end, the abnormal recording and fusing processing are carried out on the message through the MQ fusing interceptor by adopting an abnormal fusing mechanism method based on the Rabbit Mq, and response information is returned to the Rabbit MQ service end.
2. The distributed consumption credit-based RabbitMQ fusing method according to claim 1, wherein the message is subjected to exception recording and fusing processing through an MQ fusing interceptor by using a RabbitMQ-based exception fusing mechanism method; the method specifically comprises the following substeps:
the MQ fusing interceptor checks the abnormal cache and performs MQ queue abnormal record caching; when a certain queue consumes messages and is abnormal, writing or accumulating the queue abnormal constant in the MQ queue abnormal record buffer, and taking the queue abnormal constant as a record number;
judging whether the record number is greater than a preset value fusing differential constant, if so, not consuming the message, sleeping for preset fusing time, manually responding to basic Nack of a Rabbit MQ service end, marking the manual response repeated enqueue as true, returning the message to the message queue again, and continuing to push the message to the Rabbit MQ consuming end by the Rabbit MQ service end for the next time, and repeating the steps until the abnormal record of the MQ queue caches the cache of the queue is overdue;
and if the record number is not greater than the preset value fusing abnormal constant, consuming the message by the Rabbit MQ consumption end, and manually responding to the non-repeated enqueue identifier from false to the Rabbit MQ service end.
3. The distributed consumption credit-based RabbitMQ fusing method of claim 2, wherein the MQ fusing interceptor is an AOP interceptor based on org.springframe.amqp.rabbitlistener annotation configured at a RabbitMQ consumption end; the MQ fusion interceptor intercepts the processing of the consumed messages of the rg.
4. The distributed consumption credit-based RabbitMQ fusing method according to claim 2, wherein the MQ queue exception record buffer is configured to record the number of times each queue consumes messages is abnormal; the memory of the abnormal records of the MQ queue supports the setting of the expiration time, and the memory records which are not modified beyond a certain time are cleared from the memory.
5. The distributed consumption credit-based RabbitMQ blowing method according to claim 1, wherein the RabbitMQ consumption end starts configuring the consumer configuration consumption end ack mode based on an org.
6. The distributed consumer credit RabbitMQ fusing method according to claim 2, further comprising: performing fusing overtime processing through an MQ fusing interceptor;
if the MQ queue abnormal record cache exceeds the preset value fusing time and is not accumulated or the abnormal number written into the queue is not recorded, the cache is overdue and cleared, and if the queue enters consumption in the follow-up process, the queue abnormal information is checked and found out, and the queue is consumed again.
7. The distributed consumer credit RabbitMQ-based fusing method according to claim 1, wherein the method is applied to a withholding scenario of a distributed consumer credit service.
8. Distributed consumer credit RabbitMQ-based fusing system, characterized in that it supports the distributed consumer credit RabbitMQ-based fusing method according to any of claims 1 to 7; the system comprises: a Rabbit MQ service end and a Rabbit MQ consumption end;
the Rabbit MQ service end is used for generating a message queue and pushing messages one by one to the Rabbit MQ consumption end for consumption;
the Rabbit MQ consumption end is used for receiving the message pushed by the Rabbit MQ service end, performing exception recording and fusing processing on the message through the MQ fusing interceptor by adopting a Rabbit Mq-based exception fusing mechanism method, and returning response information to the Rabbit MQ service end.
9. The rabbitMQ fusing system based on distributed consumption credit according to claim 8, wherein the rabbitMQ consumption end adopts a rabbitMq-based abnormal fusing mechanism method to perform abnormal recording and fusing processing on the message through an MQ fusing interceptor; the specific execution process is as follows:
the MQ fusing interceptor checks the abnormal cache and performs MQ queue abnormal record caching; when a certain queue consumes messages and is abnormal, writing or accumulating the queue abnormal constant in the MQ queue abnormal record buffer, and taking the queue abnormal constant as a record number;
judging whether the record number is greater than a preset value fusing differential constant, if so, not consuming the message, sleeping for preset fusing time, manually responding to basic Nack of a Rabbit MQ service end, marking the manual response repeated enqueue as true, returning the message to the message queue again, and continuing to push the message to the Rabbit MQ consuming end by the Rabbit MQ service end for the next time, and repeating the steps until the abnormal record of the MQ queue caches the cache of the queue is overdue;
and if the record number is not greater than the preset value fusing abnormal constant, consuming the message by the Rabbit MQ consumption end, and manually responding to the non-repeated enqueue identifier from false to the Rabbit MQ service end.
10. The distributed consumption credit-based RabbitMQ blowing system according to claim 9, wherein the MQ fusion interceptor is an AOP interceptor based on org.springframe.amqp.rabbitlistener annotation configured at a RabbitMQ consumption end; the MQ fusing interceptor intercepts the consumption message processing of rg.springframe.amqp.rabbitt.announcing.rabbitListener annotation;
the MQ queue exception record cache is configured to record the number of times of exception of the consumption message of each queue; the memory of the abnormal records of the MQ queue supports the setting of the expiration time, and the memory records which are not modified beyond a certain time are cleared from the memory.
CN202111153619.2A 2021-09-29 2021-09-29 Distributed consumption credit RabbitMQ fusing method and system Pending CN113849325A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111153619.2A CN113849325A (en) 2021-09-29 2021-09-29 Distributed consumption credit RabbitMQ fusing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111153619.2A CN113849325A (en) 2021-09-29 2021-09-29 Distributed consumption credit RabbitMQ fusing method and system

Publications (1)

Publication Number Publication Date
CN113849325A true CN113849325A (en) 2021-12-28

Family

ID=78977070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111153619.2A Pending CN113849325A (en) 2021-09-29 2021-09-29 Distributed consumption credit RabbitMQ fusing method and system

Country Status (1)

Country Link
CN (1) CN113849325A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115170131A (en) * 2022-09-06 2022-10-11 云账户技术(天津)有限公司 Payment method and device based on fuse, storage medium and terminal equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110276636A1 (en) * 2010-03-29 2011-11-10 Konaware, Inc. Efficient transactional messaging between loosely coupled client and server over multiple intermittent networks with policy based routing
CN109710421A (en) * 2018-11-16 2019-05-03 深圳证券交易所 Recipient's abnormality eliminating method, server and the storage medium of message-oriented middleware
CN109743358A (en) * 2018-12-13 2019-05-10 平安普惠企业管理有限公司 Asynchronous message interface fusing control method, device, computer equipment and storage medium
CN110377434A (en) * 2019-07-04 2019-10-25 深圳前海微众银行股份有限公司 A kind of service blowout method, device and message-oriented middleware
CN111314422A (en) * 2020-01-17 2020-06-19 平安医疗健康管理股份有限公司 Kafka-based message processing method and system, storage medium and computer equipment
CN111427711A (en) * 2020-04-01 2020-07-17 山东汇贸电子口岸有限公司 Message pushing method based on RabbitMQ
CN111611094A (en) * 2020-05-26 2020-09-01 山东汇贸电子口岸有限公司 Monitoring and managing method for abnormal MQ information
CN112948174A (en) * 2021-02-03 2021-06-11 江苏苏宁物流有限公司 Message processing method and device, computer equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110276636A1 (en) * 2010-03-29 2011-11-10 Konaware, Inc. Efficient transactional messaging between loosely coupled client and server over multiple intermittent networks with policy based routing
CN109710421A (en) * 2018-11-16 2019-05-03 深圳证券交易所 Recipient's abnormality eliminating method, server and the storage medium of message-oriented middleware
CN109743358A (en) * 2018-12-13 2019-05-10 平安普惠企业管理有限公司 Asynchronous message interface fusing control method, device, computer equipment and storage medium
CN110377434A (en) * 2019-07-04 2019-10-25 深圳前海微众银行股份有限公司 A kind of service blowout method, device and message-oriented middleware
CN111314422A (en) * 2020-01-17 2020-06-19 平安医疗健康管理股份有限公司 Kafka-based message processing method and system, storage medium and computer equipment
CN111427711A (en) * 2020-04-01 2020-07-17 山东汇贸电子口岸有限公司 Message pushing method based on RabbitMQ
CN111611094A (en) * 2020-05-26 2020-09-01 山东汇贸电子口岸有限公司 Monitoring and managing method for abnormal MQ information
CN112948174A (en) * 2021-02-03 2021-06-11 江苏苏宁物流有限公司 Message processing method and device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
APPLE_WEB: "RabbitMQ解决消费者补偿幂等问题(重复消费问题)", pages 2 - 17, Retrieved from the Internet <URL:https://blog.csdn.net/belongtocode/article/details/104310152> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115170131A (en) * 2022-09-06 2022-10-11 云账户技术(天津)有限公司 Payment method and device based on fuse, storage medium and terminal equipment

Similar Documents

Publication Publication Date Title
JP6749926B2 (en) Method, device and system for synchronizing data
CN111585867B (en) Message processing method and device, electronic equipment and readable storage medium
US20080086561A1 (en) Method for obtaining log information from network element device by network management server, a network element device and a network management server
US20100017441A1 (en) Methods, apparatus and computer programs for managing persistence
EP2432155B1 (en) Call list transmission processing method and system of charging system
CN103514173B (en) The method and node device of data processing
WO2021233322A1 (en) Synchronization method, apparatus and device for recording data, and storage medium
CN113849325A (en) Distributed consumption credit RabbitMQ fusing method and system
CN112306979A (en) Message queue-based log information processing method and device and readable medium
CN111611094A (en) Monitoring and managing method for abnormal MQ information
CN110851294A (en) Method and device for remedying program operation breakdown
CN113254166A (en) Method for processing IO request, storage medium and virtualization simulator
CN110008681B (en) Access control method, device and system
CN112153215A (en) Call processing method and device, related equipment and storage medium
WO2023116701A1 (en) Data information pushing method and apparatus based on internet of things platform, and device and medium
CN115033927A (en) Method, device, equipment and medium for detecting data integrity
CN112100556B (en) Method and system for optimizing message pushing mode
CN111371586B (en) Log data transmission method, device and equipment
CN112882655A (en) Data caching method and device, electronic equipment and storage medium
CN112214268A (en) Current limiting method based on Redis
CN111708802A (en) Network request anti-reprocessing method and device
CN111049938A (en) Message notification method and device, electronic equipment and readable storage medium
CN115086263B (en) IM message sending method, system, storage medium and computer equipment of IOS terminal
CN114125054B (en) Content auditing system, method, device, equipment and medium
CN101132418B (en) Method and apparatus for client logoff in iSCSI system

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