Information processing method, terminal, system, computer device and storage medium
By using RocketMQ and Zookeeper components in the RabbitMQ server cluster, unique identifiers are generated for consumption and confirmation messages, resolving the connection interruption issue caused by single-node failure in the RabbitMQ client and ensuring the stability and reliability of message transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2020-01-16
- Publication Date
- 2026-06-23
AI Technical Summary
Existing RabbitMQ clients are prone to connection interruptions in RabbitMQ server clusters due to single-node failures, affecting the stability of internal messaging services, causing service crashes and user inconvenience.
By using RocketMQ service components and Zookeeper components, unique identifiers are generated for the consumption information and acknowledgment information, which are then cached in the preparation information queue. After the acknowledgment information is sent, the RocketMQ service component releases the information to the target terminal for consumption, ensuring that messages are not sent repeatedly.
This ensures stable message transmission even in a RabbitMQ server cluster where a single node fails, preventing message sending failures and improving system reliability and user experience.
Smart Images

Figure CN111274047B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information interaction technology, and in particular to an information processing method, terminal, information processing system, computer equipment, and computer-readable storage medium. Background Technology
[0002] Currently, with the increasing prominence of microservices, the application of message queues is becoming more and more widespread. RabbitMQ is a message middleware based on the AMQP protocol, which can provide reliable message transmission between applications. It performs excellently in terms of ease of use, scalability, and high availability, and is widely used.
[0003] However, current RabbitMQ clients are designed for single RabbitMQ servers. With the expansion of service coverage, RabbitMQ server clusters can now be deployed to improve service availability. RabbitMQ clients can connect to any server in the cluster to send and receive messages. RabbitMQ is a reusable enterprise messaging system built on the AMQP protocol, where MQ (Message Queue) is an application-to-application communication method.
[0004] Each RabbitMQ client is designed to interact with a single RabbitMQ server. Initially, each client is assigned a fixed connection to one RabbitMQ server. If one server in the cluster fails, all RabbitMQ clients connected to that server will disconnect. In other words, while the RabbitMQ server cluster provides high availability, each RabbitMQ client still maintains a fixed connection with only one RabbitMQ server. Therefore, a single-node failure will still result in the same RabbitMQ service interruption as before.
[0005] If RabbitMQ message queues are directly used in the main business service, the connection between the main business service and RabbitMQ service may be interrupted due to network instability and other reasons, resulting in a "dead" state or even service crash.
[0006] Therefore, when RabbitMQ is used for internal enterprise messaging services, emails, app push notifications, or general asynchronous tasks, one or more of the above reasons may cause communication disruptions within the enterprise, affecting user experience and potentially leading to unforeseen losses and inconvenience. Summary of the Invention
[0007] This application provides an information processing method, terminal, information processing system, computer equipment, and storage medium to effectively solve the above-mentioned technical problems.
[0008] Firstly, this application provides an information processing method, including:
[0009] Generate pending consumption information, confirmation information corresponding to the pending consumption information, and a unique identification number for identifying the pending consumption information and the confirmation information;
[0010] The information to be consumed and the corresponding unique identification number are sent to the preparation information queue for caching;
[0011] Send the confirmation information corresponding to the unique identifier to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identifier in the preparatory information queue to the first target terminal for consumption.
[0012] Secondly, this application also provides a terminal, the terminal comprising:
[0013] The information generation module is used to generate consumption information, confirmation information corresponding to the consumption information, and a unique identification number for identifying the consumption information and the confirmation information.
[0014] The information sending module is used to send the information to be consumed and the corresponding unique identification number to the pre-construction information queue for caching;
[0015] The confirmation sending module is used to send the confirmation information containing the unique identification number to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the preparation information queue to the first target terminal for consumption.
[0016] Thirdly, this application also provides an information processing system, which includes a plurality of terminals as described in the second aspect.
[0017] Fourthly, this application also provides a computer device, the computer device including a memory and a processor;
[0018] The memory is used to store computer programs;
[0019] The processor is configured to execute the computer program and, in executing the computer program, implement the information processing method as described above.
[0020] Fifthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the information processing method described above.
[0021] This application discloses an information processing method, terminal, information processing system, computer equipment, and storage medium. The method generates information to be consumed, a corresponding confirmation message, and a unique identifier for identifying the information to be consumed and the confirmation message. Then, the information to be consumed and the corresponding unique identifier are sent to a pre-processing information queue for caching. Finally, the confirmation message corresponding to the unique identifier is sent to a RocketMQ service component, causing the RocketMQ service component to release the cached information to be consumed to a first target terminal for consumption. This application uses RocketMQ for system communication and employs a globally unique identifier, ensuring that duplicate IDs will never cause message sending failures. This application is applicable to message services, email, app push notifications, or general asynchronous tasks. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic block diagram of an information processing system provided in an embodiment of this application;
[0024] Figure 2 This is a schematic flowchart illustrating the steps of the information processing method provided in the embodiments of this application;
[0025] Figure 3 This is a schematic flowchart illustrating the steps of another information processing method provided in an embodiment of this application;
[0026] Figure 4 An embodiment of this application also provides a schematic block diagram of a terminal;
[0027] Figure 5 This is a schematic block diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0029] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0030] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0031] Please see Figure 1 , Figure 1 This is a schematic block diagram of an information processing system provided in an embodiment of this application. The information processing method provided in this application can be applied to this information processing system.
[0032] like Figure 1 As shown, the information processing system 100 includes a sending terminal 101, a target terminal 102, and a RocketMQ service component 103. The sending terminal 101, the RocketMQ service component 103, and the target terminal 102 are connected sequentially. However, it should be noted that the information processing system may also include two or more terminals; this application does not limit the number of terminals in the information processing system.
[0033] The sending terminal 101 is used to generate consumption information, confirmation information corresponding to the consumption information, and a unique identification number used to identify the consumption information and the confirmation information.
[0034] The sending terminal 101 is also connected to the Zookeeper component 104, and the sending terminal 101 sends the generated information to be consumed and the unique identification number corresponding to the information to be consumed to the preparation information queue of the Zookeeper component 104 for caching.
[0035] Sending terminal 101 sends confirmation information corresponding to the unique identification number to RocketMQ service component 103, so that RocketMQ service component 103 coordinates Zookeeper component 104 to release the information to be consumed corresponding to the unique identification number cached in the preparation information queue to the target terminal 102 for consumption.
[0036] Sending terminal 101 sends a message to RocketMQ service component 103. If the message is sent successfully, RocketMQ service component 103 sends an acknowledgment (ACK) to target terminal 102. After receiving the acknowledgment, target terminal 102 executes a local task. If the message fails to be sent, RocketMQ service component 103 is notified to call back sending terminal 101 to determine whether to roll back the message or resend the acknowledgment.
[0037] In some embodiments, the information processing system may further include a first database 105 and a second database 106, wherein the first database is used to store confirmation information generated by the sending terminal corresponding to the consumption information, and the second database is used to store sequence indication information generated by the target terminal.
[0038] The information processing method provided in this application will be described in detail below based on the information processing system.
[0039] Please see Figure 2 , Figure 2 This is a schematic flowchart illustrating the steps of the information processing method provided in this application embodiment. The information processing method of this application can be applied to asynchronous interactive tasks of SMS, email, APP information push, third-party payment platform business transactions, and various online interactive systems, specifically including steps S201 to S203.
[0040] S201. Generate consumption information, confirmation information corresponding to the consumption information, and a unique identification number for identifying the consumption information and the confirmation information.
[0041] Specifically, confirmation information refers to information used by the first target terminal to consume certain information to be consumed.
[0042] In this system, there is a one-to-one correspondence between the confirmation message and the message to be consumed; that is, each message to be consumed corresponds to a confirmation message, and both the message to be consumed and its corresponding confirmation message share the same unique identifier. In practice, this unique identifier can be marked as a Message ID, and a distributed lock can be used to generate the unique identifier to avoid duplicate IDs and thus prevent message sending failures.
[0043] In some embodiments, the sending terminal may be connected to a first database. The acknowledgment information generated by the sending terminal is stored in the first database connected to the sending terminal. When a certain condition is met, the acknowledgment information is automatically read from the first database and then sent to the RocketMQ service component. This method avoids the loss of acknowledgment information due to system restarts or network anomalies, ensuring that the information to be consumed can be consumed accordingly.
[0044] It is worth mentioning that when storing the confirmation information in the first database, a sequential write method can be used, which can avoid the addressing overhead of random disk read / write. The sequential disk read / write performance of this application is extremely high, effectively ensuring efficiency.
[0045] S202. Send the information to be consumed and the corresponding unique identification number to the preparation information queue for caching.
[0046] Specifically, the preparation information queue refers to the preparation information queue of the Zookeeper component. The Zookeeper component is also known as the ZK component or ZK. The Zookeeper component can realize the coordination work between distributed systems. For example, after the sending terminal sends a request, it can register a listener on the value of a certain node on the Zookeeper component. Once the first target terminal has finished processing, it modifies the value of that node, and the sending terminal can immediately receive the notification feedback information.
[0047] In some embodiments, after step S202, the following may also be included:
[0048] Set the lifespan of the information to be consumed; if the information to be consumed is not consumed within the lifespan, then forward the information to another prepared information queue.
[0049] Specifically, RocketMQ's DLX (Dead Letter Exchanges) and TTL (Time-To-Live Extensions) features can be utilized. First, the message to be consumed is sent to a cache queue. Then, a time-to-live (TTL) is set. If the message is not consumed within the TTL, it is forwarded to another cache queue. Then, the task of consuming the forwarded message is consumed from this other queue, thus achieving the effect of delayed message consumption.
[0050] It is easy to understand that this approach avoids the need for existing technologies to retrieve and process orders or other data every minute or hour, thus improving efficiency. It also avoids the immense pressure that database scanning can put on a large amount of data. This application is highly time-sensitive and avoids duplicate execution, thus achieving a balance between timeliness and polling frequency.
[0051] S203. Send the confirmation information corresponding to the unique identification number to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the preparatory information queue to the first target terminal for consumption.
[0052] Specifically, the sending terminal sends the confirmation information corresponding to the unique identification number to the RocketMQ service component, which in turn coordinates with the Zookeeper component to release the information to be consumed corresponding to the unique identification number from the prepared information queue of the Zookeeper component to the first target terminal for consumption.
[0053] In the specific implementation process, the first target terminal needs to maintain idempotency with the sending terminal. For example, the sending terminal first sends a prepared message to RocketMQ. If the prepared message fails to be sent, the operation is canceled and not executed. If the message is sent successfully, the local task is executed. If successful, RocketMQ is notified to send an acknowledgment message (ACK). If it fails, RocketMQ is notified to roll back the message and send a NACK. If an acknowledgment message is sent, the first target terminal will receive the acknowledgment message and then execute the local task. RocketMQ automatically polls all prepared message callback interfaces periodically. Generally, this can be used to check whether the local task was executed in the database. If it was rolled back, then the rollback is executed. If the first target terminal fails to consume the message, it will automatically retry until successful, or it can execute a rollback operation. At the same time, the sending terminal also executes a rollback operation, or an alarm is sent for manual rollback and compensation.
[0054] This embodiment provides an information processing method that generates information to be consumed, a corresponding confirmation message, and a unique identifier for identifying the information to be consumed and the confirmation message. The information to be consumed and the corresponding unique identifier are then sent to a pre-processing information queue for caching. Finally, the confirmation message corresponding to the unique identifier is sent to a RocketMQ service component, so that the RocketMQ service component releases the cached information to be consumed to a first target terminal for consumption. By using RocketMQ for system communication and employing a globally unique identifier, it is absolutely impossible for duplicate IDs to cause message sending failures. This application can be applied to message services, email, app push notifications, or general asynchronous tasks.
[0055] Please refer to Figure 3 , Figure 3 This is a schematic flowchart illustrating the steps of another information processing method provided in an embodiment of this application.
[0056] S301. Generate consumption information, confirmation information corresponding to the consumption information, and a unique identification number for identifying the consumption information and the confirmation information.
[0057] Specifically, confirmation information refers to information used by the first target terminal to consume certain information to be consumed.
[0058] In this system, there is a one-to-one correspondence between the confirmation message and the message to be consumed; that is, each message to be consumed corresponds to a confirmation message, and both the message to be consumed and its corresponding confirmation message share the same unique identifier. In practice, this unique identifier can be marked as a Message ID, and a distributed lock can be used to generate the unique identifier to avoid duplicate IDs and thus prevent message sending failures.
[0059] S302. Send the information to be consumed and the corresponding unique identification number to the preparation information queue for caching, and start the countdown for sending the confirmation information.
[0060] Specifically, the confirmation information can automatically start a sending countdown when the sending terminal sends the information to be consumed and the corresponding unique identification number to the preparation information queue of the Zookeeper component for caching, so as to realize the timed consumption of the information to be consumed.
[0061] S303. After the countdown for sending the confirmation information ends, the confirmation information corresponding to the unique identification number is sent to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the preparatory information queue to the first target terminal for consumption.
[0062] Specifically, after the countdown for sending the confirmation message ends, the sending terminal automatically sends the confirmation message corresponding to the unique identifier to the RocketMQ service component. This allows the RocketMQ service component to coordinate with the Zookeeper component to release the pending information corresponding to the unique identifier from the Zookeeper component's prepared information queue to the first target terminal for consumption. The first target terminal needs to maintain idempotency with the sending terminal. After the countdown for sending the confirmation message ends, the sending terminal automatically sends the confirmation message to the RocketMQ service component to enable the first target terminal to consume the pending information on a scheduled basis.
[0063] S304. Obtain the sequence indication information returned when the information to be consumed is released.
[0064] Specifically, after the information to be consumed is released to the first target terminal, the first target terminal will return a sequence indication message to the sending terminal to indicate that the information to be consumed has been consumed.
[0065] In some embodiments, the second terminal can be configured to confirm the consumption of the information to be consumed. For example, an identifier can be recorded in Redis to indicate that the information to be consumed has been consumed, or a node can be created in the Zookeeper component to indicate that the information to be consumed has been processed. If duplicate information to be consumed is sent, the node that created the Zookeeper component will automatically report an error to avoid consuming the same information to be consumed repeatedly.
[0066] Of course, a second database can also be set up on one side of the second terminal for data storage.
[0067] It is easy to understand that this application, by recording an identifier, only needs to register a listener to monitor whether the information to be consumed has been consumed, thereby optimizing system performance.
[0068] S305. The sequence indication information is parsed to obtain a unique identifier for the sequence to be consumed information.
[0069] Here, "sequence pending consumption information" refers to the information that is sorted and awaiting consumption in the prepared information queue. It can be understood that sequence pending consumption information is the same as the information to be consumed, both having corresponding confirmation information and a unique identification number for identification. Specifically, after receiving the sequence indication information, the sending terminal parses the sequence indication information to obtain the unique identifier of the sequence pending consumption information, which is also the unique identifier of the next piece of information to be consumed.
[0070] S306. Send confirmation information corresponding to the unique identifier to the RocketMQ service component, so that the RocketMQ service component can obtain the sequence to be consumed information corresponding to the unique identifier from the preparatory information queue, and release the sequence to be consumed information to the second target terminal for consumption.
[0071] Specifically, the first target terminal and the second target terminal can be the same terminal or different terminals. Furthermore, the information to be consumed and the sequence information to be consumed can be sent to the preparation information queue of the Zookeeper component by the same sending terminal for caching, or they can be sent to the preparation information queue of the Zookeeper component by different sending terminals for caching.
[0072] It is worth mentioning that two scenarios can be achieved through steps S304 to S306, as detailed below:
[0073] Scenario 1: Suppose there are three tasks, A, B, and C, that need to consume information. Task B needs to wait for task A to complete before it can execute, and task C needs to wait for task B to complete before it can execute. In this case, task A sends a sequence indication message to task B after it finishes executing. Task B then executes sequentially after receiving the sequence indication message. Task C executes in a similar manner, that is, task C executes after receiving the sequence indication message returned by task B. This scenario enables communication between multiple tasks and ensures that the states of multiple tasks are interconnected.
[0074] Scenario 2: Many business operations involve mutual callbacks between related parties. After the other party's system completes its processing, our system only needs to listen to this specific type of topic and then perform its own program processing. This eliminates the need to add interfaces and modify the gateway every time a new function is added, which is beneficial for decoupling and expansion between systems, such as between user systems and SMS systems, or between payment gateways and processing systems.
[0075] For example, payment gateways need to integrate payment functions, such as WeChat or Alipay, which typically notify the system of the payment result via callback.
[0076] At this point, this application can isolate the payment gateway and use MQ to notify its own business system for processing.
[0077] Suppose we set up an points system. When a user makes a successful payment, points are added to the user's account. At this point, the points system only needs to listen to this message topic and process the points. There is no need to modify the gateway layer code.
[0078] It is worth noting that this application can also set forwarding rules for the aforementioned push information and payment results to ensure that each interested queue can obtain the push information and payment results.
[0079] In some embodiments, to ensure a valid connection between the sending terminal and the RocketMQ service component, the following steps can be used to determine the validity of the connection:
[0080] Receive node return information from the service provider node of the connected RocketMQ service component; determine whether the time interval between receiving two adjacent node return information exceeds a preset duration; if the time interval between receiving two adjacent node return information exceeds the preset duration, select another service provider node of the RocketMQ service component to establish a connection.
[0081] The available node set includes the node identity information and connection establishment information of all available RocketMQ service component service provider nodes in the cluster, and the available node set is pre-stored locally on the MQ client.
[0082] Furthermore, this application can also automate the deployment of RocketMQ service components: First, a service installation package is created, including installation files for components used or dependent on in the service, as well as scripts and configuration files related to the installation, initialization, startup, stop, restart, update, scaling, and monitoring of these components. During the definition of the service installation package, shell and Freemarker languages are used for customization. Basic service information is defined on the service management platform. Service specifications are defined, specifying the size of the service cluster, the roles of nodes in the cluster, and node configuration information. Users create corresponding virtual machine clusters using these specifications as templates when applying for service instances. Multiple specifications are defined for the same service to meet the needs of different service application scenarios. If the configured basic service information needs to be modified, the published status is changed to a recall status, then edited, and the service information is republished. Service instance installation is performed on the service management platform. Users select the service specifications and access network when creating an instance, and can delete instances at any time during the creation process. After the service instance starts, users can choose to start, stop, or manage it.
[0083] This embodiment provides an information processing method that generates information to be consumed, a corresponding confirmation message, and a unique identifier for identifying the information to be consumed and the confirmation message. The method then sends the information to be consumed and the corresponding unique identifier to a preparatory information queue for caching. Next, it sends the confirmation message corresponding to the unique identifier to a RocketMQ service component, causing the RocketMQ service component to release the cached information to be consumed to a first target terminal for consumption. Subsequently, it obtains the sequence indication information returned when the information to be consumed is released; parses the sequence indication information to obtain the unique identifier of another piece of information to be consumed; finally, it sends the confirmation message corresponding to the unique identifier to the RocketMQ service component, causing the RocketMQ service component to retrieve the information to be consumed from the preparatory information queue and release it to a second target terminal for consumption. By using RocketMQ for system communication and employing a globally unique identifier, it ensures that duplicate IDs will never cause message sending failures, enabling communication between multiple tasks and guaranteeing interoperability of task states.
[0084] Please refer to Figure 4 , Figure 4 An embodiment of this application also provides a schematic block diagram of a terminal used to perform the aforementioned information processing method. This terminal can be configured in a server or a terminal.
[0085] The server can be a standalone server or a server cluster. The terminal can be an electronic device such as a mobile phone, tablet, laptop, desktop computer, personal digital assistant, and wearable device.
[0086] like Figure 4 As shown, terminal 400 includes: information generation module 401, information sending module 402, and confirmation sending module 403.
[0087] The information generation module 401 is used to generate consumption information, confirmation information corresponding to the consumption information, and a unique identification number for identifying the consumption information and the confirmation information.
[0088] The information sending module 402 is used to send the information to be consumed and the corresponding unique identification number to the preparatory information queue for caching.
[0089] The confirmation sending module 403 is used to send the confirmation information with the unique identification number to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the preparation information queue to the first target terminal for consumption.
[0090] Please refer to Figure 5 , Figure 5 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device may be a server or a terminal.
[0091] See Figure 5 The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0092] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any information processing method.
[0093] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0094] Internal memory provides an environment for the execution of computer programs stored in non-volatile storage media. When these computer programs are executed by a processor, the processor can perform any information processing method.
[0095] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0096] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0097] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps:
[0098] Generate information to be consumed, confirmation information corresponding to the information to be consumed, and a unique identifier for identifying the information to be consumed and the confirmation information; send the information to be consumed and the corresponding unique identifier to a preparatory information queue for caching; send the confirmation information corresponding to the unique identifier to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identifier in the preparatory information queue to the first target terminal for consumption.
[0099] In one embodiment, after the RocketMQ service component releases the information to be consumed corresponding to the unique identifier in the preparatory information queue to the first target terminal for consumption, the processor is further configured to:
[0100] Obtain the sequence indication information returned when the information to be consumed is released; parse the sequence indication information to obtain the unique identifier of the information to be consumed; send the confirmation information corresponding to the unique identifier to the RocketMQ service component, so that the RocketMQ service component can obtain the information to be consumed corresponding to the unique identifier from the prepared information queue, and release the information to be consumed to the second target terminal for consumption.
[0101] In one embodiment, when the processor generates a unique identifier for identifying the information to be consumed and the confirmation information, it performs the following:
[0102] A distributed lock is used to generate a unique identifier for identifying the information to be consumed and the confirmation information.
[0103] In one embodiment, when the processor generates a unique identifier for identifying the information to be consumed and the confirmation information, it performs the following:
[0104] The information to be consumed and the corresponding unique identification number are sent to the preparation information queue for caching, and the countdown for sending the confirmation information is started.
[0105] When the processor sends an acknowledgment message containing the unique identifier to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identifier in the preparatory information queue to the first target terminal for consumption, it is configured to:
[0106] After the countdown for sending the confirmation message ends, a confirmation message with the unique identification number is sent to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the prepared information queue to the first target terminal for consumption.
[0107] In one embodiment, after sending the information to be consumed and the corresponding unique identifier to a preparatory information queue for caching, the processor is further configured to:
[0108] Set the lifespan of the information to be consumed; if the information to be consumed is not consumed within the lifespan, then forward the information to other prepared information queues.
[0109] In one embodiment, after the processor implements sending the confirmation information corresponding to the unique identifier to the RocketMQ service component, it is further configured to implement:
[0110] Receive node return information from the service provider node of the connected RocketMQ service component; determine whether the time interval between two consecutive node return information received exceeds a preset duration; if the time interval between two consecutive node return information received exceeds the preset duration, select another service provider node of the RocketMQ service component to establish a connection.
[0111] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the information processing methods provided in the embodiments of this application.
[0112] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0113] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An information processing method, characterized in that, Applied to a transmitting terminal, the method includes: Generate information to be consumed, confirmation information corresponding to the information to be consumed, and generate a unique identifier for identifying the information to be consumed and the confirmation information using a distributed lock; The information to be consumed and the corresponding unique identifier are sent to a preparation information queue for caching. The preparation information queue is the preparation information queue of the Zookeeper component. Send the confirmation information corresponding to the unique identifier to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identifier in the preparation information queue to the first target terminal for consumption, wherein the first target terminal and the sending terminal are idempotent; Obtain the sequence indication information returned when the information to be consumed is released; The sequence indication information is parsed to obtain the unique identification number of the sequence information to be consumed. The sequence information to be consumed refers to the information to be consumed that is sorted in the preparatory information queue and is waiting to be consumed. The unique identification number of the sequence information to be consumed is the unique identifier of the next information to be consumed. Send an acknowledgment message corresponding to the unique identifier of the next message to be consumed to the RocketMQ service component, so that the RocketMQ service component can retrieve the sequence of messages to be consumed corresponding to the unique identifier from the prepared information queue, and release the sequence of messages to be consumed to the second target terminal for consumption.
2. The information processing method according to claim 1, characterized in that, The step involves sending the information to be consumed and the corresponding unique identifier to a pre-set information queue for caching. include, The information to be consumed and the corresponding unique identification number are sent to the preparation information queue for caching, and the countdown for sending the confirmation information is started. Sending an acknowledgment message containing the unique identifier to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identifier from the prepared information queue to the first target terminal for consumption, including: After the countdown for sending the confirmation message ends, a confirmation message with the unique identification number is sent to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the prepared information queue to the first target terminal for consumption.
3. The information processing method according to claim 1, characterized in that, After sending the information to be consumed and the corresponding unique identifier to the preparatory information queue for caching, the method further includes: Set the lifespan of the information to be consumed; If the information to be consumed is not consumed within the specified lifespan, the information to be consumed will be forwarded to other prepared information queues.
4. The information processing method according to claim 1, characterized in that, After sending the confirmation information corresponding to the unique identifier to the RocketMQ service component, the process further includes: Receive node return information from the service provider node of the connected RocketMQ service component; Determine whether the time interval between receiving two consecutive return messages from the node exceeds a preset duration; If the time interval between two consecutive returns from the node exceeds a preset duration, then another service provider node of the RocketMQ service component is selected to establish a connection.
5. A terminal, characterized in that, The terminal includes: The information generation module is used to generate information to be consumed, confirmation information corresponding to the information to be consumed, and to generate a unique identification number using a distributed lock to identify the information to be consumed and the confirmation information. The information sending module is used to send the information to be consumed and the corresponding unique identification number to the preparation information queue for caching. The preparation information queue is the preparation information queue of the Zookeeper component. The confirmation sending module is used to send the confirmation information with the unique identification number to the RocketMQ service component, so that the RocketMQ service component releases the information to be consumed corresponding to the unique identification number in the preparation information queue to the first target terminal for consumption, wherein the first target terminal and the terminal are idempotent; The information sending module is also used to obtain the sequence indication information returned when the information to be consumed is released; The information generation module is further configured to parse the sequence indication information to obtain a unique identifier for the sequence information to be consumed. The sequence information to be consumed refers to the information to be consumed that is sorted and waiting to be consumed in the preparatory information queue. The unique identifier for the sequence information to be consumed is the unique identifier for the next information to be consumed. The confirmation sending module is further configured to send confirmation information corresponding to the unique identifier of the next information to be consumed to the RocketMQ service component, so that the RocketMQ service component can obtain the sequence of information to be consumed corresponding to the unique identifier from the preparatory information queue and release the sequence of information to be consumed to the second target terminal for consumption.
6. An information processing system, characterized in that, The information processing system includes a RocketMQ service component and several terminals as described in claim 5.
7. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, in executing the computer program, implement the information processing method as described in any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the information processing method as described in any one of claims 1 to 4.