Message processing methods, apparatus, and electronic devices based on message queues

By using a pre-defined message queue and Redis's publish/subscribe mechanism, the problem of high latency and low efficiency in message delivery results is solved, enabling efficient and low-latency acquisition of message delivery results and improving system processing efficiency.

CN116244097BActive Publication Date: 2025-11-11INDUSTRIAL AND COMMERCIAL BANK OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310185327.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2025-11-11
Estimated Expiration
2043-02-24

AI Technical Summary

Technical Problem

In existing technologies, the latency of obtaining message delivery results is high and the efficiency is low. Active querying affects system performance, passive notification increases the difficulty of system development, and the capabilities of the message queue itself need to be replaced or redeveloped.

Method used

The delivery message is sent to the second type of application through a preset message queue. The second type of application processes the message and writes it to the receipt database, and publishes a delivery success message. The first type of application listens for and obtains the delivery success message, retrieves the delivery result from the receipt database, and uses Redis's subscription/publish mechanism to implement message notification.

Benefits of technology

It improves the efficiency of obtaining message delivery results, reduces latency, avoids the shortcomings of HTTP/HTTPS protocols, and lowers the learning and adaptation costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116244097B_ABST
    Figure CN116244097B_ABST
Patent Text Reader

Abstract

This invention discloses a message processing method, apparatus, and electronic device based on a message queue, relating to the fintech field or other related fields. The message processing method includes: sending a delivery message to a second type of application using a preset message queue; the second type of application processing the delivery message, obtaining a delivery result, and writing the delivery result to a receipt database; upon successful writing of the delivery result to the receipt database, publishing a delivery success message to a preset database; monitoring the preset database; and upon detecting a delivery success message of a preset type in the preset database, obtaining the delivery success message; and based on the delivery success message, retrieving the delivery result from the receipt database. This invention solves the technical problems of high latency and low efficiency in retrieving message delivery results in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial technology, and more specifically, to a message processing method, apparatus, and electronic device based on a message queue. Background Technology

[0002] In various application systems, message middleware is generally one of the essential basic components of the system. Message middleware has the following functions: (1) Application decoupling: The strongest coupling relationship between applications is generally code coupling, that is, application A introduces the code of application B. When application B is updated, application A must also be updated and redeployed. After the introduction of message middleware, applications communicate by sending messages. Only the message middleware is strongly coupled with each application. When either application on the two sides of the message middleware is updated, it has no impact on the other application; (2) Traffic peak shaving and valley filling: When the frequency of message sending between applications changes too much, it is easy to cause the performance of the receiver to be unstable. Severe fluctuations in CPU (processor), memory usage and disk I / O (input and output) can easily cause the system to crash and restart unexpectedly. After the introduction of message queues, message queues can reduce the message delivery frequency during peak message sending periods and increase the message delivery frequency during off-peak message sending periods, so that the various operating indicators of the receiver are relatively stable; (3) Eventual consistency: At present, distributed systems cannot simultaneously satisfy CAP (i.e., consistency, partition tolerance, and availability), and generally can only satisfy BASE (i.e., basically available, soft state, and eventual consistency), where E refers to "eventual consistency", that is, the nodes of the distributed system will eventually achieve data consistency at a certain time. This characteristic can be obtained through message queue middleware. After the nodes of the distributed system have consumed the messages, they achieve data consistency. Even if the nodes restart due to abnormalities or failures, the messages will not be lost due to the existence of message queue middleware, and they can continue to be consumed, so eventual consistency can be achieved.

[0003] In related technologies, when an upstream application sends messages to a downstream application through a message middleware, asynchronous messages are generally sent to ensure message delivery efficiency. If some messages are very important, the sender must know the consumer's processing result. To ensure the sender knows that the receiver has correctly consumed the message, the following three methods are often used:

[0004] (1) Active query method: After the upstream application sends a message to the downstream application through the message queue, after a period of time, the upstream application starts a scheduled task to call the query interface of the downstream application to obtain the consumption result of the message.

[0005] Figure 1 This is a schematic diagram illustrating one possible active query method based on relevant technologies, such as... Figure 1 As shown, the upstream application sends messages to the downstream application through a message queue, and the upstream application starts a scheduled task to obtain the consumption result of the message through the forward broker of the downstream application.

[0006] (2) Passive notification method: After the upstream application sends a message to the downstream application through the message queue, the downstream application actively notifies the upstream application of the consumption result after consuming the message.

[0007] Figure 2 This is a schematic diagram of an optional passive notification method based on related technologies, such as... Figure 2 As shown, the upstream application sends messages to the downstream application through a message queue. After consuming the message, the downstream application actively sends a message notification, sending the consumption result to the forward proxy of the upstream application.

[0008] (3) Message queue capabilities: Some message queue middleware (such as RabbitMQ) has the ability to store message consumption receipts and can notify upstream applications to obtain message consumption information.

[0009] However, the above three methods have the following drawbacks:

[0010] (1) For the active query method: Scheduled tasks have a certain delay, which makes it impossible for upstream applications to know the message consumption status in a timely and accurate manner. When scheduled tasks are started too frequently, it will affect the performance of the application system. At the same time, downstream applications are often composed of node clusters. Scheduled tasks cannot know which node consumed the message. They can only send the request to the proxy gateway of the downstream application, and the proxy gateway will distribute the request. Unrelated nodes will also receive the message, resulting in a waste of network resources.

[0011] (2) For passive notification methods: Since message notifications generally use HTTP (Hypertext Transfer Protocol) / HTTPS (Hypertext Transfer Protocol Secure) protocols, additional data signing and encryption mechanisms are required to ensure the reliability and confidentiality of message data, increasing the difficulty of system development. Furthermore, because HTTP / HTTPS transmission is not guaranteed, the system must design message retransmission mechanisms and idempotent designs to cope with message loss or retransmission caused by network fluctuations.

[0012] (3) Regarding the capabilities of the message queue itself: This effect can only be obtained by using a certain type of message middleware (such as RabbitMQ). When using message middleware such as Kafka, RocketMQ or ActiveMQ, secondary development or replacement of the middleware that has been used for a long time is required to obtain this capability. The learning cost and adaptation cost are relatively large.

[0013] There is currently no effective solution to the above problems. Summary of the Invention

[0014] This invention provides a message processing method, apparatus, and electronic device based on a message queue, to at least solve the technical problems of high latency and low efficiency in obtaining message delivery results in related technologies.

[0015] According to one aspect of the present invention, a message processing method based on a message queue is provided, applied to a client of a first type of application, wherein the first type of application deploys a preset database, comprising: sending a delivery message to a second type of application using a preset message queue, wherein the second type of application deploys the preset database, the second type of application processes the delivery message, obtains a delivery result, and writes the delivery result to a receipt database; if the delivery result is successfully written to the receipt database, publishing a delivery success message to the preset database; monitoring the preset database, and if a delivery success message of a preset type is detected in the preset database, obtaining the delivery success message; and retrieving the delivery result from the receipt database based on the delivery success message.

[0016] Optionally, before sending a delivery message to the second type of application using a preset message queue, the method further includes: constructing a subscription channel between the first type of application and the preset database; subscribing to all messages of the preset type based on the subscription channel; and obtaining messages of the preset type when the preset database is detected to have messages of the preset type.

[0017] Optionally, the step of subscribing to all messages of the preset type based on the subscription channel includes: assigning a corresponding channel parameter to each message type to obtain an allocation result, wherein the channel indicated by the channel parameter receives messages of the corresponding message type; determining a target channel parameter corresponding to the preset type based on the allocation result; and controlling the first type of application to subscribe to the target channel indicated by the target channel parameter to complete the first type of application's subscription to messages of the preset type.

[0018] Optionally, the delivery success message includes a message identifier. The step of obtaining the delivery result from the receipt database based on the delivery success message includes: querying the receipt database for a delivery result identifier that matches the message identifier; and obtaining the delivery result indicated by the delivery result identifier.

[0019] Optionally, after obtaining the delivery result from the receipt database based on the delivery success message, the method further includes: pushing a sending success message to a preset browser based on a preset protocol, wherein the preset browser is used to display the sending success message, and the sending success message includes an identifier that the delivery message has been successfully sent; and storing the delivery result in a storage database.

[0020] Optionally, after obtaining the delivery result from the receipt database based on the delivery success message, the method further includes: sending the delivery result to the application to be executed, wherein the application to be executed is in a blocked state after the first type of application sends the delivery message, and the blocked state is implemented by a blocked thread; when the application to be executed receives the delivery result, the blocked thread is released, and the application to be executed is controlled to start working.

[0021] According to another aspect of the present invention, a message processing method based on a message queue is also provided, applied to a client of a second type of application, the second type of application having a preset database deployed thereon, comprising: receiving a delivery message transmitted by a first type of application based on a preset message queue, wherein the preset message queue is used to asynchronously transmit the received delivery message to the second type of application, the first type of application having the preset database deployed thereon; processing the delivery message to obtain a delivery result; if the delivery result is successfully written to a receipt database, publishing a delivery success message to the preset database, wherein the delivery success message includes at least a message type; if the message type is a preset type, transmitting the delivery success message to the first type of application through the preset database, wherein the first type of application obtains the delivery result from the receipt database based on the delivery success message.

[0022] Optionally, after processing the delivery message and obtaining the delivery result, the method further includes: writing the delivery result to the receipt database, wherein the delivery result includes at least: processing result data.

[0023] According to another aspect of the present invention, a message processing apparatus based on a message queue is also provided, applied in a client of a first type of application, the first type of application deploying a preset database, comprising: a sending unit, configured to send a delivery message to a second type of application using a preset message queue, wherein the second type of application deploys the preset database, the second type of application is configured to process the delivery message, obtain a delivery result, and write the delivery result to a receipt database, and, if the delivery result is successfully written to the receipt database, publish a delivery success message to the preset database; a listening unit, configured to listen to the preset database, and, if the preset database detects a delivery success message of a preset type, obtain the delivery success message; and an obtaining unit, configured to obtain the delivery result from the receipt database based on the delivery success message.

[0024] Optionally, the message processing device further includes: a first construction module, configured to construct a subscription channel between the first type of application and the preset database before sending a delivery message to the second type of application using a preset message queue; and a first subscription module, configured to subscribe to all messages of the preset type based on the subscription channel, and to obtain the preset type of message when the preset database is detected to have the preset type of message.

[0025] Optionally, the first subscription module includes: a first allocation submodule, configured to allocate corresponding channel parameters for each message type to obtain an allocation result, wherein the channel indicated by the channel parameters receives messages of the corresponding message type; a first determination submodule, configured to determine a target channel parameter corresponding to the preset type based on the allocation result; and a first subscription submodule, configured to control the first type of application to subscribe to the target channel indicated by the target channel parameter, thereby completing the first type of application's subscription to messages of the preset type.

[0026] Optionally, the delivery success message includes a message identifier, and the acquisition unit includes a first query module, used to query the receipt database for a delivery result identifier that matches the message identifier; and a first acquisition module, used to acquire the delivery result indicated by the delivery result identifier.

[0027] Optionally, the message processing device further includes: a first push module, configured to, after obtaining the delivery result from the receipt database based on the delivery success message, push a sending success message to a preset browser based on a preset protocol, wherein the preset browser is configured to display the sending success message, the sending success message including an identifier that the delivery message has been successfully sent; and store the delivery result in a storage database.

[0028] Optionally, the message processing device further includes: a first sending module, configured to send the delivery result to the application to be executed after obtaining the delivery result from the receipt database based on the delivery success message, wherein the application to be executed is in a blocked state after the first type of application sends the delivery message, and the blocked state is implemented by a blocked thread; and a first release module, configured to release the blocked thread and control the application to be executed to start working when the application to be executed receives the delivery result.

[0029] According to another aspect of the present invention, a message processing apparatus based on a message queue is also provided, applied in a client of a second type of application, the second type of application deploying a preset database, comprising: a receiving unit, configured to receive a delivery message transmitted by a first type of application based on a preset message queue, wherein the preset message queue is configured to asynchronously transmit the received delivery message to the second type of application, the first type of application deploying the preset database; a processing unit, configured to process the delivery message to obtain a delivery result; a publishing unit, configured to publish a delivery success message to the preset database when the delivery result is successfully written to a receipt database, wherein the delivery success message includes at least: a message type; and a transmission unit, configured to transmit the delivery success message to the first type of application through the preset database when the message type is a preset type, wherein the first type of application obtains the delivery result from the receipt database based on the delivery success message.

[0030] Optionally, the message processing device further includes: a first writing module, configured to write the delivery result to the receipt database after processing the delivery message and obtaining the delivery result, wherein the delivery result includes at least: processing result data.

[0031] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the above-described message processing method based on message queues.

[0032] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method based on the message queue described above.

[0033] In this disclosure, a preset message queue is used to send delivery messages to a second type of application. The second type of application processes the delivery messages, obtains the delivery results, and writes the delivery results to a receipt database. When the delivery results are successfully written to the receipt database, a delivery success message is published to the preset database. The preset database is monitored, and when a delivery success message of a preset type is detected in the preset database, the delivery success message is obtained. Based on the delivery success message, the delivery results are obtained from the receipt database.

[0034] In this disclosure, a first type of application can send delivery messages to a second type of application through a preset message queue and listen to a preset database. The second type of application can process the received delivery messages and write the delivery results to a receipt database. Then, it can publish a delivery success message to the preset database. If the first type of application listens to a delivery success message of a preset type in the preset database, it can obtain the delivery success message and retrieve the delivery result from the receipt database based on the delivery success message. This can obtain accurate message delivery results with high efficiency and minimal latency, improving processing efficiency and solving the technical problems of high latency and low efficiency in obtaining message delivery results in related technologies. Attached Figure Description

[0035] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0036] Figure 1 This is a schematic diagram of an optional active query method based on relevant technologies;

[0037] Figure 2 This is a schematic diagram of an optional passive notification method based on relevant technologies;

[0038] Figure 3 This is a flowchart of an optional message processing method based on a message queue according to an embodiment of the present invention;

[0039] Figure 4 This is a schematic diagram of an optional method for obtaining the delivery result of an asynchronous message according to an embodiment of the present invention;

[0040] Figure 5This is a flowchart of another optional message processing method based on a message queue according to an embodiment of the present invention;

[0041] Figure 6 This is a schematic diagram of an optional message queue-based message processing device according to an embodiment of the present invention;

[0042] Figure 7 This is a schematic diagram of another optional message queue-based message processing device according to an embodiment of the present invention;

[0043] Figure 8 This is a hardware structure block diagram of an electronic device (or mobile device) for a message processing method based on a message queue, according to an embodiment of the present invention. Detailed Implementation

[0044] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0045] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0046] To facilitate understanding of the present invention by those skilled in the art, some terms or nouns involved in the various embodiments of the present invention are explained below:

[0047] A message queue is a container that stores messages during transmission. In this invention, it can refer to middleware that provides message storage and forwarding services. Message queues are a crucial component in distributed systems, primarily addressing issues such as application decoupling, traffic smoothing, and eventual consistency. Currently, commonly used middleware products include ActiveMQ, RabbitMQ, ZeroMQ, Kafka, and RocketMQ.

[0048] ActiveMQ is an open-source message middleware.

[0049] RabbitMQ is an open-source message broker software (also known as message-oriented middleware) that implements an advanced message queuing protocol.

[0050] ZeroMQ is a multi-threaded network library based on message queues.

[0051] Kafka is a high-throughput distributed publish-subscribe messaging system that can handle all action streams of data from consumers on a website.

[0052] RocketMQ is a distributed message middleware.

[0053] Redis is a key-value (KV) database that is both in-memory and persistent. It is frequently used in various systems as a cache to store frequently accessed data and prevent excessive pressure on the database. Redis supports a rich set of data structures and features, making its role in practical applications far exceed that of a cache; it functions more like an in-memory database.

[0054] Asynchronous messages allow you to send the next message immediately after sending the previous one, without waiting for a confirmation message.

[0055] It should be noted that the message processing method and apparatus based on message queues in this disclosure can be used in the financial technology field for message processing based on message queues, and can also be used in any field other than the financial technology field for message processing based on message queues. This disclosure does not limit the application field of the message processing method and apparatus based on message queues.

[0056] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent information from the aforementioned user or organization.

[0057] The following embodiments of the present invention can be applied to various systems / applications / devices that process messages based on message queues. The present invention proposes a method for obtaining asynchronous queue message delivery results based on a general approach, unrestricted by message queue middleware technology stacks. Using this method, application systems can obtain accurate message delivery results with high efficiency and minimal latency.

[0058] This invention utilizes Redis's publish / subscribe mechanism to obtain the results of asynchronous message delivery. Message queues like Kafka, which process millions of messages daily in large clusters, must use asynchronous messaging. While their design ensures every message is consumed by the client, they cannot inform message producers whether certain important messages have been successfully consumed. This new mechanism allows message producers to know whether specific messages have been successfully processed, thus enabling upper-layer modules or consumers to make informed decisions.

[0059] Besides using Redis's publish / subscribe mechanism to transmit message delivery results, this invention can also use other consistency coordination middleware with subscription functionality to achieve the same result transmission. Examples include ZooKeeper (a distributed, open-source distributed application coordination service) and Nacos (an open-source product providing a comprehensive solution for service discovery, configuration management, and service governance in microservice architectures). This invention is not limited to these examples. The following embodiments of this invention will be described in detail using the more general Redis.

[0060] The present invention will now be described in detail with reference to various embodiments.

[0061] Example 1

[0062] According to an embodiment of the present invention, an embodiment of a message processing method based on a message queue is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0063] Figure 3 This is a flowchart of an optional message queue-based message processing method according to an embodiment of the present invention, such as... Figure 3 As shown, the method includes the following steps:

[0064] Step S301: Send a delivery message to the second type of application using a preset message queue. The second type of application has a preset database. The second type of application is used to process the delivery message, obtain the delivery result, and write the delivery result to the receipt database. If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database.

[0065] Step S302: Listen to the preset database, and if a delivery success message of a preset type is detected in the preset database, obtain the delivery success message.

[0066] Step S303: Based on the delivery success message, retrieve the delivery result from the receipt database.

[0067] Through the above steps, a preset message queue can be used to send delivery messages to a second type of application. The second type of application processes the delivery messages, obtains the delivery results, and writes the delivery results to a receipt database. Upon successful writing of the delivery results to the receipt database, it publishes a delivery success message to the preset database, listens to the preset database, and if it detects a delivery success message of a preset type in the preset database, it retrieves the delivery success message and, based on the delivery success message, obtains the delivery results from the receipt database. In this embodiment of the invention, a first type of application can send delivery messages to a second type of application through a preset message queue and listen to the preset database. The second type of application can process the received delivery messages, write the obtained delivery results to the receipt database, and then publish a delivery success message to the preset database. If the first type of application detects a delivery success message of a preset type in the preset database, it can retrieve the delivery success message and, based on the delivery success message, obtain the delivery results from the receipt database. This achieves accurate message delivery results with high efficiency and minimal latency, improving processing efficiency and solving the technical problems of high latency and low efficiency in obtaining message delivery results in related technologies.

[0068] The embodiments of the present invention will be described in detail below with reference to the above steps. The following steps can be applied to the client of a first type of application, which is an upstream application (i.e., a Redis message subscriber used to transmit and deliver messages to downstream applications) and has a preset database (i.e., a Redis database) deployed on it.

[0069] In this embodiment, because Redis supports rich data structures and various high-availability architectures such as master-slave, cluster, and sentinel, it is used for memory caching in various systems and is almost a standard middleware for all web systems. Therefore, this embodiment of the invention can use Redis to obtain delivery results.

[0070] In this embodiment, Redis can be deployed in a cluster within the system intranet. As Redis plays an increasingly important role in various systems, its role has gone far beyond system caching. Ensuring the availability of Redis is generally a top priority for the system, and its availability is equivalent to the availability of the entire system.

[0071] Optionally, before sending delivery messages to the second type of application using a preset message queue, the method further includes: constructing a subscription channel between the first type of application and a preset database; subscribing to all messages of a preset type based on the subscription channel; and obtaining messages of the preset type when the preset database is detected to have messages of the preset type.

[0072] In this embodiment of the invention, the first type of application is an upstream application connected to the message middleware (i.e., a preset message queue). This first type of application can register as a Redis message subscriber. A subscription channel can be first established between the first type of application and the preset database. Then, based on this subscription channel, all messages of a preset type can be subscribed to. This preset type is a type string agreed upon in advance between the first type of application and the downstream application (i.e., the second type of application) connected to the message middleware. Furthermore, if the first type of application detects a message of the preset type in the preset database, it can retrieve that message. For example, if the first type of application detects a message whose subject carries an agreed-upon type string, it can retrieve that message.

[0073] Optionally, the step of subscribing to all messages of a preset type based on the subscription channel includes: assigning corresponding channel parameters to each message type to obtain an assignment result, wherein the channel indicated by the channel parameters receives messages of the corresponding message type; determining the target channel parameters corresponding to the preset type based on the assignment result; and controlling the first type of application to subscribe to the target channel indicated by the target channel parameters to complete the first type of application's subscription to messages of the preset type.

[0074] In this embodiment of the invention, Redis supports a publish / subscribe mechanism based on its proprietary communication protocol, ensuring reliable communication. Furthermore, Redis supports channel parameters and message content parameters.

[0075] In this embodiment of the invention, a corresponding channel parameter can be assigned to each message type (the channel indicated by the channel parameter can receive messages of the corresponding message type) to obtain the allocation result. Then, based on the allocation result, the target channel parameter corresponding to the preset type can be determined. Then, the first type of application can subscribe to the target channel indicated by the target channel parameter, thereby enabling the first type of application to subscribe to messages of the preset type. This allows both the sender (i.e., the first type of application) and the receiver (i.e., the second type of application) to process only the message delivery results of the preset type, effectively improving the system's processing efficiency and reducing the transmission of useless data.

[0076] Step S301: Send a delivery message to the second type of application using a preset message queue. The second type of application has a preset database. The second type of application is used to process the delivery message, obtain the delivery result, and write the delivery result to the receipt database. If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database.

[0077] In this embodiment of the invention, the second type of application is a downstream application connected to the message middleware (i.e., a preset message queue), and is deployed with a preset database (i.e., a Redis database). This second type of application can register as a Redis message publisher, enabling it to publish various types of messages to Redis. Each message type corresponds to a channel parameter, allowing messages of the same type to be transmitted to the same channel indicated by the same channel parameter.

[0078] In this embodiment of the invention, a first type of application can send a delivery message to a second type of application through a preset message queue. The second type of application can process the received delivery message, obtain the delivery result (i.e., the second type of application can consume the delivery message), and write the delivery result to the receipt database (i.e., after the second type of application completes the consumption of the delivery message, it can write the specific details (i.e., the delivery result) to the public message receipt database). After successfully writing the delivery result to the receipt database, it publishes a delivery success message to the preset database (i.e., after writing the message receipt message to the receipt database, the second type of application publishes the message delivery result to Redis).

[0079] Step S302: Listen to the preset database, and if a delivery success message of a preset type is detected in the preset database, obtain the delivery success message.

[0080] In this embodiment of the invention, the first type of application can monitor a preset database (i.e., monitor the channel where a preset type of message is located in the preset database). If a delivery success message of a preset type is detected in the preset database, the delivery success message can be obtained. The message content of the delivery success message can be a unique identifier of this delivery message, such as an order number or message identifier.

[0081] Step S303: Based on the delivery success message, retrieve the delivery result from the receipt database.

[0082] Optionally, the delivery success message includes a message identifier. The step of retrieving the delivery result from the receipt database based on the delivery success message includes: querying the receipt database for a delivery result identifier that matches the message identifier; and retrieving the delivery result indicated by the delivery result identifier.

[0083] In this embodiment of the invention, the successful delivery message includes: a message identifier. The first type of application can query the complete processing details of this delivery message in the public message receipt database (i.e., obtain the delivery result from the receipt database based on the successful delivery message). Specifically, it can first query the receipt database for a delivery result identifier that matches the message identifier, and then obtain the delivery result indicated by the delivery result identifier.

[0084] Figure 4This is a schematic diagram of an optional method for obtaining the delivery result of an asynchronous message according to an embodiment of the present invention, as shown below. Figure 4 As shown, it includes the following steps:

[0085] (1) Message delivery: Upstream applications deliver messages to downstream applications through message queues;

[0086] (2) Message processing: Downstream applications perform message processing;

[0087] (3) Write delivery results: After completing message processing, the downstream application writes the specific details (i.e. delivery results) into the public message receipt database (i.e., the public database);

[0088] (4) Publish delivery result event: After the downstream application writes the message receipt message to the public database, it publishes the message delivery result to Redis. The message type of the message delivery result is a type string agreed upon in advance by the upstream and downstream applications. The message content can be a unique identifier of this delivery message, such as order number, message identifier, etc.

[0089] (5) Subscribing to delivery result events: Upstream applications can subscribe to specific types of messages through Redis and obtain the message content;

[0090] (6) Query delivery result details: The upstream application queries the public database to find the complete processing details of this delivery message (i.e., delivery result details).

[0091] Optionally, after retrieving the delivery result from the receipt database based on the delivery success message, the method further includes: pushing a sending success message to a preset browser based on a preset protocol, wherein the preset browser is used to display the sending success message, and the sending success message includes an identifier that the delivery message has been successfully sent; and storing the delivery result in a storage database.

[0092] In this embodiment of the invention, after the first type of application obtains the message delivery result, it can choose to present the delivery result to the user. Specifically, the background of the first type of application can push a message to the browser via WebSocket (i.e., a preset protocol, a protocol for full-duplex communication over a single TCP (Transmission Control Protocol) connection) to inform the user that the message has been successfully sent (i.e., based on the preset protocol, a successful delivery message is pushed to a preset browser, which can display the successful delivery message, including an identifier indicating that the message has been successfully sent, to notify the user that the message has been successfully sent). Alternatively, the delivery result can be written to a specific database table, so that the user can find that the message has been successfully consumed when browsing a list (i.e., the delivery result is stored in the storage database).

[0093] Optionally, after retrieving the delivery result from the receipt database based on the successful delivery message, the method further includes: sending the delivery result to the application to be executed, wherein the application to be executed is in a blocked state after the first type of application sends the delivery message, and the blocked state is implemented by a blocked thread; when the application to be executed receives the delivery result, the blocked thread is released and the application to be executed is controlled to start working.

[0094] In this embodiment of the invention, other functional modules (i.e., the application to be executed) are blocked and wait for the message delivery result after the first type of application delivers the message. This blocking technique is implemented differently in different languages. For example, in Java, the blocking technique can be implemented using the synchronized keyword, the wait / notify method, or the Reentrantlock package. In C++, the blocking technique can be implemented using semaphore and other semaphore keywords.

[0095] In this embodiment, after the first type of application obtains the subscription message and queries the detailed delivery result information, it can release the previously blocked working thread and notify other functional modules to continue the subsequent process. Specifically, the first type of application can send the delivery result to the application to be executed (the application to be executed is in a blocked state after the first type of application sends the delivery message, and the blocked state can be achieved by blocking the thread). After the application to be executed receives the delivery result, it can release the blocked thread, and the application to be executed can start the subsequent work.

[0096] In this embodiment of the invention, a method for obtaining asynchronous queue message delivery results based on a general approach that is not limited by message queue middleware technology stack is proposed. The message notification mechanism can be designed based on Redis's subscription / publish mechanism, and the message delivery results can be notified to the program or user, achieving the following beneficial effects: (1) Based on the "passive push method", the upstream application can obtain the accurate message delivery results with minimal latency; (2) It does not use the traditional HTTP / HTTPS protocol for message transmission, effectively avoiding a series of disadvantages of the traditional HTTP / HTTPS protocol; (3) Since the messages sent by the upstream application contain multiple types, but not all messages need to obtain the message delivery results, only specific message deliveries need to know the results in a timely manner, this embodiment allows the sender and receiver of the message delivery to only process the message delivery results of specific types, effectively improving the system's processing efficiency and reducing the transmission of useless data.

[0097] The following is a detailed description with reference to another embodiment.

[0098] Example 2

[0099] According to an embodiment of the present invention, an embodiment of a message processing method based on a message queue is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0100] Figure 5 This is a flowchart of another optional message queue-based message processing method according to an embodiment of the present invention, such as... Figure 5 As shown, the method includes the following steps:

[0101] Step S501: Based on a preset message queue, receive delivery messages transmitted by a first type of application. The preset message queue is used to asynchronously transmit the received delivery messages to a second type of application. The first type of application has a preset database deployed on it.

[0102] Step S502: Process the delivery message and obtain the delivery result.

[0103] Step S503: If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database. The delivery success message includes at least the following: message type.

[0104] Step S504: If the message type is a preset type, a delivery success message is transmitted to the first type of application through a preset database. The first type of application obtains the delivery result from the receipt database based on the delivery success message.

[0105] Through the above steps, a delivery message transmitted by a first type of application can be received, processed, and a delivery result obtained based on a preset message queue. If the delivery result is successfully written to the receipt database, a delivery success message is published to the preset database. If the message type is a preset type, the delivery success message is transmitted to the first type of application through the preset database. The first type of application then retrieves the delivery result from the receipt database based on the delivery success message. In this embodiment, a second type of application can receive and process delivery messages transmitted by a first type of application through a preset message queue, write the obtained delivery result to the receipt database, and then publish a delivery success message to the preset database. If the message type of the delivery success message is a preset type, it can be transmitted to the first type of application through the preset database. The first type of application can then retrieve the delivery result from the receipt database based on the delivery success message. This allows for obtaining accurate message delivery results with high efficiency and minimal latency, improving processing efficiency and solving the technical problems of high latency and low efficiency in obtaining message delivery results in related technologies.

[0106] The embodiments of the present invention will be described in detail below with reference to the steps described above. The following steps can be applied to the client of the second type of application, which is a downstream application (i.e., the message publisher of Redis, used to process the received delivery messages) and has a preset database (i.e., the Redis database) deployed.

[0107] Step S501: Based on a preset message queue, receive delivery messages transmitted by a first type of application. The preset message queue is used to asynchronously transmit the received delivery messages to a second type of application. The first type of application has a preset database deployed on it.

[0108] In this embodiment of the invention, the second type of application can receive delivery messages transmitted by the first type of application through a preset message queue. The preset message queue is used to asynchronously transmit the received delivery messages to the second type of application.

[0109] Step S502: Process the delivery message and obtain the delivery result.

[0110] In this embodiment of the invention, the second type of application can consume delivery messages to obtain delivery results.

[0111] Optionally, after processing the delivery message and obtaining the delivery result, the method further includes: writing the delivery result to the receipt database, wherein the delivery result includes at least: processing result data.

[0112] In this embodiment of the invention, after the second type of application completes the consumption of the delivered message, it can write the specific details (i.e., the delivery result) into a public message receipt database. The delivery result includes at least the processing result data.

[0113] Step S503: If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database. The delivery success message includes at least the following: message type.

[0114] In this embodiment of the invention, after the second type of application successfully writes the delivery result to the receipt database, it can publish a delivery success message to a preset database (that is, after the second type of application writes the message receipt message to the receipt database, it publishes the message delivery result to Redis). The delivery success message includes at least the message type.

[0115] Step S504: If the message type is a preset type, a delivery success message is transmitted to the first type of application through a preset database. The first type of application obtains the delivery result from the receipt database based on the delivery success message.

[0116] In this embodiment of the invention, if the message type of the successful delivery message is a preset type (i.e., a type string pre-agreed between the first type of application and the second type of application), the successful delivery message can be transmitted to the first type of application through the preset database. Then, the first type of application can obtain the delivery result from the receipt database according to the message identifier carried in the successful delivery message.

[0117] The following is a detailed description with reference to another embodiment.

[0118] Example 3

[0119] The message processing device based on message queue provided in this embodiment includes multiple implementation units, each of which corresponds to a specific implementation step in Embodiment 1 above.

[0120] Figure 6 This is a schematic diagram of an optional message queue-based message processing apparatus according to an embodiment of the present invention, such as... Figure 6 As shown, the message processing device may include: a sending unit 60, a listening unit 61, and an acquisition unit 62, wherein,

[0121] Sending unit 60 is used to send delivery messages to the second type of application using a preset message queue. The second type of application has a preset database. The second type of application is used to process the delivery messages, obtain the delivery results, and write the delivery results to the receipt database. If the delivery results are successfully written to the receipt database, a delivery success message is sent to the preset database.

[0122] The listening unit 61 is used to listen to the preset database and obtain the delivery success message when the preset database has a delivery success message of a preset type.

[0123] The acquisition unit 62 is used to retrieve the delivery result from the receipt database based on the delivery success message.

[0124] The aforementioned message processing device can send delivery messages to a second type of application via a preset message queue through the sending unit 60. The second type of application processes the delivery messages, obtains the delivery results, and writes the delivery results to the receipt database. If the delivery results are successfully written to the receipt database, a delivery success message is published to the preset database. The listening unit 61 listens to the preset database, and if a delivery success message of a preset type is detected in the preset database, the delivery success message is obtained. The obtaining unit 62 retrieves the delivery results from the receipt database based on the delivery success message. In this embodiment of the invention, a first type of application can send a delivery message to a second type of application through a preset message queue and listen to a preset database. The second type of application can process the received delivery message and write the delivery result to the receipt database. Then, it publishes a delivery success message to the preset database. If the first type of application listens to the preset database and finds a delivery success message of a preset type, it can obtain the delivery success message and retrieve the delivery result from the receipt database based on the delivery success message. This can obtain the accurate result of message delivery with high efficiency and minimal latency, improving processing efficiency and solving the technical problems of high latency and low efficiency in obtaining message delivery results in related technologies.

[0125] Optionally, the message processing device further includes: a first construction module, configured to construct a subscription channel between the first type of application and a preset database before sending a delivery message to the second type of application using a preset message queue; and a first subscription module, configured to subscribe to all messages of a preset type based on the subscription channel, and to obtain messages of the preset type when the preset database is detected to have messages of the preset type.

[0126] Optionally, the first subscription module includes: a first allocation submodule, used to allocate corresponding channel parameters for each message type and obtain allocation results, wherein the channel indicated by the channel parameters receives messages of the corresponding message type; a first determination submodule, used to determine the target channel parameters corresponding to the preset type based on the allocation results; and a first subscription submodule, used to control the first type of application to subscribe to the target channel indicated by the target channel parameters, thereby completing the first type of application's subscription to messages of the preset type.

[0127] Optionally, the successful delivery message includes a message identifier, and the acquisition unit includes: a first query module, used to query the receipt database for a delivery result identifier that matches the message identifier; and a first acquisition module, used to acquire the delivery result indicated by the delivery result identifier.

[0128] Optionally, the message processing device further includes: a first push module, used to push a successful delivery message to a preset browser based on a preset protocol after obtaining the delivery result from the receipt database based on the successful delivery message, wherein the preset browser is used to display the successful delivery message, and the successful delivery message includes an identifier that the delivery message has been successfully sent; and to store the delivery result in a storage database.

[0129] Optionally, the message processing device further includes: a first sending module, configured to send the delivery result to the application to be executed after obtaining the delivery result from the receipt database based on the delivery success message, wherein the application to be executed is in a blocked state after the first type of application sends the delivery message, and the blocked state is implemented by a blocked thread; and a first release module, configured to release the blocked thread and control the application to be executed to start working when the application to be executed receives the delivery result.

[0130] The aforementioned message processing device may further include a processor and a memory. The aforementioned sending unit 60, listening unit 61, and acquiring unit 62 are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0131] The aforementioned processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and by adjusting kernel parameters, the delivery result can be obtained from the delivery receipt database based on the successful delivery message.

[0132] The aforementioned memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0133] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: sending a delivery message to a second type of application using a preset message queue, wherein the second type of application processes the delivery message, obtains the delivery result, and writes the delivery result to a receipt database; if the delivery result is successfully written to the receipt database, a delivery success message is published to the preset database; the preset database is monitored, and if a delivery success message of a preset type is detected in the preset database, a delivery success message is obtained; based on the delivery success message, the delivery result is obtained from the receipt database.

[0134] The following is a detailed description with reference to another embodiment.

[0135] Example 4

[0136] This embodiment also provides a message processing device based on a message queue, which includes multiple implementation units, each of which corresponds to a specific implementation step in Embodiment 2 above.

[0137] Figure 7 This is a schematic diagram of another optional message queue-based message processing apparatus according to an embodiment of the present invention, such as... Figure 7 As shown, the message processing device may include: a receiving unit 70, a processing unit 71, a publishing unit 72, and a transmission unit 73, wherein...

[0138] The receiving unit 70 is used to receive delivery messages transmitted by a first type of application based on a preset message queue. The preset message queue is used to asynchronously transmit the received delivery messages to a second type of application. The first type of application has a preset database deployed on it.

[0139] Processing unit 71 is used to process delivery messages and obtain delivery results;

[0140] The publishing unit 72 is used to publish a delivery success message to a preset database when the delivery result is successfully written to the receipt database. The delivery success message includes at least the following: message type.

[0141] The transmission unit 73 is used to transmit a delivery success message to the first type of application through a preset database when the message type is a preset type. The first type of application obtains the delivery result from the receipt database based on the delivery success message.

[0142] The aforementioned message processing device can receive delivery messages transmitted by a first type of application through a receiving unit 70 based on a preset message queue, process the delivery messages through a processing unit 71 to obtain delivery results, publish a delivery success message to a preset database through a publishing unit 72 when the delivery result is successfully written to the receipt database, and transmit the delivery success message to the first type of application through a preset database when the message type is a preset type through a transmission unit 73. The first type of application obtains the delivery result from the receipt database based on the delivery success message. In this embodiment of the invention, the second type of application can receive delivery messages transmitted by the first type of application through a preset message queue, process the delivery messages, write the obtained delivery results to the receipt database, and then publish a delivery success message to the preset database. If the message type of the delivery success message is a preset type, the delivery success message can be transmitted to the first type of application through the preset database. Then, the first type of application can obtain the delivery results from the receipt database according to the delivery success message. It can obtain accurate results of message delivery with high efficiency and minimal latency, improve processing efficiency, and thus solve the technical problems of high latency and low efficiency in obtaining message delivery results in related technologies.

[0143] Optionally, the message processing device further includes: a first writing module, used to write the delivery result to the receipt database after processing the delivery message and obtaining the delivery result, wherein the delivery result includes at least: processing result data.

[0144] The aforementioned message processing device may further include a processor and a memory. The aforementioned receiving unit 70, processing unit 71, publishing unit 72, transmission unit 73, etc., are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0145] The aforementioned processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and by adjusting kernel parameters, a successful delivery message can be transmitted to the first type of application via a preset database when the message type is a preset type.

[0146] The aforementioned memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0147] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: receiving a delivery message transmitted by a first type of application based on a preset message queue, processing the delivery message, obtaining a delivery result, and, if the delivery result is successfully written to a receipt database, publishing a delivery success message to a preset database; and, if the message type is a preset type, transmitting the delivery success message to the first type of application through the preset database, wherein the first type of application obtains the delivery result from the receipt database based on the delivery success message.

[0148] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the above-described message processing method based on a message queue.

[0149] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors cause the one or more processors to implement the message processing method based on the message queue described above.

[0150] Figure 8 This is a hardware structure block diagram of an electronic device (or mobile device) for a message processing method based on a message queue, according to an embodiment of the present invention. Figure 8 As shown, an electronic device may include one or more ( Figure 8 The processor 802 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 804 for storing data may also be included. In addition, it may include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device may also include components that are more... Figure 8 The more or fewer components shown, or having the same Figure 8 The different configurations shown.

[0151] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0152] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0153] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0155] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0156] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0157] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A message processing method based on a message queue, characterized in that, In clients of the first type of application, which has a pre-defined database deployed, including: A delivery message is sent to a second type of application using a preset message queue. The second type of application deploys the preset database. The second type of application processes the delivery message, obtains the delivery result, and writes the delivery result to the receipt database. If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database. The system monitors the preset database, and if it detects a delivery success message of a preset type in the preset database, it retrieves the delivery success message; wherein, the preset type is a type string pre-agreed between the first type of application and the second type of application. Based on the delivery success message, the delivery result is retrieved from the receipt database; The delivery success message includes a message identifier. The step of retrieving the delivery result from the receipt database based on the delivery success message includes: Query the receipt database for a delivery result identifier that matches the message identifier; Obtain the delivery result indicated by the delivery result identifier.

2. The message processing method according to claim 1, characterized in that, Before sending delivery messages to the second type of application using a preset message queue, the following is also included: Establish a subscription channel between the first type of application and the preset database; Based on the subscription channel, subscribe to all messages of the preset type, and when the preset database detects messages of the preset type, obtain the messages of the preset type.

3. The message processing method according to claim 2, characterized in that, The step of subscribing to all messages of the preset type based on the subscription channel includes: Assign corresponding channel parameters to each message type to obtain an assignment result, wherein the channel indicated by the channel parameters receives messages of the corresponding message type; Based on the allocation result, determine the target channel parameters corresponding to the preset type; Control the first type of application to subscribe to the target channel indicated by the target channel parameter, and complete the first type of application's subscription to the preset type of message.

4. The message processing method according to claim 1, characterized in that, After retrieving the delivery result from the receipt database based on the delivery success message, the process further includes: Based on a preset protocol, a successful delivery message is pushed to a preset browser, wherein the preset browser is used to display the successful delivery message, and the successful delivery message includes an identifier that the delivery message has been successfully sent; The delivery results are stored in the storage database.

5. The message processing method according to claim 1, characterized in that, After retrieving the delivery result from the receipt database based on the delivery success message, the process further includes: The delivery result is sent to the application to be executed, wherein the application to be executed is in a blocked state after the first type of application sends the delivery message, and the blocked state is implemented by a blocking thread; Upon receiving the delivery result, the blocked thread is released, and the application to be executed is controlled to start working.

6. A message processing method based on a message queue, characterized in that, In clients of the second type of application, which has a pre-defined database deployed, including: Based on a preset message queue, a delivery message transmitted by a first type of application is received, wherein the preset message queue is used to asynchronously transmit the received delivery message to a second type of application, and the first type of application has the preset database deployed thereon; the delivery message is processed to obtain a delivery result; If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database, wherein the delivery success message includes at least: message type; When the message type is a preset type, the delivery success message is transmitted to the first type of application through the preset database, wherein the first type of application obtains the delivery result from the receipt database based on the delivery success message; The preset type is a type string pre-agreed between the first type of application and the second type of application; The delivery success message includes a message identifier. The step of retrieving the delivery result from the receipt database based on the delivery success message includes: Query the receipt database for a delivery result identifier that matches the message identifier; Obtain the delivery result indicated by the delivery result identifier.

7. The message processing method according to claim 6, characterized in that, After processing the delivery message and obtaining the delivery result, the process also includes: The delivery result is written to the receipt database, wherein the delivery result includes at least: processing result data.

8. A message processing device based on a message queue, characterized in that, In clients of the first type of application, which has a pre-defined database deployed, including: The sending unit is used to send a delivery message to a second type of application using a preset message queue. The second type of application deploys the preset database. The second type of application processes the delivery message, obtains the delivery result, and writes the delivery result to the receipt database. If the delivery result is successfully written to the receipt database, a delivery success message is sent to the preset database. A listening unit is configured to listen to the preset database and, upon detecting a delivery success message of a preset type in the preset database, obtain the delivery success message; wherein, the preset type is a type string pre-agreed between the first type of application and the second type of application; The acquisition unit is used to acquire the delivery result from the receipt database based on the delivery success message; The successful delivery message includes a message identifier. The acquisition unit includes a first query module, used to query the delivery result identifier that matches the message identifier in the receipt database; and a first acquisition module, used to acquire the delivery result indicated by the delivery result identifier.

9. A message processing device based on a message queue, characterized in that, In clients of the second type of application, which has a pre-defined database deployed, including: A receiving unit is configured to receive a delivery message transmitted by a first type of application based on a preset message queue, wherein the preset message queue is configured to asynchronously transmit the received delivery message to a second type of application, and the first type of application is configured to deploy the preset database. The processing unit is used to process the delivery message and obtain the delivery result; The publishing unit is used to publish a delivery success message to the preset database when the delivery result is successfully written to the receipt database, wherein the delivery success message includes at least: a message type; A transmission unit is configured to transmit the delivery success message to the first type of application through the preset database when the message type is a preset type, wherein the first type of application obtains the delivery result from the receipt database based on the delivery success message; wherein the preset type is a type string pre-agreed between the first type of application and the second type of application. The successful delivery message includes a message identifier. The transmission unit is also used to query the receipt database for a delivery result identifier that matches the message identifier and to obtain the delivery result indicated by the delivery result identifier.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the message processing method based on any one of claims 1 to 7.

11. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the message processing method based on any one of claims 1 to 7.

Citation Information

Patent Citations

  • Cluster communication method and system based on message queue

    CN106210049A

  • Message receipt processing method and device

    CN108933727A