Message processing method, device and system based on message middleware
By introducing a second message middleware into the message middleware system, decoupling the dependencies between multiple consumer systems, the problems of complex logic and slow consumption in the prior art are solved, and the processing logic is simplified and consumption is improved. Speed and effect of reducing backlog risk.
Patent Information
- Application Number
- CN202310188663.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2043-02-27
AI Technical Summary
In the case where there are dependencies in multiple consumer systems, the prior art requires additional steps to process dependencies in message middleware, resulting in complex processing logic, slowing consumption speed, and increasing the risk of consumption backlog.
By introducing a second message middleware into the message middleware system, the dependency relationship between the dependent consumption system and the dependent consumption system is decoupled. The dependent consumption system routes the processed messages to the second message middleware, while the dependent consumption system consumes messages from the second message middleware, simplifying the processing logic.
The processing logic of the dependent consumption system and the dependent consumption system is simplified, the distribution pressure of the first message middleware is reduced, the consumption speed is improved, the risk of consumption backlog is reduced, and the processing timeliness of the consumption link is improved.
Smart Images

Figure CN116302599B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a message processing method, device and system based on message middleware. Background Art
[0002] Message middleware is a supporting software system based on queue and message transmission technology, which provides synchronous or asynchronous message transmission for application systems in a network environment. Message middleware has many advantages such as asynchronous performance improvement, reduced coupling, and traffic peak reduction, and is widely used in information systems.
[0003] At present, when multiple consumer systems have dependencies, the following solution is generally adopted: when the dependent consumer system has completed the action of processing a message from the message middleware, a special flag is added to the message; the dependent consumer system produces the message after adding the special flag to the same message middleware for the dependent consumer system to consume again. Under this solution, before the dependent consumer system consumes the message in the message middleware, it needs to add additional steps such as querying the processing results of the dependent consumer system or parsing the special flag. The dependent consumer system needs to persist the processed message for query by the dependent consumer system to handle the dependency relationship. The dependent consumer system produces the message with the special flag to the same message middleware, which increases the cluster pressure and fails to decouple the original message and the message with the special flag at the cluster level. The processing logic of the dependent consumer system and the dependent consumer system is complex, which slows down the consumption speed of the entire business processing chain and increases the risk of consumption backlog during business peak hours. Summary of the invention
[0004] To solve the above problems, the embodiments of the present application provide a message processing method, device and system based on message middleware to decouple the dependencies between multiple consumer systems, reduce the additional processing logic caused by the dependencies, and speed up the consumption speed of the business message processing chain.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, a message processing method based on a message middleware is provided, the method comprising:
[0007] Receiving business messages and storing them in the first message middleware;
[0008] Consuming the business message in the first message middleware once with the first business logic, and recording a consumption result once;
[0009] Determine whether the business message has downstream dependencies;
[0010] If it exists, the business message is routed to the second message middleware for storage;
[0011] The business message in the second message middleware is consumed for a second time by using the second business logic, and the result of the second consumption is recorded.
[0012] In a second aspect, a message processing device based on a message middleware is provided, the device comprising:
[0013] A service message receiving unit, used for receiving the service message and storing it in the first message middleware;
[0014] A first consumption unit, used to consume the business message in the first message middleware once with a first business logic, and record a consumption result;
[0015] A judging unit, used to judge whether the business message has downstream dependencies;
[0016] A business message routing unit, used for routing the business message to a second message middleware storage when the business message has a downstream dependency;
[0017] The second consumption unit is used to consume the business message in the second message middleware for a second time with a second business logic, and record the result of the second consumption.
[0018] In a third aspect, a message processing system based on message middleware is provided, the system comprising:
[0019] A business producer, used for producing business messages and routing the business messages to the first message middleware;
[0020] A first message middleware, used to store the business message;
[0021] The dependent consumption system is used to consume the business message in the first message middleware once with the first business logic and record the consumption result once; determine whether the business message has downstream dependencies, and if the business message has downstream dependencies, route the business message to the second message middleware;
[0022] The second message middleware is used to store the service message;
[0023] The dependent consumption system is used to re-consume the business message in the second message middleware with a second business logic and record the secondary consumption result.
[0024] In a fourth aspect, a computer 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 steps of the above-mentioned message processing method based on the message middleware when executing the computer program.
[0025] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is instructed by a processor, the steps of the above-mentioned message processing method based on the message middleware are implemented.
[0026] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0027] The message processing method based on message middleware provided in the present application receives a business message and stores it in the first message middleware, consumes the business message in the first message middleware once with the first business logic, and records the consumption result once, determines whether the business message has downstream dependencies, and if so, routes the business message to the second message middleware for storage, consumes the business message in the second message middleware twice with the second business logic, and records the secondary consumption result. The message processing method based on message middleware in the present application decouples the dependent consumer system and the dependent consumer system with strong dependencies through the first message middleware and the second message middleware. In the message processing method based on message middleware in the present application, the dependent consumer system only needs to process the business message from the first message middleware, that is, the native business message with downstream dependencies can be produced and routed to the second message middleware, without adding additional identification bits to the message body, which simplifies the processing logic of the dependent consumer system; the dependent consumer system only needs to consume the business message of the second message middleware, without additionally querying the consumption results or parsing flag bits of the dependent consumer system, which simplifies the processing logic of the dependent consumer system. The message processing method based on message middleware of the present application enables the dependent consumer system to route the native business message with downstream dependency to the second message middleware, thereby alleviating the distribution pressure of the first message middleware; the secondary consumption of the dependent consumer system does not depend on the result of the primary consumption of the dependent consumer system, thereby making the processing logic of the consumption chain of the entire business message simpler, speeding up the consumption speed, reducing the risk of consumption backlog, and improving the processing timeliness of the consumption chain. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0029] Figure 1 A schematic diagram showing a flow chart of a message processing method based on a message middleware according to an embodiment of the present application;
[0030] Figure 2 A schematic diagram showing a flow chart of a message processing method based on message middleware according to another embodiment of the present application;
[0031] Figure 3 A schematic diagram showing the structure of a message processing device based on a message middleware according to an embodiment of the present application is shown;
[0032] Figure 4 A schematic diagram showing the structure of a message processing system based on a message middleware according to an embodiment of the present application is shown;
[0033] Figure 5 A schematic diagram showing the structure of a message processing system based on a message middleware according to another embodiment of the present application is shown;
[0034] Figure 6 A schematic structural diagram of a computer device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0036] In order to enable ordinary technicians in the field to more clearly understand the technical solutions provided by the embodiments of the present application, the technical terms involved in the technical solutions of the present application are first introduced.
[0037] Business producer is used to indicate the party that produces and sends business messages. Business producers are responsible for creating business messages and then delivering them to the message middleware.
[0038] The consumer system is used to indicate the party that receives and consumes business messages. The consumer system is responsible for retrieving business messages from the message middleware and then performing corresponding business logic processing.
[0039] Message middleware is used to transfer business messages. Message middleware can be implemented through independent service proxy nodes.
[0040] Topic is used to indicate a logical concept. Business messages in message middleware are usually classified by topic. Business producers can send business messages to specific topics, and consumer systems can subscribe to topics and consume them.
[0041] Partitions are used to subdivide topics. A topic can be subdivided into multiple partitions, and a partition belongs to a single topic. Different partitions under the same topic contain different business messages. Partitions can be regarded as appendable log files at the storage level. When business messages are appended to partition log files, they are assigned a specific offset.
[0042] The offset is used to indicate the unique identifier of the business message in the partition. The message middleware uses the offset to ensure the order of business messages in the partition.
[0043] The business producer cluster consists of multiple business producers. Each business producer in the business producer cluster is responsible for creating business messages and then delivering them to the corresponding partition of the message middleware according to the topic.
[0044] The consumer system cluster consists of multiple consumer systems. Each consumer system in the consumer system cluster is responsible for consuming data from different partitions, and a partition can only be consumed by one consumer system in the consumer system cluster.
[0045] When multiple consumer systems consume the same topic, they will have a mutually dependent relationship due to logical reasons. For example, consumer system B must wait for consumer system A to complete processing (processing completion can include both successful processing and failed processing) before consuming the same topic again. At this time, consumer system A is the dependent consumer system, and consumer system B is the dependent consumer system. Due to the different consumption capabilities of each consumer system, when the strong dependency relationship cannot be met, consumption logic errors often occur.
[0046] The message processing method based on message middleware proposed in this application aims to solve the strong dependency relationship between multiple consumer systems and realize the decoupling between multiple consumer systems, thereby minimizing the additional processing logic caused by the dependency relationship.
[0047] Figure 1 A schematic diagram of a message processing method based on message middleware according to an embodiment of the present application is shown. Figure 1 As shown, the method includes steps S110 to S150:
[0048] Step S110, receiving a business message and storing it in the first message middleware.
[0049] The business producer creates and produces business messages, and routes the business messages to the first message middleware for storage, so as to be consumed by subsequent consumer systems.
[0050] When the first message middleware receives and stores business messages, it can, but is not limited to, divide the business messages into different first topics according to functional purposes, business types, etc., and store the business messages in the corresponding partitions of the first message middleware according to the first topics. Business producers can also directly name the business messages they create and produce as first topics. When the first message middleware receives and stores business messages, it stores the business messages in the corresponding partitions of the first message middleware according to the first topics named by the business producers. When a business producer creates and produces multiple business messages with the same first topic, the sequence of the business messages within the partition can also be identified by an offset.
[0051] Step S120: Consume the business message in the first message middleware once by using the first business logic, and record the consumption result once.
[0052] The dependent consuming system or the non-dependent consuming system consumes the business message in the first message middleware according to the first business logic, and performs the operation specified in the first business logic.
[0053] When a consumption is performed, the dependent consumer system or independent consumer system subscribing to the topic can be determined based on the first topic of the business message, but is not limited to. The dependent consumer system or independent consumer system can process the business message according to the business requirements of the business message, but is not limited to. The business requirements can include, but are not limited to, persistence, classification counting, and push to a specific system.
[0054] Step S130, determine whether the business message has downstream dependencies.
[0055] Some business messages only need to be consumed once to complete the consumption chain processing, that is, after the business message is processed by the non-dependent consumer system, the consumption chain of the business message is completed. At this time, the business message has no downstream dependency.
[0056] Some business messages still need to rely on the consuming system for secondary consumption after being consumed once to complete the consumption chain processing, that is, the dependent consuming system needs to be consumed once by the dependent consuming system before it can be consumed again. Therefore, it is necessary to determine whether the business message has downstream dependencies.
[0057] When judging, the business message may be judged according to the business scenario of the business message, but is not limited to, for example, a data table of business scenarios of business messages with downstream dependencies is pre-stored, and when the business scenario of the business message matches an item in the data table, it means that the business message has downstream dependencies.
[0058] Step S140: If it exists, the business message is routed to the second message middleware for storage.
[0059] If the business message still needs to rely on the consuming system for secondary consumption to complete the consumption link processing after being consumed once, the business message is routed from the dependent consuming system to the second message middleware storage.
[0060] It is specially noted here that although the business message is consumed once by the dependent consumer system, the business message routed to the second message middleware is still the original business message intact. In other words, although the secondary consumption of the dependent consumer system depends on the first consumption of the dependent consumer system, it does not depend on the first consumption result of the dependent consumer system, and there is no need to mark a special mark in the business message for the first consumption of the dependent consumer system.
[0061] It should also be noted that the dependent consumer system is a consumer relative to the first message middleware and a producer relative to the second message middleware. However, when the dependent consumer system acts as a producer relative to the second message middleware, it only re-produces the original business message with downstream dependencies created and produced by the business producer to the second message middleware. This business message has no processing or marking traces except that it has been consumed once by the dependent consumer system.
[0062] When the second message middleware receives and stores business messages, it can, but is not limited to, re-divide different second topics for business messages according to the first topic or the first consumption result, or the second message middleware can also rename the second topic for the business message when it is produced to the dependent consumer system. The second topic preferably has a certain logical correlation with the first topic, but is not limited to this. The second topic and the first topic have a certain logical correlation only in order to name the second topic in a way that is clear from the name. Store the business message in the corresponding partition of the second message middleware according to the second topic. When there are multiple business messages with the same second topic, the order of the business message within the partition can also be identified by an offset.
[0063] Step S150: re-consume the business message in the second message middleware with the second business logic, and record the result of the re-consumption.
[0064] The dependent consumption system consumes the business message in the second message middleware according to the second business logic, and performs the operation specified in the second business logic.
[0065] When performing secondary consumption, the dependent consumer system subscribed to the topic may be determined based on the second topic of the business message, but is not limited to. The dependent consumer system may process the business message according to the business requirements of the business message, but is not limited to. The business requirements may include, but are not limited to, persistence, classification counting, and push to a specific system.
[0066] That is to say, in the above-mentioned message processing method based on message middleware, the first message middleware is responsible for distributing business messages for primary consumption, and the second message middleware is responsible for distributing business messages for secondary consumption. For business messages with downstream dependencies, as long as the first consumption is completed, secondary consumption can be performed based on the native business message. The above-mentioned method not only decouples the strong dependency between primary consumption and secondary consumption, but also reduces the business message distribution pressure of each message middleware. The above-mentioned message processing method based on message middleware makes the logic of the consumption link with dependency more concise, which can speed up the consumption speed of the consumption link and reduce the risk of consumption backlog.
[0067] from Figure 1 It can be seen from the method shown that the message processing method based on the message middleware provided by the present application receives the business message and stores it in the first message middleware, consumes the business message in the first message middleware once with the first business logic, and records the consumption result once, determines whether the business message has downstream dependencies, and if so, routes the business message to the second message middleware for storage, consumes the business message in the second message middleware twice with the second business logic, and records the secondary consumption result. The message processing method based on the message middleware of the present application decouples the dependent consumption system and the dependent consumption system with strong dependencies through the first message middleware and the second message middleware. In the message processing method based on the message middleware of the present application, the dependent consumption system only needs to process the business message from the first message middleware, that is, the native business message with downstream dependencies can be produced and routed to the second message middleware, without adding additional identification bits to the message body, which simplifies the processing logic of the dependent consumption system; the dependent consumption system only needs to consume the business message of the second message middleware, without additionally querying the consumption results or parsing flag bits of the dependent consumption system, which simplifies the processing logic of the dependent consumption system. The message processing method based on message middleware of the present application enables the dependent consumer system to route the native business message with downstream dependency to the second message middleware, thereby alleviating the distribution pressure of the first message middleware; the secondary consumption of the dependent consumer system does not depend on the result of the primary consumption of the dependent consumer system, thereby making the processing logic of the consumption chain of the entire business message simpler, speeding up the consumption speed, reducing the risk of consumption backlog, and improving the processing timeliness of the consumption chain.
[0068] In some optional embodiments, in the above method, step S110 receives the business message and stores it in the first message middleware, including: receiving the business message produced by the business producer, and determining the functional purpose of the business message; determining the first topic of the business message according to the data table of the preset functional purpose of the business message-the first topic; according to the first topic, storing the business message in the corresponding partition of the first message middleware.
[0069] When a business producer creates and produces a business message, each business message has its corresponding functional purpose. The functional purpose is used to indicate the classification of business messages from the perspective of purpose.
[0070] When the first message middleware receives and stores a business message, it searches for the first topic corresponding to the functional purpose of the business message according to the data table of the preset functional purpose of the business message-the first topic, and stores the business message in the corresponding partition of the first message middleware according to the first topic.
[0071] As an example, a business message 1 produced by a business producer is received, and the functional purpose of the business message 1 is determined to be "Function A"; according to the data table of the preset functional purpose of the business message - the first topic, it is found that the first topic corresponding to "Function A" is "Topic A"; then according to "Topic A", the business message 1 can be stored in the "Topic A partition" of the first message middleware.
[0072] As another example, a business message 2 produced by a business producer is received, and the functional purpose of the business message 2 is determined to be "Function B"; according to the data table of the preset functional purpose of the business message - the first topic, it is found that the first topic corresponding to "Function B" is "Topic B"; then according to "Topic B", the business message 2 can be stored in the "Topic B partition" of the first message middleware.
[0073] In the above two examples, the business messages stored in "Topic A Partition" and "Topic B Partition" need to be consumed by different dependent consumer systems. When the business producer produces two business messages with the functional purpose of "Function A", both business messages will be stored in the "Topic A Partition" of the first message middleware, and the sequence of the two business messages will be distinguished by assigning different offsets to the two business messages. "Topic A Partition" can also be subdivided into multiple more detailed partitions to store the business messages of "Topic A" separately.
[0074] In some optional embodiments, in the above method, step S120 consumes the business message in the first message middleware once with the first business logic, and records the consumption result once, including: retrieving the business message from the corresponding partition of the first message middleware; routing the business message to the corresponding dependent consumer system according to the first topic of the business message, so that the dependent consumer system performs corresponding first processing on the business message; and recording the first processing result of the dependent consumer system.
[0075] The business message is retrieved from the corresponding partition of the first message middleware according to the sequence of the business message. Since a consumer system is usually responsible for subscribing to business messages of different topics and / or different partitions, the business message is routed to the corresponding dependent consumer system according to the first topic of the business message.
[0076] The dependent consumer system consumes the business message and performs the specified first processing according to the business requirements of the business message. Business requirements may include persistence, classification counting, and pushing to a specific system. Persistence means that the business message is persisted in the database after it is consumed once. The database can be a relational or columnar database. Classification counting means counting different categories of business messages after a business message is consumed once, such as N business messages under category 1 and M business messages under category 2. Pushing to a specific system means pushing the business message to a specific system after it is consumed once.
[0077] After the dependent consumer system consumes the business message once, there may be consumption results such as consumption success, consumption failure, consumption exception, etc. The consumption result of a consumption is recorded.
[0078] As an example, business message 1 is retrieved from the "Topic A Partition" of the first message middleware according to the sequence of business messages, and the business message 1 is routed to the dependent consumer system A that subscribes to the topic according to the first topic "Topic A" of business message 1. The dependent consumer system A performs corresponding first processing (such as classification counting) according to the business requirements of business message 1, and records the first processing result (such as successful consumption).
[0079] As an example, business message 2 is retrieved from the "Topic B Partition" of the first message middleware according to the sequence of business messages, and business message 2 is routed to the dependent consumer system B that subscribes to the topic according to the first topic "Topic B" of business message 2. The dependent consumer system B performs corresponding first processing (such as persistence) according to the business requirements of business message 2, and records the first processing result (such as consumption failure).
[0080] In some optional implementations, in the above method, step S130 determines whether the business message has downstream dependencies, including: determining a business scenario of the business message; and matching the business scenario in a preset business scenario data table of the business message.
[0081] After a business message is consumed once, it is necessary to determine whether the business message has downstream dependencies, that is, whether it needs to rely on the consumer system to consume the business message a second time. When judging, according to the preset business scenario data table of the business message, find out whether the business scenario of the business message exists in the data table. The preset business scenario data table of the business message includes multiple business scenario items. When the business scenario of the business message matches one of the multiple business scenario items in the data table, it means that the business scenario of the business message exists in the data table, which means that the business message has downstream dependencies; when the business scenario of the business message does not match the multiple business scenario items in the data table, it means that the business scenario of the business message does not exist in the data table, which means that the business message has no downstream dependencies.
[0082] As an example, after business message 1 is consumed once, it is determined whether business scenario A of business message 1 can find a matching item in the business scenario data table of the preset business message. If a matching item can be found, it means that business message 1 has downstream dependencies.
[0083] As an example, after business message 2 is consumed once, it is determined whether business scenario B of business message 2 can find a matching item in the business scenario data table of the preset business message. If no matching item can be found, it means that business message 2 has no downstream dependency.
[0084] In some optional embodiments, in the above method, if step S140 exists, the business message is routed to the second message middleware for storage, including: if the business scenario matches the item in the business scenario data table of the preset business message, the second topic of the business message is determined based on the first topic and / or a consumption result; according to the second topic, the business message is routed to the corresponding partition of the second message middleware for storage.
[0085] If the business message has downstream dependencies, the native business message needs to be routed to the second message middleware for storage. When the second message middleware receives and stores the business message, in order to facilitate later maintenance, the second topic and the first topic preferably have a certain logical association. Therefore, the second topic of the business message can be determined based on the first topic and / or a consumption result, so that the business message can be stored in the corresponding partition of the second message middleware according to the second topic. For example, the business message that is successfully consumed by the dependent consumption system is divided into a second topic, and the business message that fails to be consumed by the dependent system is divided into another second topic; the second message middleware stores the business message in the corresponding partition according to different second topics; the dependent consumption system can consume the second topic according to actual conditions. Through the above preferred implementation, the business message after one consumption by the dependent system can be stored in different second topics of the second message middleware (corresponding to the corresponding partition), so as to isolate the subsequent process from topic to consumption.
[0086] As an example, business message 1 has downstream dependencies, and the first topic of business message 1 is "Topic A", and the result of one consumption of business message 1 is "Consumption Success"; then based on "Topic A" and "Consumption Success", the second topic of business message 1 can be determined to be "Topic a (Topic A-Consumption Success)". In order to facilitate later maintenance, the dependent consumption system can also be included in the determination of the second topic, that is, the second topic of business message 1 is "Topic a (Dependent Consumption System A-Topic A-Consumption Success)". Based on "Topic a", business message 1 can be stored in the "Topic a partition" of the second message middleware.
[0087] In some optional embodiments, in the above method, step S150 re-consumes the business message in the second message middleware with the second business logic, and records the secondary consumption result, including: retrieving the business message from the corresponding partition of the second message middleware; routing the business message to the corresponding dependent consumption system according to the second topic of the business message, so that the dependent consumption system performs corresponding second processing on the business message; and recording the second processing result of the dependent consumption system.
[0088] The business message is retrieved from the corresponding partition of the second message middleware according to the sequence of the business message. Since a consumer system is usually responsible for subscribing to business messages of different topics and / or different partitions, the business message is routed to the corresponding dependent consumer system according to the second topic of the business message.
[0089] Rely on the consumption system to consume the business message and perform the specified second processing according to the business requirements of the business message. Business requirements may include persistence, classification counting, and push to a specific system. Persistence means that the business message is persisted in the database after secondary consumption. The database can be a relational or columnar database. Classification counting means counting different categories after secondary consumption of the business message, such as N business messages under category 1, M business messages under category 2, etc. Push to a specific system means pushing the business message to a specific system after secondary consumption.
[0090] After the business message is consumed twice by the consumption system, there may be consumption results such as consumption success, consumption failure, consumption exception, etc. The consumption results of the secondary consumption are recorded.
[0091] As an example, business message 1 is retrieved from the "topic a partition" of the second message middleware according to the sequence of business messages, and business message 1 is routed to the dependent consumer system a that subscribes to the topic according to the second topic "topic a" of business message 1. The dependent consumer system a performs corresponding second processing (such as pushing it to a specific system) according to the business requirements of business message 1, and records the second processing result (such as successful consumption).
[0092] In the above-mentioned message processing method based on message middleware, the business message may not only need to be consumed twice, but multiple times (for example, three times or more). In this case, the third message middleware, the fourth message middleware, etc. can be further added according to the logic of the above-mentioned message processing method based on message middleware, and the original business message can be continuously routed until the business message is consumed and the entire consumption link is completed.
[0093] In some practical cases, the business library table A may include three fields C1, C2, and C3. The business producer produces database changes (including insertion, deletion, modification, etc.) in the form of business messages to the first message middleware's [System Name.A] topic by parsing the database logic log. The dependent consumer system stores the business messages of the topic in the column-based database. The successfully stored business messages are produced by the dependent consumer system to the second message middleware's topic [System Name.A.Success]. The dependent consumer system consumes the messages in the [System Name.A.Success] topic and persists them in the secondary index. In this practical case, since the business messages consumed by the dependent consumer system are all business messages that have been successfully stored in the column-based database, the dependency relationship of business message consumption can be met without adding additional logic to the consumer system and without increasing the load on the first message middleware.
[0094] Figure 2 A schematic diagram of a message processing method based on message middleware according to another embodiment of the present invention is shown. Figure 2 As shown, the method may include the following steps:
[0095] Step S201: receiving a service message produced by a service producer and determining the functional purpose of the service message.
[0096] Step S202, determining the first subject of the business message according to the data table of the preset functional purpose of the business message-the first subject.
[0097] Step S203: store the business message in a corresponding partition of the first message middleware according to the first topic.
[0098] Step S204: retrieve the service message from the corresponding partition of the first message middleware.
[0099] Step S205 : Routing the business message to a corresponding dependent consumption system according to the first subject of the business message, so that the dependent consumption system performs a corresponding first processing on the business message.
[0100] Step S206, recording the first processing result of the dependent consumption system.
[0101] Step S207, determining the business scenario of the business message.
[0102] Step S208: Match the business scenario in the business scenario data table of the preset business message.
[0103] Step S209: If the business scenario matches an item in the business scenario data table of the preset business message, determine the second subject of the business message according to the first subject and / or the first processing result.
[0104] Step S210: According to the second topic, the business message is routed to a corresponding partition of the second message middleware for storage.
[0105] Step S211, retrieving the business message from the corresponding partition of the second message middleware.
[0106] Step S212: Routing the business message to a corresponding dependent consumption system according to the second subject of the business message, so that the dependent consumption system performs corresponding second processing on the business message.
[0107] Step S213, recording the second processing result that depends on the consumption system.
[0108] Figure 3 A schematic diagram of the structure of a message processing device based on message middleware according to an embodiment of the present application is shown. Figure 3 As shown, the device 300 includes:
[0109] The service message receiving unit 301 is used to receive the service message and store it in the first message middleware;
[0110] The first consumption unit 302 is used to consume the business message in the first message middleware once according to the first business logic, and record the consumption result once;
[0111] A judging unit 303, used to judge whether the service message has downstream dependency;
[0112] The business message routing unit 304 is used to route the business message to the second message middleware storage when the business message has downstream dependencies;
[0113] The second consumption unit 305 is used to consume the business message in the second message middleware for a second time by using the second business logic, and record the result of the second consumption.
[0114] In some optional embodiments, in the above-mentioned device 300, the business message receiving unit 301 is specifically used to: receive business messages produced by business producers, and determine the functional purpose of the business messages; determine the first topic of the business message according to the data table of the functional purpose of the preset business message-the first topic; according to the first topic, store the business message in the corresponding partition of the first message middleware.
[0115] In some optional embodiments, in the above-mentioned device 300, the first consumption unit 302 is specifically used to: retrieve the business message from the corresponding partition of the first message middleware; route the business message to the corresponding dependent consumption system according to the first topic of the business message, so that the dependent consumption system performs corresponding first processing on the business message; and record the first processing result of the dependent consumption system.
[0116] In some optional implementations, in the above-mentioned device 300, the judgment unit 303 is specifically used to: determine the business scenario of the business message; and match the business scenario in a preset business scenario data table of the business message.
[0117] In some optional embodiments, in the above-mentioned device 300, the business message routing unit 304 is specifically used to: when the business scenario matches the item in the business scenario data table of the preset business message, determine the second topic of the business message according to the first topic and / or a consumption result; according to the second topic, route the business message to the corresponding partition of the second message middleware for storage.
[0118] In some optional embodiments, in the above-mentioned device 300, the second consumption unit 305 is specifically used to: retrieve the business message from the corresponding partition of the second message middleware; route the business message to the corresponding dependent consumption system according to the second topic of the business message, so that the dependent consumption system performs corresponding second processing on the business message; and record the second processing result of the dependent consumption system.
[0119] It should be noted that the message processing device 300 based on the message middleware can implement the message processing methods based on the message middleware one by one, which will not be described in detail.
[0120] Figure 4 The structure diagram of a message processing system based on message middleware according to an embodiment of the present application is shown. Figure 4 As shown, the system 400 includes:
[0121] The business producer 401 is used to produce business messages and route the business messages to the first message middleware;
[0122] The first message middleware 402 is used to store business messages;
[0123] The dependent consumption system 403 is used to consume the business message in the first message middleware once with the first business logic and record the consumption result once; determine whether the business message has downstream dependency, and when the business message has downstream dependency, route the business message to the second message middleware;
[0124] The second message middleware 404 is used to store business messages;
[0125] The dependent consumption system 405 is used to secondary consume the business message in the second message middleware with the second business logic and record the secondary consumption result.
[0126] In some optional implementations, in the above-mentioned system 400, the business producer 401 is specifically used to: produce business messages and determine the functional purpose of the business messages; determine the first topic of the business message according to the data table of the functional purpose of the preset business message-the first topic.
[0127] In some optional implementations, in the above system 400, the first message middleware 402 is specifically used to: store the business message in the corresponding partition according to the first topic.
[0128] In some optional embodiments, in the above-mentioned system 400, the dependent consumption system 403 is specifically used to: retrieve the business message in the corresponding partition of the first message middleware according to the first topic of the business message; perform a corresponding first processing on the business message and record the first processing result; determine the business scenario of the business message and match the business scenario in a preset business scenario data table of the business message; if the business scenario matches an item in the preset business scenario data table of the business message, determine the second topic of the business message according to the first topic and / or a consumption result.
[0129] In some optional implementations, in the above system 400, the second message middleware 404 is specifically used to: store the business message in the corresponding partition according to the second topic.
[0130] In some optional implementations, in the above system 400, the dependent consumption system 405 is specifically used to: retrieve the business message in the corresponding partition of the second message middleware according to the second topic of the business message; perform corresponding second processing on the business message, and record the second processing result.
[0131] in addition, Figure 5 A schematic diagram of the structure of a message processing system based on message middleware according to another embodiment of the present application is shown. Figure 5 As shown:
[0132] In the case of multiple business producers 401, the multiple business producers 401 can also be integrated into a business producer cluster 510. Each business producer 401 in the business producer cluster 510 is responsible for creating a business message and then delivering it to the corresponding partition of the first message middleware according to the topic;
[0133] In the case of multiple dependent consumer systems 403, the multiple dependent consumer systems 403 can also be integrated into a dependent consumer system cluster 520. Each dependent consumer system 403 in the dependent consumer system cluster 520 is responsible for consuming business messages of different topics in the corresponding partition of the first message middleware.
[0134] In the case of multiple dependent consumer systems 405, the multiple dependent consumer systems 405 can also be integrated into a dependent consumer system cluster 530. Each dependent consumer system 405 in the dependent consumer system cluster 530 is responsible for consuming business messages of different topics in the corresponding partition of the second message middleware.
[0135] It should be noted that the above-mentioned message processing system 400 based on message middleware and the message processing system 500 based on message middleware can both implement the above-mentioned message processing method based on message middleware one by one, which will not be described in detail.
[0136] Figure 6 A schematic diagram showing the structure of a computer device according to an embodiment of the present application is shown. Figure 6 As shown, the computer device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps of the message processing method based on the message middleware are implemented.
[0137] In one embodiment, the computer device provided by the present application includes a memory and a processor, the memory stores a database and a computer program that can be run on the processor, and the processor implements the following steps when executing the computer program:
[0138] Receiving business messages and storing them in the first message middleware;
[0139] Consume the business message in the first message middleware once by using the first business logic, and record the consumption result once;
[0140] Determine whether the business message has downstream dependencies;
[0141] If it exists, the business message is routed to the second message middleware storage;
[0142] The business message in the second message middleware is consumed for a second time by using the second business logic, and the result of the second consumption is recorded.
[0143] The above application Figure 3 The method and the method executed by the message processing device based on the message middleware disclosed in the embodiment shown in the present application Figure 4-Figure 5The method for executing the message processing system based on the message middleware disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor to be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0144] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0145] Receiving business messages and storing them in the first message middleware;
[0146] Consume the business message in the first message middleware once by using the first business logic, and record the consumption result once;
[0147] Determine whether the business message has downstream dependencies;
[0148] If it exists, the business message is routed to the second message middleware storage;
[0149] The business message in the second message middleware is consumed for a second time by using the second business logic, and the result of the second consumption is recorded.
[0150] It should be noted that the above functions or steps that can be implemented by the computer device or computer-readable storage medium can refer to the relevant description in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0151] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0152] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0153] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A message processing method based on message middleware, characterized in that: The method comprises: Receiving a business message and storing it in a first message middleware, comprising: storing the business message in a corresponding partition of the first message middleware according to a first topic of the business message; Consuming the business message in the first message middleware once with the first business logic, and recording a consumption result once; Determine whether the business message has downstream dependencies; If it exists, routing the business message to the second message middleware for storage, including: determining the second topic of the business message according to the first topic and the one-time consumption result, and routing the business message to the corresponding partition of the second message middleware for storage according to the second topic; The business message in the second message middleware is consumed for a second time by using the second business logic, and the result of the second consumption is recorded.
2. The message processing method based on message middleware according to claim 1, characterized in that: The receiving of the service message and storing it in the first message middleware includes: Receive a service message generated by a service producer and determine the functional purpose of the service message; Determine the first subject of the business message according to the preset data table of the functional purpose of the business message-the first subject; According to the first topic, the business message is stored in a corresponding partition of the first message middleware.
3. The message processing method based on message middleware according to claim 2 is characterized in that: The consuming the business message in the first message middleware once by using the first business logic and recording the consumption result once includes: Retrieving the service message from the corresponding partition of the first message middleware; Routing the business message to a corresponding dependent consumer system according to the first subject of the business message, so that the dependent consumer system performs a corresponding first process on the business message; The first processing result of the dependent consumer system is recorded.
4. The message processing method based on message middleware according to claim 2 is characterized in that: The determining whether the service message has downstream dependencies includes: Determining a business scenario of the business message; The business scenario is matched in a preset business scenario data table of the business message.
5. The message processing method based on message middleware according to claim 4 is characterized in that: If the service message exists, routing the service message to the second message middleware storage includes: If the business scenario matches an item in the preset business scenario data table of the business message, determining a second subject of the business message according to the first subject and / or the one-time consumption result; According to the second topic, the business message is routed to a corresponding partition of the second message middleware for storage.
6. The message processing method based on message middleware according to claim 4 is characterized in that: The second consumption of the business message in the second message middleware by the second business logic and recording the result of the second consumption includes: Retrieving the service message from the corresponding partition of the second message middleware; Routing the business message to a corresponding dependent consumption system according to the second topic of the business message, so that the dependent consumption system performs corresponding second processing on the business message; The second processing result of the dependent consumption system is recorded.
7. A message processing device based on message middleware, characterized in that: The device comprises: A business message receiving unit, used for receiving a business message and storing it in a first message middleware, comprising: receiving a business message, and storing the business message in a corresponding partition of the first message middleware according to a first topic of the business message; A first consumption unit, used to consume the business message in the first message middleware once with a first business logic, and record a consumption result; A judging unit, used to judge whether the business message has downstream dependencies; A business message routing unit, used for routing the business message to a second message middleware for storage when the business message has downstream dependencies, including: determining a second topic of the business message according to the first topic and the one-time consumption result, and routing the business message to a corresponding partition of the second message middleware for storage according to the second topic; The second consumption unit is used to consume the business message in the second message middleware for a second time with a second business logic, and record the result of the second consumption.
8. A message processing system based on message middleware, characterized in that: The system comprises: A business producer is used to produce a business message and route the business message to a first message middleware, including: routing the business message to a corresponding partition of the first message middleware according to a first topic of the business message; A first message middleware, used to store the business message; The dependent consumption system is used to consume the business message in the first message middleware once with the first business logic and record the consumption result once; determine whether the business message has downstream dependency, and when the business message has downstream dependency, route the business message to the second message middleware, including: determining the second topic of the business message according to the first topic and the consumption result once, and routing the business message to the corresponding partition of the second message middleware for storage according to the second topic; The second message middleware is used to store the service message; The dependent consumption system is used to re-consume the business message in the second message middleware with a second business logic and record the secondary consumption result.
9. A computer 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 steps of the message processing method based on message middleware as described in any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is instructed by a processor, it implements the steps of the message processing method based on message middleware as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data acquisition method, device and equipment and computer storage medium
CN114064617A