Application and message queue high-availability connection service system, method, device and medium

By designing a high-availability connection service system between applications and message queues, redundant communication links between multiple applications are realized, which solves the shortcomings of connection recovery between applications and message queues in the existing system, and significantly improves the robustness and fault tolerance of the system. ability.

CN118796515BActive Publication Date: 2025-01-21江西裕民银行股份有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411262276.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-01-21
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

Existing systems have flaws in connection and recovery between applications and message queues (MQ), resulting in application startup and operation failures, message delivery efficiency is affected by a single point of failure, and system reliability and message delivery accuracy are affected.

Method used

By designing a high-availability connection service system between applications and message queues, direct and redundant communication links between multiple applications are realized, eliminating the risk of disconnection between message queues and applications, and ensuring data transmission when a single point of failure occurs. Seamless connection with processing power.

Benefits of technology

It significantly improves the robustness and fault tolerance of the system, ensures that business continuity is not affected by a single point of failure, and improves the timeliness of message delivery and the overall reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796515B_ABST
    Figure CN118796515B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of message transmission between applications, and specifically to a high-availability connection service system, method, device and medium between an application and a message queue. The system includes: application A, a message queue of application A, application C and a message queue of application C, wherein the message queue of application A includes a first local queue and a first remote queue, and the message queue of application C includes a second local queue and a second remote queue; wherein the first local queue is used to send messages to application A, and the first remote queue is used to receive messages from application A and transmit the messages to the second local queue of the message queue of application C; application B and a message queue of application B are also included; the message queue of application B also includes a third local queue and a third remote queue; messages in the first local queue can be directly transmitted to application B for consumption, and messages in the third local queue can also be directly transmitted to application A for consumption. The system stability and message transmission timeliness are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of inter-application message transmission, and in particular to a high-availability connection service system, method, device and medium between an application and a message queue. Background Art

[0002] The current system's message queue (MQ) high availability solution mainly focuses on the reconnection mechanism between middleware components. This reconnection mechanism fails to cover the connection and recovery between the application and the message queue (MQ), resulting in a key defect: the strong coupling relationship between the application and the message queue (MQ) means that once the message queue (MQ) connection fails, the application startup and operation cannot proceed normally. For example, when the application connects to two message queues (MQ), one message queue (MQ) hangs up. Due to the strong coupling relationship, the application will fail to start. The efficiency of message delivery is easily affected by single point failures, which in turn affects the reliability of the entire system. For example, when the message queue (MQ) channel or application does not respond in time, it will cause the current message queue (MQ) messages to accumulate. In addition, the existing system lacks an effective detection mechanism and cannot determine the availability of the message queue (MQ) channel in a timely manner, which directly affects the accuracy and reliability of message delivery. Summary of the invention

[0003] Based on the problems mentioned in the above background technology, the present disclosure provides a high-availability connection service system, method, device and medium between an application and a message queue, which can significantly improve system stability and message delivery timeliness. To solve the above technical problems, the present disclosure provides the following technical solutions:

[0004] As one aspect of an embodiment of the present disclosure, a high-availability connection service system for applications and message queues is provided, which is used to implement communication between multiple applications, including: application A, a message queue of application A, application C, and a message queue of application C, wherein the message queue of application A includes a first local queue and a first remote queue, and the message queue of application C includes a second local queue and a second remote queue;

[0005] The first local queue is used to send messages to application A, the first remote queue is used to receive messages from application A and pass the messages to the second local queue of the message queue of application C; the second local queue is used to receive messages passed from the first remote queue of application A and pass the messages to application C for consumption; and the second remote queue is used to receive messages sent by application C and pass the messages to the first local queue, and the first local queue passes the messages to application A for consumption;

[0006] Also included is application B and a message queue of application B; the message queue of application B includes a third local queue and a third remote queue;

[0007] Among them, the messages in the first local queue can be directly delivered to application B for consumption, and the messages in the third local queue can also be directly delivered to application A for consumption.

[0008] Optionally, application A or application B can also pass the message to the second local queue through the third remote queue and then pass it to application C for consumption;

[0009] Also included is an application D and a message queue of the application D; the message queue of the application D includes a fourth local queue and a fourth remote queue;

[0010] Among them, the messages in the second local queue can be directly delivered to application D for consumption, and the messages in the fourth local queue can also be directly delivered to application C for consumption.

[0011] Optionally, application B can also pass the message to the second local queue through the first remote queue and then pass it to application C for consumption.

[0012] Optionally, application C can pass the message to the first local queue or the third local queue through the fourth remote queue and then pass it to application A or application B for consumption.

[0013] Optionally, application D can also pass the message to the first local queue or the third local queue through the fourth remote queue and then pass it to application A or application B for consumption.

[0014] As another aspect of the embodiment of the present disclosure, a high-availability connection service method between applications and message queues is also provided, which is used to implement communication between multiple applications. Using the high-availability connection service system between applications and message queues includes the following steps:

[0015] Obtaining an available line, wherein the available line is a sending line that is periodically marked as available by a detection message sending process;

[0016] Send messages based on available lines;

[0017] Determine whether the message is sent successfully; if the message is not sent successfully, mark the available line as unavailable and send a text message alarm.

[0018] Optionally, the detection message sending process includes:

[0019] Start the thread daemon task of the sending line;

[0020] Start fixed-time timing detection;

[0021] Get the sending line that needs to be detected;

[0022] Send a detection message to the sending line that needs to be detected;

[0023] Determine whether the detection message is sent successfully. If the detection message is sent successfully, update the sending line to an available line, modify the success timestamp, and wait for the next round of detection to start; if the detection message fails to be sent, mark the detection sending line as unavailable, close the message queue connection of the sending line, wait for a fixed time, and recreate the next round of detection process.

[0024] Optionally, obtaining a sending line to be detected includes:

[0025] Get the index value of the last sent line, and then get the next sent line by adding one to the index value.

[0026] As another aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the application and message queue high-availability connection service method when executing the computer program.

[0027] As another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method for high-availability connection service between application and message queue are implemented.

[0028] Compared with the prior art, the present invention realizes a direct and redundant communication link between each application and each message queue (MQ) through complex cross-connections between multiple applications (Apps) and multiple message queues (MQs); solves the problem of message queues (MQ) being only connection points, while eliminating the risk of disconnection between message queues (MQ) and applications; ensures that even when a single point of failure occurs, the data transmission and processing capabilities between the application and the message queue (MQ) can still be seamlessly connected, thereby significantly improving the robustness and fault tolerance of the entire system; strengthens the stability of the system and ensures that business continuity is not affected by a single point of failure. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A framework diagram of a high-availability connection service system between an application and a message queue in an embodiment of the present disclosure;

[0030] Figure 2 This is a flowchart of sending a message in Embodiment 2 of the present disclosure;

[0031] Figure 3 This is a flowchart of the detection message in Embodiment 2 of the present disclosure. DETAILED DESCRIPTION

[0032] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0033] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0034] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the specific embodiments below. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some embodiments, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0035] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not go into details.

[0036] Example 1

[0037] The disclosed embodiment further provides a high-availability connection service system between applications and message queues for communication between multiple applications, such as Figure 1 As shown, it includes: application A and application C, the message queue of application A includes a first local queue and a first remote queue, and the message queue of application C includes a second local queue and a second remote queue;

[0038] The first local queue is used to send messages to application A, the first remote queue is used to receive messages from application A and pass the messages to the second local queue of the message queue of application C; the second local queue is used to receive messages passed from the first remote queue of application A and pass the messages to application C for consumption; and the second remote queue is used to receive messages sent by application C and pass the messages to the first local queue, and the first local queue passes the messages to application A for consumption;

[0039] It also includes application B and a message queue of application B; the message queue of application B also includes a third local queue and a third remote queue;

[0040] Among them, the messages in the first local queue can be directly delivered to application B for consumption, and the messages in the third local queue can also be directly delivered to application A for consumption;

[0041] Also includes application D and a message queue of application D; the message queue of application D also includes a fourth local queue and a fourth remote queue;

[0042] Among them, the messages in the second local queue can be directly delivered to application D for consumption, and the messages in the fourth local queue can also be directly delivered to application C for consumption.

[0043] Based on the above configuration, the application and message queue high-availability connection service system in the embodiment of the present disclosure does not have a close dependency relationship between the application and the message queue. Even if a problem occurs in a message queue, it will not cause the application to be unable to restart or the system to fail, thereby realizing a direct and redundant communication link between each application and each message queue (MQ); solving the problem of message queues (MQ) being only connection points, and eliminating the possible risk of disconnection between message queues (MQ) and applications; ensuring that even when a single point of failure occurs, the data transmission and processing capabilities between the application and the message queue (MQ) can still be seamlessly connected.

[0044] In order to achieve loose coupling of the above systems, the above applications are required to include the response identifier, the node information of the receiver and the sender; the message queue (MQ) is responsible for managing the IP address, port number, the name of the multi-party queue manager, the settings of the local queue and the remote queue, and the configuration of the sending channel, etc.

[0045] As a preferred implementation, application A or application B can also pass the message to the second local queue through the third remote queue and then pass it to application C for consumption.

[0046] As a preferred implementation, application B can also pass the message to the second local queue through the first remote queue and then pass it to application C for consumption.

[0047] As a preferred implementation, application C can pass the message to the first local queue or the third local queue through the fourth remote queue and then pass it to application A or application B for consumption.

[0048] As a preferred implementation, application D can also pass the message to the first local queue or the third local queue through the fourth remote queue and then pass it to application A or application B for consumption.

[0049] The above implementation achieves loose coupling through complex cross-connections between multiple applications (Apps) and multiple message queues (MQs), significantly improving the robustness and fault tolerance of the entire system. By implementing such an architecture, the stability of the system is enhanced.

[0050] Example 2

[0051] The disclosed embodiment also provides a high-availability connection service method between an application and a message queue, such as Figure 2As shown, for realizing communication between multiple applications, the application and message queue high-availability connection service system in Example 1 is used, including the following steps:

[0052] Obtaining an available line, wherein the available line is a sending line that is periodically marked as available by a detection message sending process;

[0053] Send messages based on available lines;

[0054] Determine whether the message is sent successfully; if the message is not sent successfully, mark the available line as unavailable and send a text message alarm.

[0055] The health status of the available lines is determined again. If available, the current line is used for sending. If unavailable, the next available line is selected cyclically. According to the remote queues corresponding to the available lines and whether the transactions belong to real-time or batch services, different types of remote queues are used for sending. If all queues are unavailable, a text message alert is triggered to the relevant personnel, and an exception is thrown, indicating that the message sending failed. The health status is determined by sending a detection message and expecting to receive a detection response within 1-3 seconds, otherwise the available line is considered unavailable.

[0056] As a preferred implementation, the detection message sending process is as follows: Figure 3 As shown, including:

[0057] Start the thread daemon task of the sending line; check whether the thread daemon task is interrupted by notification. If not, proceed to the next step. If interrupted, end the detection message process.

[0058] Enable fixed-time detection; the fixed time is generally set to about 8-15 seconds, preferably 10 seconds. You can choose a suitable fixed-time detection time based on the system hardware and software resources.

[0059] Get the sending line that needs to be detected;

[0060] Send a detection message to the sending line that needs to be detected;

[0061] Determine whether the detection message is sent successfully. If the detection message is sent successfully, the sending line is updated to an available line, the success timestamp is modified, and the next round of detection is started. If the detection message fails to be sent, the detected sending line is marked as unavailable in the cache, a text message alarm is sent, and the message queue connection of the sending line is closed. After waiting for a fixed time, the next round of detection process is re-created. Among them, the judgment method for the failure of the detection message to be sent is that the detection message is not received after a timeout.

[0062] The above detection message mechanism is a periodic detection mechanism that can comprehensively check the availability of all channels. By promptly identifying and resolving channel availability issues, this process effectively avoids message sending failures due to unnoticed channel status changes. This proactive monitoring strategy significantly improves system availability and stability.

[0063] In the process of sending a probe message, you can measure the time it takes to receive a response to determine if there is a response timeout. If multiple response messages are received, there is no need to match them one by one with a specific probe message; as long as a response is received, it is sufficient to prove that the channel is in normal working condition.

[0064] The composition of the probe message includes the following key information: the name of the server that originated the message, the name of the queue manager, and the name of the sending channel. Correspondingly, the reply message also contains this information to ensure that the correspondence is clear. When any server receives a probe response message, it will update the timestamp and status of the received message according to the configuration of the sending message.

[0065] As a preferred implementation, obtaining the transmission line to be detected includes:

[0066] Get the index value of the last transmission line, and then get the next transmission line by adding 1 to the index value. The transmission line is defined in advance.

[0067] The above message sending process is a loop traversal mechanism, which ensures that the selected channel is different each time, so as to evenly distribute traffic to all normally operating channels. This strategy not only ensures the availability of the selected channel, but also significantly improves the stability of message sending.

[0068] Example 3

[0069] An embodiment of the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the application and message queue high-availability connection service method in Embodiment 2 when executing the computer program.

[0070] The electronic device in the embodiment of the present disclosure is merely an example and can be used to implement the functions of a host computer or a light curtain controller, and should not bring any limitation to the functions and scope of use of the embodiment of the present disclosure.

[0071] The electronic device may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device may include, but are not limited to: at least one processor, at least one memory, and a bus connecting different system components (including the memory and the processor).

[0072] The bus includes data bus, address bus and control bus.

[0073] The memory may include volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read-only memory (ROM).

[0074] The memory may also include a program tool having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.

[0075] The processor executes various functional applications and data processing by running computer programs stored in the memory.

[0076] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, etc.). Such communication may be performed through an input / output (I / O) interface. In addition, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.

[0077] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.

[0078] Example 4

[0079] An embodiment of the present disclosure provides a computer-readable storage medium, which stores a computer program. When the program is executed by a processor, the steps of the application and message queue high-availability connection service method in the above-mentioned embodiment 2 are implemented.

[0080] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0081] In a possible implementation, the present disclosure can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the application and message queue high-availability connection service method described in Example 2.

[0082] Among them, the program code for executing the present disclosure can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.

[0083] The above is only a preferred specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A high-availability connection service system for applications and message queues, used to implement communication between multiple applications, characterized in that: include: Application A, its message queue, application C, and its message queue. Application A's message queue includes a first local queue and a first remote queue, and application C's message queue includes a second local queue and a second remote queue. The first local queue is used to send messages to application A, the first remote queue is used to receive messages from application A and pass the messages to the second local queue of the message queue of application C; the second local queue is used to receive messages passed from the first remote queue of application A and pass the messages to application C for consumption; and the second remote queue is used to receive messages sent by application C and pass the messages to the first local queue, and the first local queue passes the messages to application A for consumption; Also included is application B and a message queue of application B; the message queue of application B includes a third local queue and a third remote queue; Among them, the messages in the first local queue can be directly delivered to application B for consumption, and the messages in the third local queue can also be directly delivered to application A for consumption; Also included is an application D and a message queue of the application D; the message queue of the application D includes a fourth local queue and a fourth remote queue; Among them, the messages in the second local queue can be directly delivered to application D for consumption, and the messages in the fourth local queue can also be directly delivered to application C for consumption.

2. The application and message queue high-availability connection service system according to claim 1, characterized in that: Application A or application B can also pass the message to the second local queue through the third remote queue and then pass it to application C for consumption.

3. The application and message queue high-availability connection service system according to claim 1, characterized in that: Application B can also pass messages through the first remote queue to the second local queue and then pass them to application C for consumption.

4. The application and message queue high-availability connection service system according to claim 1, characterized in that: Application C can pass the message to the first local queue or the third local queue through the fourth remote queue and then pass it to application A or application B for consumption.

5. The application and message queue high-availability connection service system according to claim 1 or 4, characterized in that: Application D can also pass the message to the first local queue or the third local queue through the fourth remote queue and then pass it to application A or application B for consumption.

6. A high-availability connection service method between an application and a message queue, used to realize communication between multiple applications, characterized in that: Using the application and message queue high-availability connection service system as described in any one of claims 1 to 5 comprises the following steps: Obtaining an available line, wherein the available line is a sending line that is periodically marked as available by a detection message sending process; Send messages based on available lines; Determine whether the message is sent successfully; if the message is not sent successfully, mark the available line as unavailable and send a text message alarm.

7. The application and message queue high-availability connection service method according to claim 6, characterized in that: The detection message sending process includes: Start the thread daemon task of the sending line; Start fixed-time timing detection; Get the sending line that needs to be detected; Send a detection message to the sending line that needs to be detected; Determine whether the detection message is sent successfully. If the detection message is sent successfully, update the sending line to an available line, modify the success timestamp, and wait for the next round of detection to start; if the detection message fails to be sent, mark the detection sending line as unavailable, close the message queue connection of the sending line, wait for a fixed time, and recreate the next round of detection process.

8. The application and message queue high-availability connection service method according to claim 7, characterized in that: Obtaining the sending lines that need to be detected includes: Get the index value of the last sent line, and then get the next sent line by adding one to the index value.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the application and message queue high-availability connection service method described in any one of claims 6 to 8 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the application and message queue high-availability connection service method described in any one of claims 6 to 8 are implemented.

Citation Information

Patent Citations

  • Message queue implementation method and system, storage medium and electronic equipment

    CN109684108A

  • Message queue switching method and device, electronic equipment and storage medium

    CN112015563A