Message queue processing method, device, system, equipment, medium and program product

By adopting a dual message queue heterogeneous disaster recovery solution in the cloud communication service and using the preset cached response results to process the message queue, the timeliness problem caused by the message queue failure is solved, and high availability and timeliness without manual intervention are achieved.

CN119356905APending Publication Date: 2025-01-24BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411397489.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In cloud communication services, message queue failure leads to call damage, delayed or lost call order push. The existing technology relies on manual intervention to process, resulting in poor timeliness.

Method used

By using the dual -message queue heterogeneous disaster recovery plan between producers and consumers, using different communication links to transmit the same message data, and process the message queue based on the preset cache response result to ensure that in a single message queue Another message queue can continue to provide data consumption when the failure.

Benefits of technology

It can ensure that consumers can consume information data without manual intervention when the message queue fails, and improves the timeliness and high availability of cloud communication services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356905A_ABST
    Figure CN119356905A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of message data processing, and discloses a message queue processing method, device, system and equipment, a medium and a program product. The message queue processing method comprises the steps that a first message queue sent by a producer through a first communication link is received, a second message queue sent by the producer through a second communication link is received, and first message data carried by the first message queue is the same as second message data carried by the second message queue; sending a first instruction to a preset cache according to the first message queue, and sending a second instruction to the preset cache according to the second message queue; and processing the first message queue according to a first response result to the first instruction returned by the preset cache, or processing the second message queue according to a second response result to the second instruction returned by the preset cache. Compared with the prior art, the timeliness of the cloud communication service can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of message data processing, and in particular to a message queue processing method, device, system, equipment, medium and program product. Background Art

[0002] In cloud communication services, scenarios such as call records or recordings rely heavily on message queues (MQ) for data transfer. If a message queue fails, it may cause cloud communication problems such as call damage, delayed call record push, or even call record loss. Related technologies can generally only be handled through manual intervention to manually solve message queue failure problems, but in the process of solving the problem, it will still cause delays or even stagnation in message data processing, resulting in poor timeliness of cloud communication services. Summary of the invention

[0003] In view of this, the present disclosure provides a message queue processing method, apparatus, system, device, medium and program product to solve the problem of affecting the timeliness of cloud communication services when a message queue fails in the related art.

[0004] In a first aspect, the present disclosure provides a message queue processing method, which is applied to consumers; the method comprises:

[0005] A first message queue is received and sent by a producer through a first communication link, and a second message queue is received and sent by a producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue;

[0006] Sending a first instruction to a preset cache according to a first message queue, and sending a second instruction to the preset cache according to a second message queue;

[0007] The first message queue is processed according to a first response result to the first instruction returned by the preset cache, or the second message queue is processed according to a second response result to the second instruction returned by the preset cache.

[0008] The producer and consumer of the present invention transmit message queues with the same message data through different communication links, and process one of the two message queues based on the response result of the instruction issued to the preset cache. It can be seen that the present invention provides a dual-message queue heterogeneous disaster recovery solution. When a single message queue fails, the other message queue can still ensure that the consumer can still consume the message data without manual intervention, thereby improving the timeliness of cloud communication services.

[0009] In a second aspect, the present disclosure provides a message queue processing method, which is applied to a producer; the method comprises:

[0010] Sending a first message queue to a consumer via a first communication link, and sending a second message queue to the consumer via a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue;

[0011] A consumer, configured to send a first instruction to a preset cache according to a first message queue, and to send a second instruction to the preset cache according to a second message queue;

[0012] The consumer is further used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

[0013] In a third aspect, the present disclosure provides a message queue processing device, the device comprising:

[0014] A message receiving module, used for receiving a first message queue sent by a producer through a first communication link, and for receiving a second message queue sent by a producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue;

[0015] An instruction sending module, used to send a first instruction to a preset cache according to a first message queue, and used to send a second instruction to the preset cache according to a second message queue;

[0016] The business processing module is used to process the first message queue according to the first response result to the first instruction returned by the preset cache, or to process the second message queue according to the second response result to the second instruction returned by the preset cache.

[0017] In a fourth aspect, the present disclosure provides a message queue processing device, the device comprising:

[0018] A message sending module, used to send a first message queue to a consumer via a first communication link, and used to send a second message queue to a consumer via a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue;

[0019] A consumer, configured to send a first instruction to a preset cache according to a first message queue, and to send a second instruction to the preset cache according to a second message queue;

[0020] The consumer is further used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

[0021] In a fifth aspect, the present disclosure provides a message queue processing system, the system comprising a producer, a consumer and a preset cache;

[0022] The producer is used to send a first message queue to the consumer through a first communication link, and is used to send a second message queue to the consumer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue;

[0023] A consumer, configured to send a first instruction to a preset cache according to a first message queue, and to send a second instruction to the preset cache according to a second message queue;

[0024] A preset cache is used to send a first response result to the first instruction to the consumer according to the first instruction, and is used to send a second response result to the second instruction to the consumer according to the second instruction;

[0025] The consumer is further used to process the first message queue according to the first response result or to process the second message queue according to the second response result.

[0026] In a sixth aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the message queue processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0027] In a seventh aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the message queue processing method of the first aspect or any corresponding embodiment thereof.

[0028] In an eighth aspect, the present disclosure provides a computer program product, including computer instructions, which are used to enable a computer to execute the message queue processing method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0030] Figure 1 It is a schematic diagram of the working principle of a consumer consuming a message queue produced by a producer in the related technology.

[0031] Figure 2 It is a schematic diagram of the working principle of multiple consumers in the related technology consuming the message queue produced by the producer.

[0032] Figure 3 It is a flowchart of a message queue processing method according to an embodiment of the present disclosure.

[0033] Figure 4 It is a flowchart of another message queue processing method according to an embodiment of the present disclosure.

[0034] Figure 5 It is a schematic diagram of the working principle of a consumer consuming a message queue produced by a producer according to an embodiment of the present disclosure.

[0035] Figure 6 It is a schematic diagram of the working principle of multiple consumers consuming the message queue produced by the producer according to an embodiment of the present disclosure.

[0036] Figure 7 It is a schematic diagram of the implementation process of idempotent logic according to an embodiment of the present disclosure.

[0037] Figure 8 The figure is a schematic diagram of communication between a service provider and a business party according to an embodiment of the present disclosure.

[0038] Fig. 9 It is a schematic diagram of an application scenario of the message queue processing method according to an embodiment of the present disclosure.

[0039] Fig.10 It is a structural block diagram of a message queue processing device according to an embodiment of the present disclosure.

[0040] Fig.11 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.

[0042] MQ (Message Queue) is a communication mechanism for transmitting message data between applications. MQ provides a reliable, asynchronous, and decoupled communication method. Message queue can be used as a container for storing message data, which is consumed by consumers after being sent to them by producers. Among them, the producer can be an application or component or service or microservice, and the consumer can be an application or component or service or microservice.

[0043] like Figure 1 As shown in the figure, after the producer (Producer) produces the message queue (MQ), it transmits the message queue to consumer A (Consumer A), and consumer A consumes the current message queue. In cloud communication services, scenarios such as call records, events, recordings, and concurrency reduction strongly rely on message queues for data flow. If the current message queue is backlogged or fails, it is easy to cause serious problems such as call damage, call record push delays, and even call record loss. Related technologies often use manual intervention to handle this, but there is a problem of poor timeliness.

[0044] like Figure 2 As shown in the figure, the producer (Producer) produces a message queue (MQ) and transmits the message queue to consumer A (Consumer A) and consumer B (Consumer B) respectively. Both consumer A and consumer B process the message queue. Figure 2 Multiple consumers consume the message queue produced by the producer. This problem may also occur when the message queue fails. Figure 1 The problem of poor communication timeliness in the message queue is also solved. Moreover, when multiple consumers consume the same message queue, the timeliness problem will have a wider impact. It can be seen that the relevant technology relying on a single MQ solution is difficult to fully guarantee the high availability of the service and has a high failure rate.

[0045] According to an embodiment of the present disclosure, a message queue processing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0046] In this embodiment, a message queue processing method is provided, which can be used for the above-mentioned consumers. Figure 3 is a flowchart of a message queue processing method according to an embodiment of the present disclosure, such as Figure 3 As shown, the process includes the following steps:

[0047] Step S301, receiving a first message queue sent by a producer through a first communication link, and receiving a second message queue sent by a producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue.

[0048] In this embodiment, the types of the first message queue and the second message queue are generally different, but they can also be the same. For example, the type of the first message queue is one of RocketMQ (RMQ, rocket message queue), kafka, RabbitMQ, and ActiveMQ, and the type of the second message queue can be one of RocketMQ, kafka, RabbitMQ, and ActiveMQ. When the first message queue and the second message queue carry the same message data but different types, and are sent synchronously by the producer to the consumer, the first message queue and the second message queue constitute heterogeneous disaster recovery.

[0049] In some optional implementations, in the above step S301, receiving the first message queue sent by the producer through the first communication link, and receiving the second message queue sent by the producer through the second communication link, includes: receiving the first message queue and the second message queue formed by the producer at the same time through a dual-write method, the first message queue is transmitted through the first communication link, and the second message queue is transmitted through the second communication link. Wherein, dual-write refers to writing the same message data into different message queues respectively, and the dual-write function in this embodiment can be a microservice.

[0050] Combination Figure 5 As shown, when the producer sends message data, it writes to both the first message queue (MQ1) and the second message queue (MQ2). The downstream service consumer A consumes both MQ1 and MQ2. This embodiment performs idempotent logic processing before consuming the message queue, so that only MQ1 or MQ2 is consumed when the message queue is fault-free. If MQ1 fails, consumer A will still consume MQ2 normally. If MQ2 fails, consumer A will still consume MQ1 normally. It can be seen that this embodiment does not affect the business logic, the customer is not aware of it, and no manual intervention is required. It has the advantages of better timeliness, etc.

[0051] like Figure 6As shown, when the producer sends message data, it writes to the first message queue (MQ1) and the second message queue (MQ2) in duplicate. Consumers A and B of the downstream service both consume MQ1 and MQ2 in duplicate, and perform idempotent logic processing to consume only MQ1 or MQ2 when the message queue is fault-free. If MQ1 fails, consumers A and B will still consume MQ2 normally. If MQ2 fails, consumers A and B will still consume MQ1 normally. It can be seen that when multiple consumers consume the message queue, this embodiment does not affect the business logic, the customer is not aware of it, and the process does not require manual intervention, which has the advantages of better timeliness.

[0052] In this embodiment, after the consumer receives the first message queue and the second message queue, the consumer performs consumption idempotence processing on the first consumption queue and the second consumption queue to ensure that only one of the message queues is consumed when both the first message queue and the second message queue are fault-free. Consumption idempotence means that no matter whether the consumer consumes one message or multiple identical messages, the effect produced is the same; in this embodiment, it specifically means that the consumer will not consume the same message repeatedly. More specifically, the idempotence processing may include step S302 and step S303.

[0053] In this embodiment, the producer writes to the first message queue and the second message queue, and the consumer consumes the first message queue and the second message queue, thereby effectively ensuring that the consumer can consume the message data even if a single message queue fails, thereby ensuring the timeliness of the cloud communication service and improving user satisfaction.

[0054] Step S302: sending a first instruction to a preset cache according to a first message queue, and sending a second instruction to the preset cache according to a second message queue.

[0055] Specifically, the consumer issues a first instruction based on the first message queue received, and the first instruction corresponds to the first message queue. The consumer issues a second instruction based on the second message queue received, and the second instruction corresponds to the second message queue. In the working principle of idempotent processing, the first response result of the first instruction is used to determine whether to process the first message queue, and the second response result of the second instruction is used to determine whether to process the second message queue; if the first message queue is to be processed, the second message queue will not be processed, and if the second message queue is to be processed, the first message queue will not be processed.

[0056] Step S303: Process the first message queue according to the first response result to the first instruction returned by the preset cache, or process the second message queue according to the second response result to the second instruction returned by the preset cache.

[0057] In specific implementation, the consumer consumes only one of the two parallel message queues sent by the producer, that is, consumes the first message queue or consumes the second message queue. In the embodiment of the present disclosure, the consumer's consumption of the message queue refers to processing the consumption queue.

[0058] In some optional embodiments, in the above-mentioned step S303, the first message queue is processed according to the first response result to the first instruction returned by the preset cache, including: if the first response result is used to indicate that there is no target business unique key in the preset cache, then the first message queue is processed; and the second message queue is processed according to the second response result to the second instruction returned by the preset cache, including: if the second response result is used to indicate that there is no target business unique key in the preset cache, then the second message queue is processed.

[0059] More specifically, if the first response result is used to indicate that there is a target business unique key in the preset cache, the first message queue is not processed; if the second response result is used to indicate that there is a target business unique key in the preset cache, the second message queue is not processed.

[0060] The consumer of this embodiment realizes consumption idempotence through the distributed cache service. Specifically, the distributed lock can be obtained through the setnx (set ifnot exists) instruction to ensure that the consumer does not repeatedly consume the same message data.

[0061] Among them, the preset cache can be a distributed cache, such as a Redis distributed cache; the first instruction and the second instruction are both setnx instructions, for example. The Redis distributed cache of this embodiment can process instructions in a single-threaded manner. The processing results of the two setnx instructions depend on which setnx is executed first. If the first setnx is executed first and the key value is set when the target business unique key does not exist (the target business unique key is stored in the Redis distributed cache), then when the second setnx is executed, it is found that the target business unique key already exists, and a failure result will be returned. For example, if the first instruction is executed first and the target business unique key is stored in the Redis distributed cache, the first response result returned is the first success message, then when the second instruction is executed, it is found that the target business unique key already exists, and a second failure message will be fed back; conversely, if the second instruction is executed first and the target business unique key is stored in the Redis distributed cache, the second response result returned is the second success message, then when the first instruction is executed, it is found that the target business unique key already exists, and a first failure message will be fed back.

[0062] The target business unique key of this embodiment is a message body obtained based on hash processing. The first response result indicating that there is no target business unique key in the preset cache is a distributed lock, and the second response result indicating that there is no target business unique key in the preset cache is also a distributed lock. The first instruction and the second instruction are respectively used to preempt the distributed lock in the Redis distributed cache. After one instruction successfully preempts (the target business unique key is stored in the Redis distributed cache), the other instruction will inevitably fail to preempt (it is found that the target business unique key already exists).

[0063] The message queue processing method provided in this embodiment transmits message queues with the same message data between producers and consumers through different communication links, and processes one of the two message queues based on the response result of the instruction issued to the preset cache; it can be seen that the present disclosure provides a dual MQ heterogeneous disaster recovery solution, which achieves the technical purpose of ensuring that consumers can consume message data when a single MQ fails, without manual intervention. This embodiment can ensure the high availability of the service, greatly reduce the failure rate of cloud communication services, and improve the timeliness of cloud communication services.

[0064] In this embodiment, a message queue processing method is provided, which can be used for the above-mentioned consumers. Figure 4 is a flowchart of a message queue processing method according to an embodiment of the present disclosure, such as Figure 4 As shown, the process includes the following steps:

[0065] Step S401, receiving a first message queue sent by a producer through a first communication link, and receiving a second message queue sent by a producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue. For details, see Figure 3 Step S301 of the illustrated embodiment will not be described in detail here.

[0066] Step S402: sending a first instruction to a preset cache according to a first message queue, and sending a second instruction to the preset cache according to a second message queue.

[0067] Specifically, in the above step S402, sending the first instruction to the preset cache according to the first message queue includes but is not limited to steps S40211 to S40214.

[0068] Step S40211, parse the first message data and the first identity identification number from the first message queue.

[0069] The first message queue includes but is not limited to the first message data and the first identity identification number, and the first identity identification number may be a call unique ID (Identity Document, identification number).

[0070] Step S40212, performing hash processing on the first message data to obtain a first hash result.

[0071] Specifically, this embodiment performs a hash calculation on the first message data to obtain a first hash result, which can be expressed as hash(msg). A hash algorithm can be selected in a related scheme to perform the hash calculation.

[0072] Step S40213, combining the first identity identification number and the first hash result into a unique key for the target business.

[0073] In this embodiment, the target business unique key may be a combination of the first identity identification number and the first hash result.

[0074] Step S40214, sending the first instruction carrying the target business unique key to the preset cache; the preset cache is used to send a first failure message to the consumer according to the storage of the target business unique key, or to send a first success message to the consumer and store the target business unique key according to the non-storage of the target business unique key. The first success message is used to instruct the consumer to process the first message queue, the first failure message is used to instruct the consumer to cancel the processing of the first message queue, and the first response result includes the first failure message and the first success message.

[0075] In combination with the foregoing embodiment, the preset cache may be a Redis distributed cache, which is used to process the first instruction and feed back a first failure message or a first success message.

[0076] Specifically, in the above step S402, sending the second instruction to the preset cache according to the second message queue includes but is not limited to steps S40221 to S40224.

[0077] Step S40221, parse the second message data and the second identity identification number from the second message queue.

[0078] The second message queue includes but is not limited to the second message data and the second identity identification number, and the second identity identification number may be a unique ID (Identity Document, identification number) for the call.

[0079] Step S40222: Perform hash processing on the second message data to obtain a second hash result.

[0080] Specifically, this embodiment performs hash calculation on the second message data to obtain a second hash result, which can be expressed as hash(msg). A hash algorithm can be selected in a related scheme to perform hash calculation.

[0081] Step S40223, combining the second identity identification number and the second hash result into a target business unique key.

[0082] In this embodiment, the target business unique key may be a combination of the second identity identification number and the second hash result.

[0083] Step S40224, sending the second instruction carrying the target business unique key to the preset cache; the preset cache is used to send a second failure message to the consumer according to the target business unique key being stored, or to send a second success message to the consumer and store the target business unique key according to the target business unique key not being stored. The second success message is used to instruct the consumer to process the second message queue, the second failure message is used to instruct the consumer to cancel processing the second message queue, and the second response result includes the second failure message and the second success message.

[0084] In combination with the foregoing embodiment, the preset cache may be a Redis distributed cache, which is used to process the second instruction and feed back a second failure message or a second success message.

[0085] like Figure 7 As shown, the idempotent processing process essentially provides an idempotent service and includes the following processes: 7.1. The consumer sends a setnx instruction to the Redis distributed cache to obtain a distributed lock (the first response result or the second response result mentioned above). The instruction contains the target business unique key (key). The specific form of the instruction can be setnx key (called+hash(msg))value expire24Hours, where called can be used to represent the call unique ID, hash(msg) represents the hash processing result, expire represents the expiration time parameter, and 24Hours represents the specific value of the expiration time is 24 hours; 7.2. The consumer receives the response result (return) of the Redis distributed cache. result), the first success message or the second success message in the response result is the distributed lock. 7.3. If the response result is failure (fail), that is, the first failure message or the second failure message, it means that the key already exists in the Redis distributed cache, that is, the distributed lock is not obtained, and the consumer will no longer continue to process the current message queue; if the response result is success (success), that is, the first success message or the second success message, that is, the distributed lock is obtained, the consumer performs business processing, that is, consumes the current consumption queue; 7.4. If the processing is successful, the current process ends; if the processing fails, delete the target business unique key (del key), return to the aforementioned step 7.2 and try again.

[0086] In the scenario where the message pushing (such as call records, etc.) to an external business party fails, the message needs to be re-pushed; when the message is re-pushed, the message queue processing process needs to be executed again. If only the identity identification number is used as the target business unique key, the above-mentioned idempotent logic will determine that the Redis distributed cache has already stored the target business unique key, and the consumer will not consume the current message queue, and the message re-push function cannot be realized. In this embodiment, the target business unique key containing the hash result is carried in the instruction sent to the preset cache. Since the hash results obtained after hash calculation for different message data are different, it can be distinguished when the message is re-pushed that the current target business unique key is different from the stored target business unique key, thereby ensuring that the message data re-push function is realized in the scenario where the call record or other data fails to be pushed to the external business party.

[0087] In some optional embodiments, the first instruction also carries first expiration time information, and the first expiration time information is used to indicate the first maximum cache duration when storing the target business unique key; the second instruction also carries second expiration time information, and the second expiration time information is used to indicate the second maximum cache duration when storing the target business unique key.

[0088] Among them, the first maximum cache period can be the same as the second maximum cache period; for example, the first maximum cache period = the second maximum cache period = 24 hours, indicating that the expiration time of the target business unique key stored in the preset cache is 24 hours (automatically deleted when the storage time reaches 24 hours).

[0089] This embodiment carries the first expiration time information in the first instruction and the second expiration time information in the second instruction, thereby achieving regular cleaning of the target business unique key data stored in the preset cache, ensuring that the preset cache always has relatively sufficient cache space to avoid affecting the implementation of the idempotent processing function due to insufficient cache space, and ensuring the continuous and stable execution of the message queue processing process of the present disclosure.

[0090] In some optional implementations, the type of the first consumer queue is different from the type of the second consumer queue.

[0091] The type of the first message queue and the type of the second message queue are any two of RocketMQ, kafka, RabbitMQ, and ActiveMQ, respectively. For example, the type of the first message queue is RocketMQ, and the type of the second message queue is RabbitMQ.

[0092] The first message queue and the second message queue in this embodiment belong to two different MQ products and have different technical implementations, so the probability of the first message queue and the second message queue failing at the same time is extremely small, that is, the probability of two different MQ schemes failing at the same time is much smaller than the probability of two identical MQ schemes failing; therefore, this embodiment can further reduce the possibility of MQ failure and further improve the timeliness of cloud communication services.

[0093] Step S403: Process the first message queue according to the first response result to the first instruction returned by the preset cache, or process the second message queue according to the second response result to the second instruction returned by the preset cache. Figure 3 Step S303 of the illustrated embodiment will not be described in detail here.

[0094] like Figure 8 As shown, the message queue processing method provided in this embodiment is specifically applied to the internal data flow of the service provider. The producer can generate the first message queue and the second message queue based on the content in the data storage, which are consumed by consumer A after idempotent processing by consumer A, and then transmitted to the TOB (TO Business, facing enterprises, companies and other merchants) business party through network communication (such as HTTP, full name HyperText Transfer Protocol, hypertext transfer protocol), and provide corresponding services for the TOB business party, such as voice service, recording service or call record (i.e. call data record) service.

[0095] like Fig. 9 As shown, voice service / privacy number, recording service, data center, and push service can all be implemented in the form of microservices. The producers (Producer) and consumers (Consumer) of this embodiment are relative. Taking the voice service / privacy number transmitting the call sheet (message queue MQ, type is kafka) to the data center as an example, the voice service / privacy number is the Producer and the data center is the Consumer; taking the data center pushing the call sheet (message queue MQ) to the push service as an example, the data center is the Producer at this time, and the push service is the Consumer, and then pushes the call sheet to the external user / user service; similarly, when implementing specific services, for example, when implementing related functions involving the recording service, the current microservice is specifically the Producer or the Consumer, which can be determined according to the producer and consumer of the message queue.

[0096] In this embodiment, a message queue processing method is provided for the above-mentioned producer, and the message queue processing method includes the following steps: sending a first message queue to a consumer through a first communication link, and sending a second message queue to the consumer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; the consumer is used to send a first instruction to a preset cache according to the first message queue, and is used to send a second instruction to the preset cache according to the second message queue; the consumer is also used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

[0097] The producer writes the message data to be sent into the two message queues respectively to obtain the first message queue and the second message queue. The specific processing process of the consumer for the first consumption queue and the second consumption queue is the same as the above embodiment, which will not be repeated here.

[0098] In some optional implementations, before sending the first message queue and the second message queue, the method further includes: writing the first message data and the second message data into two empty message queues respectively at the same time in a double-write manner to obtain the first message queue and the second message queue.

[0099] In this embodiment, the producer simultaneously writes the same message data into two empty message queues with no message data and obtains the first message queue and the second message queue, ensuring that the consumer can still consume the data in the event of a single message queue failure, thereby ensuring the timeliness of the cloud communication service.

[0100] In some optional implementations, the consumer is specifically used to process the first message queue according to the first response result indicating that there is no unique key of the target business in the preset cache; or the consumer is specifically used to process the second message queue according to the second response result indicating that there is no unique key of the target business in the preset cache. For details of the consumer processing the corresponding message queue according to the response result, please refer to the aforementioned embodiment, which will not be repeated here.

[0101] In some optional embodiments, the consumer is specifically used to parse the first message data and the first identity identification number from the first message queue, hash the first message data to obtain a first hash result, combine the first identity identification number and the first hash result into a target business unique key, and send the first instruction carrying the target business unique key to a preset cache; the preset cache is used to send a first failure message to the consumer based on the storage of the target business unique key, or to send a first success message to the consumer and store the target business unique key based on the non-storage of the target business unique key; the first success message is used to instruct the consumer to process the first message queue, and the first failure message is used to instruct the consumer to cancel processing of the first message queue, and the first response result includes the first failure message and the first success message. The consumer is specifically used to parse the second message data and the second identity number from the second message queue, obtain a second hash result after hashing the second message data, combine the second identity number and the second hash result into a target business unique key, and send the second instruction carrying the target business unique key to the preset cache; the preset cache is used to send a second failure message to the consumer based on the target business unique key being stored, or to send a second success message to the consumer and store the target business unique key based on the target business unique key not being stored; the second success message is used to instruct the consumer to process the second message queue, the second failure message is used to instruct the consumer to cancel processing the second message queue, and the second response result includes the second failure message and the second success message. The specific process of the consumer sending instructions to the preset cache according to the message queue can be referred to the aforementioned embodiment, which will not be repeated here.

[0102] In some optional embodiments, the first instruction also carries first expiration time information, and the first expiration time information is used to indicate the first maximum cache duration when storing the target business unique key; the second instruction also carries second expiration time information, and the second expiration time information is used to indicate the second maximum cache duration when storing the target business unique key.

[0103] In some optional implementations, the type of the first consumer queue is different from the type of the second consumer queue.

[0104] In the present embodiment, a message queue processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0105] This embodiment provides a message queue processing device that can be integrated on a consumer, such as Fig.10As shown, the message queue processing device includes:

[0106] The message receiving module 1001 is used to receive a first message queue sent by a producer through a first communication link, and to receive a second message queue sent by a producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue.

[0107] The instruction sending module 1002 is used to send a first instruction to a preset cache according to a first message queue, and to send a second instruction to the preset cache according to a second message queue.

[0108] The business processing module 1003 is used to process the first message queue according to the first response result to the first instruction returned by the preset cache, or to process the second message queue according to the second response result to the second instruction returned by the preset cache.

[0109] In some optional implementations, the message receiving module 1001 is specifically used to receive a first message queue and a second message queue formed by the producer at the same time through a double-write method, the first message queue is transmitted through a first communication link, and the second message queue is transmitted through a second communication link.

[0110] In some optional embodiments, the business processing module 1003 is specifically used to process the first message queue based on the first response result indicating that there is no target business unique key in the preset cache; or the business processing module 1003 is specifically used to process the second message queue based on the second response result indicating that there is no target business unique key in the preset cache.

[0111] In some optional implementations, the instruction sending module 1002 is specifically used to parse the first message data and the first identity identification number from the first message queue, perform hash processing on the first message data to obtain a first hash result, combine the first identity identification number and the first hash result into a target business unique key, and send the first instruction carrying the target business unique key to a preset cache; the preset cache is used to send a first failure message to the consumer based on the storage of the target business unique key, or to send a first success message to the consumer and store the target business unique key based on the non-storage of the target business unique key; the first success message is used to instruct the consumer to process the first message queue, and the first failure message is used to instruct the consumer to cancel the processing of the first message queue, and the first response result includes the first failure message and the first success message; and the instruction sending module 1002 is specifically used to parse the second message data and the second identity identification number from the second message queue, hash the second message data to obtain a second hash result, combine the second identity identification number and the second hash result into a target business unique key, and send the second instruction carrying the target business unique key to the preset cache; the preset cache is used to send a second failure message to the consumer according to the storage of the target business unique key, or to send a second success message to the consumer and store the target business unique key according to the non-storage of the target business unique key; the second success message is used to instruct the consumer to process the second message queue, and the second failure message is used to instruct the consumer to cancel the processing of the second message queue, and the second response result includes the second failure message and the second success message.

[0112] In some optional embodiments, the first instruction also carries first expiration time information, and the first expiration time information is used to indicate the first maximum cache duration when storing the target business unique key; the second instruction also carries second expiration time information, and the second expiration time information is used to indicate the second maximum cache duration when storing the target business unique key.

[0113] In some optional implementations, the type of the first consumer queue is different from the type of the second consumer queue.

[0114] This embodiment also provides a message queue processing device, which can be integrated on a producer, and the message queue processing device includes: a message sending module, which is used to send a first message queue to a consumer through a first communication link, and is used to send a second message queue to the consumer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; the consumer is used to send a first instruction to a preset cache according to the first message queue, and is used to send a second instruction to the preset cache according to the second message queue; the consumer is also used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

[0115] In some optional implementations, the message sending module is specifically configured to write the first message data and the second message data into two empty message queues respectively at the same time in a double-write manner to obtain the first message queue and the second message queue.

[0116] In some optional embodiments, the consumer is specifically used to process the first message queue based on a first response result indicating that there is no target business unique key in the preset cache; or the consumer is specifically used to process the second message queue based on a second response result indicating that there is no target business unique key in the preset cache.

[0117] In some optional embodiments, the consumer is specifically used to parse the first message data and the first identity identification number from the first message queue, hash the first message data to obtain a first hash result, combine the first identity identification number and the first hash result into a target business unique key, and send the first instruction carrying the target business unique key to a preset cache; the preset cache is used to send a first failure message to the consumer based on the storage of the target business unique key, or to send a first success message to the consumer and store the target business unique key based on the non-storage of the target business unique key; the first success message is used to instruct the consumer to process the first message queue, and the first failure message is used to instruct the consumer to cancel processing of the first message queue, and the first response result includes the first failure message and the first success message. The consumer is specifically used to parse the second message data and the second identity identification number from the second message queue, hash the second message data to obtain a second hash result, combine the second identity identification number and the second hash result into a target business unique key, and send the second instruction carrying the target business unique key to a preset cache; the preset cache is used to send a second failure message to the consumer based on the storage of the target business unique key, or to send a second success message to the consumer and store the target business unique key based on the non-storage of the target business unique key; the second success message is used to instruct the consumer to process the second message queue, and the second failure message is used to instruct the consumer to cancel processing of the second message queue, and the second response result includes the second failure message and the second success message.

[0118] In some optional embodiments, the first instruction also carries first expiration time information, and the first expiration time information is used to indicate the first maximum cache duration when storing the target business unique key; the second instruction also carries second expiration time information, and the second expiration time information is used to indicate the second maximum cache duration when storing the target business unique key.

[0119] In some optional implementations, the type of the first consumer queue is different from the type of the second consumer queue.

[0120] The further functional description of the above modules and units is the same as that of the above corresponding method embodiments, which will not be repeated here.

[0121] The message queue processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0122] The disclosed embodiment can also provide a message queue processing system, which includes a producer, a consumer and a preset cache.

[0123] The producer is used to send a first message queue to a consumer via a first communication link, and is used to send a second message queue to the consumer via a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue.

[0124] The consumer is used to send a first instruction to a preset cache according to a first message queue, and is used to send a second instruction to the preset cache according to a second message queue.

[0125] The preset cache is used to send a first response result to the first instruction to the consumer according to the first instruction, and is used to send a second response result to the second instruction to the consumer according to the second instruction.

[0126] The consumer is further used to process the first message queue according to the first response result or to process the second message queue according to the second response result.

[0127] In some optional implementations, the producer is specifically configured to write the first message data and the second message data into two empty message queues respectively at the same time in a double-write manner to obtain the first message queue and the second message queue.

[0128] Among them, the specific process of the producer obtaining the first message queue and the second message queue by double writing can be referred to the aforementioned embodiment, which will not be repeated here.

[0129] In some optional implementations, the consumer is specifically used to process the first message queue according to the first response result indicating that there is no unique key of the target business in the preset cache; or the consumer is specifically used to process the second message queue according to the second response result indicating that there is no unique key of the target business in the preset cache. For details of the consumer processing the corresponding message queue according to the response result, please refer to the aforementioned embodiment, which will not be repeated here.

[0130] In some optional embodiments, the consumer is specifically used to parse the first message data and the first identity identification number from the first message queue, hash the first message data to obtain a first hash result, combine the first identity identification number and the first hash result into a target business unique key, and send the first instruction carrying the target business unique key to a preset cache; the preset cache is used to send a first failure message to the consumer based on the storage of the target business unique key, or to send a first success message to the consumer and store the target business unique key based on the non-storage of the target business unique key; the first success message is used to instruct the consumer to process the first message queue, and the first failure message is used to instruct the consumer to cancel processing of the first message queue, and the first response result includes the first failure message and the first success message. The consumer is specifically used to parse the second message data and the second identity number from the second message queue, obtain a second hash result after hashing the second message data, combine the second identity number and the second hash result into a target business unique key, and send the second instruction carrying the target business unique key to the preset cache; the preset cache is used to send a second failure message to the consumer based on the target business unique key being stored, or to send a second success message to the consumer and store the target business unique key based on the target business unique key not being stored; the second success message is used to instruct the consumer to process the second message queue, the second failure message is used to instruct the consumer to cancel processing the second message queue, and the second response result includes the second failure message and the second success message. The specific process of the consumer sending instructions to the preset cache according to the message queue can be referred to the aforementioned embodiment, which will not be repeated here.

[0131] In some optional embodiments, the first instruction also carries first expiration time information, and the first expiration time information is used to indicate the first maximum cache duration when storing the target business unique key; the second instruction also carries second expiration time information, and the second expiration time information is used to indicate the second maximum cache duration when storing the target business unique key.

[0132] In some optional implementations, the type of the first consumer queue is different from the type of the second consumer queue.

[0133] In summary, the dual message queue heterogeneous disaster recovery solution provided by the embodiment of the present disclosure can ensure that consumers can consume message data through the other message queue when any message queue fails or accumulates. This process does not require human intervention, ensuring that the message data is processed in a timely manner, thereby improving timeliness.

[0134] The disclosed embodiment also provides a computer device having the message queue processing device in at least one of the above embodiments.

[0135] See also Fig.11 , Fig.11is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Fig.11 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.11 A processor 10 is taken as an example.

[0136] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0137] The memory 20 stores instructions to be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0138] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0139] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0140] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0141] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0142] A part of the present disclosure may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present disclosure through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.

[0143] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A message queue processing method, characterized in that: Applied to consumers; the method comprises: A first message queue is received and sent by a producer through a first communication link, and a second message queue is received and sent by the producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; Sending a first instruction to a preset cache according to the first message queue, and sending a second instruction to the preset cache according to the second message queue; The first message queue is processed according to a first response result to the first instruction returned by the preset cache, or the second message queue is processed according to a second response result to the second instruction returned by the preset cache.

2. The method according to claim 1, characterized in that The receiving a first message queue sent by the producer through the first communication link, and receiving a second message queue sent by the producer through the second communication link, comprises: The first message queue and the second message queue formed by the producer at the same time in a dual-write manner are received, the first message queue is transmitted through a first communication link, and the second message queue is transmitted through a second communication link.

3. The method according to claim 1 or 2, characterized in that: The processing of the first message queue according to the first response result to the first instruction returned by the preset cache includes: if the first response result is used to indicate that there is no target business unique key in the preset cache, processing the first message queue; The processing of the second message queue according to the second response result to the second instruction returned by the preset cache includes: if the second response result is used to indicate that the target business unique key does not exist in the preset cache, processing the second message queue.

4. The method according to claim 3, characterized in that The sending of the first instruction to the preset cache according to the first message queue includes: parsing the first message data and the first identity identification number from the first message queue, performing hash processing on the first message data to obtain a first hash result, combining the first identity identification number and the first hash result into the target business unique key, and sending the first instruction carrying the target business unique key to the preset cache; the preset cache is used to send a first failure message to the consumer according to the storage of the target business unique key, or to send a first success message to the consumer and store the target business unique key according to the non-storage of the target business unique key; the first success message is used to instruct the consumer to process the first message queue, and the first failure message is used to instruct the consumer to cancel the processing of the first message queue, and the first response result includes the first failure message and the first success message; The sending of the second instruction to the preset cache according to the second message queue includes: parsing the second message data and the second identity identification number from the second message queue, hashing the second message data to obtain a second hash result, combining the second identity identification number and the second hash result into the target business unique key, and sending the second instruction carrying the target business unique key to the preset cache; the preset cache is used to send a second failure message to the consumer according to the storage of the target business unique key, or to send a second success message to the consumer and store the target business unique key according to the non-storage of the target business unique key; the second success message is used to instruct the consumer to process the second message queue, and the second failure message is used to instruct the consumer to cancel processing of the second message queue, and the second response result includes the second failure message and the second success message.

5. The method according to claim 4, characterized in that The first instruction also carries first expiration time information, where the first expiration time information is used to indicate a first maximum cache duration when storing the target business unique key; The second instruction also carries second expiration time information, where the second expiration time information is used to indicate a second maximum cache duration when storing the target business unique key.

6. The method according to claim 1 or 2, characterized in that: The type of the first consumer queue is different from the type of the second consumer queue.

7. A message queue processing method, characterized in that: Applied to producers; the method comprises: Sending a first message queue to a consumer via a first communication link, and sending a second message queue to the consumer via a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; The consumer is used to send a first instruction to a preset cache according to the first message queue, and is used to send a second instruction to the preset cache according to the second message queue; The consumer is further used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

8. The method according to claim 7, characterized in that Before sending the first message queue and the second message queue, the method further includes: The first message data and the second message data are respectively written into two empty message queues at the same time in a double-write manner to obtain the first message queue and the second message queue.

9. A message queue processing device, characterized in that: The device comprises: A message receiving module, used for receiving a first message queue sent by a producer through a first communication link, and for receiving a second message queue sent by the producer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; an instruction sending module, configured to send a first instruction to a preset cache according to the first message queue, and to send a second instruction to the preset cache according to the second message queue; A business processing module is used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

10. A message queue processing device, characterized in that: The device comprises: A message sending module, used to send a first message queue to a consumer through a first communication link, and used to send a second message queue to the consumer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; The consumer is used to send a first instruction to a preset cache according to the first message queue, and is used to send a second instruction to the preset cache according to the second message queue; The consumer is further used to process the first message queue according to a first response result to the first instruction returned by the preset cache, or to process the second message queue according to a second response result to the second instruction returned by the preset cache.

11. A message queue processing system, characterized in that: The system includes producers, consumers and preset caches; The producer is used to send a first message queue to a consumer through a first communication link, and is used to send a second message queue to the consumer through a second communication link; the first message data carried by the first message queue is the same as the second message data carried by the second message queue; The consumer is used to send a first instruction to a preset cache according to the first message queue, and is used to send a second instruction to the preset cache according to the second message queue; The preset cache is used to send a first response result to the first instruction to the consumer according to the first instruction, and to send a second response result to the second instruction to the consumer according to the second instruction; The consumer is further configured to process the first message queue according to the first response result or to process the second message queue according to the second response result.

12. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the message queue processing method according to any one of claims 1 to 6 or claims 7 to 8 by executing the computer instructions.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the message queue processing method according to any one of claims 1 to 6 or claims 7 to 8.

14. A computer program product, characterized in that It comprises computer instructions, and the computer instructions are used to make a computer execute the message queue processing method according to any one of claims 1 to 6 or claims 7 to 8.