Method, device and system for processing flow message middleware
By adopting a process-oriented message middleware processing method, combined with the main processing flow and asynchronous storage confirmation, the processing efficiency and fault tolerance of the message middleware are improved, solving the problems of low efficiency and high cost in existing technologies, and realizing efficient message processing and storage management.
Patent Information
- Application Number
- CN202211695360.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-12-28
AI Technical Summary
Existing message middleware is inefficient, puts heavy pressure on databases, and is costly when processing sudden surges in business data. Furthermore, it has a complex deployment environment and cannot effectively solve the problem of reduced fault tolerance in message failures.
By adopting a process-oriented message middleware processing method, and through the main processing flow and the asynchronous message storage confirmation processing flow, combined with the collaborative work of the message client and the server, message level judgment, internal storage management and asynchronous storage confirmation are realized, thereby improving processing efficiency and avoiding message loss.
It enhances the ability to process large volumes of messages, avoids message loss and duplicate processing, solves the storage problem when message processing fails, reduces costs, and is compatible with existing middleware products.
Smart Images

Figure CN116166453B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a process-oriented message middleware processing method, apparatus and message middleware system. Background Technology
[0002] Currently, some projects experience a sudden surge in message volume. Relational databases, typically used for handling this rapid increase in business data, exhibit problems such as low execution efficiency, high database pressure, and reduced fault tolerance for message failures. While existing message middleware can solve some of these problems, its deployment environment is complex, and its usage costs double with the increase in message volume, hindering cost control. Summary of the Invention
[0003] This application provides a streamlined message middleware processing method, apparatus, and message middleware system. The technical solution is as follows:
[0004] In a first aspect, this application provides a process-oriented message middleware processing method, the method including a main processing flow S1 and an asynchronous message storage confirmation processing flow S2;
[0005] The main processing flow S1 includes:
[0006] S11. The main thread of the message client receives pending messages sent by external systems;
[0007] S12. The main thread determines whether the message to be processed belongs to the first message level;
[0008] If the message to be processed belongs to the first message level, proceed to step S13;
[0009] Otherwise, proceed to step S14;
[0010] S13. The main thread sends the message to be processed to the message server for processing. After receiving the processing completion message sent by the message server, step S17 is executed.
[0011] S14. The main thread determines whether the internal storage area of the message client is full;
[0012] If the internal storage area is full, proceed to step S15;
[0013] If the internal storage area is not full, proceed to step S16;
[0014] S15. The main thread determines whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed in the single-machine database to an unaccepted status, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full, and executes step S17.
[0015] S16. The main thread stores the message to be processed into the internal storage area and sets the status of the message to be processed in the internal storage area to be unaccepted. Then, step S17 is executed.
[0016] S17. The main thread sends a client message confirmation receipt to the external system.
[0017] The asynchronous message storage confirmation process S2 includes:
[0018] S21. The asynchronous message storage confirmation thread of the message client retrieves the internal storage area according to a first preset time to obtain the first batch of messages in the internal storage area that are in an unaccepted state.
[0019] S22. The asynchronous message storage confirmation thread stores the first batch of messages into the single-machine database and sets the status of the first batch of messages in the single-machine database to an unaccepted status.
[0020] S23. The asynchronous message storage confirmation thread retrieves the second batch of messages that are in an unaccepted state from the single-machine database and sends the second batch of messages to the message server for processing.
[0021] S24. The asynchronous message storage confirmation thread receives the processing completion message sent by the message server, sets the status of the second batch of messages in the single-machine database to the accepted status, and clears the first batch of messages stored in the internal storage area.
[0022] Secondly, this application provides a process-oriented message middleware processing device.
[0023] The device includes a main processing module and an asynchronous message storage confirmation processing module;
[0024] The main processing module includes:
[0025] The first processing unit is used to receive messages to be processed sent by external systems;
[0026] The second processing unit is used to determine whether the message to be processed belongs to the first message level;
[0027] The third processing unit is used to send the message to be processed to the message server for processing if the message to be processed belongs to the first message level, and after receiving the processing completion message sent by the message server, send a client message confirmation receipt to the external system.
[0028] The fourth processing unit is used to determine whether the internal storage area of the message client is full if the message to be processed does not belong to the first message level.
[0029] The fifth processing unit is used to determine whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed in the single-machine database to an unaccepted status, and to send a client message confirmation receipt to the external system if the internal storage area is full, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full.
[0030] The sixth processing unit is used to store the message to be processed into the internal storage area if the internal storage area is not full, set the status of the message to be processed in the internal storage area to be unaccepted, and send a client message confirmation receipt to the external system.
[0031] The asynchronous message storage confirmation processing module includes:
[0032] The seventh processing unit is used to retrieve the internal storage area according to a first preset time to obtain the first batch of messages in the internal storage area that are in an unprocessed state;
[0033] The eighth processing unit is used to store the first batch of messages into the standalone database and set the status of the first batch of messages in the standalone database to be unaccepted.
[0034] The ninth processing unit is used to retrieve the second batch of messages that are in an unaccepted state from the single-machine database and send the second batch of messages to the message server for processing;
[0035] The tenth processing unit is used to receive a processing completion message sent by the message server, set the status of the second batch of messages in the single-machine database to the accepted status, and clear the first batch of messages stored in the internal storage area.
[0036] Thirdly, this application provides a message middleware system.
[0037] The message middleware system includes a message client and a message server. The message client includes a main thread unit and an asynchronous message storage confirmation thread unit.
[0038] The main thread unit is used to receive messages to be processed sent by external systems;
[0039] The main thread unit is also used to determine whether the message to be processed belongs to the first message level;
[0040] The main thread unit is also used to send the message to be processed to the message server for processing if the message to be processed belongs to the first message level.
[0041] The message server is used to send a processing completion message to the message client after processing the message to be processed;
[0042] The main thread unit is also used to send a client message confirmation receipt to the external system after receiving the processing completion message;
[0043] The main thread unit is also used to determine whether the internal storage area of the message client is full if the message to be processed does not belong to the first message level.
[0044] The main thread unit is also used to determine whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed already stored in the single-machine database to an unaccepted status, and to send a client message confirmation receipt to the external system if the internal storage area is full, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full.
[0045] The message server is also used to receive the message to be processed and to process the message to be processed.
[0046] The main thread unit is also used to store the message to be processed into the internal storage area if the internal storage area is not full, set the status of the message to be processed in the internal storage area to be unaccepted, and send a client message confirmation receipt to the external system.
[0047] The asynchronous message storage confirmation thread unit is also used to retrieve the internal storage area according to a first preset time to obtain the first batch of messages in the internal storage area that are in an unaccepted state;
[0048] The asynchronous message storage confirmation thread unit is also used to store the first batch of messages into the single-machine database and set the status of the first batch of messages in the single-machine database to be unaccepted.
[0049] The asynchronous message storage confirmation thread unit is also used to retrieve the second batch of messages that are in an unaccepted state in the single-machine database and send the second batch of messages to the message server for processing;
[0050] The message server is also used to process the second batch of messages and send a message indicating that the processing of the second batch of messages is complete to the message client.
[0051] The asynchronous message storage confirmation thread unit is also used to receive the processing completion message sent by the message server, set the status of the second batch of messages in the single-machine database to the accepted status, and clear the first batch of messages stored in the internal storage area.
[0052] The beneficial effects of the technical solution provided in this application include at least the following: by cooperating with the message client and the message server, it improves the processing capacity for receiving a large number of messages instantly, avoids message loss, solves the problem of handling duplicate messages and the storage problem when message processing fails, improves the efficiency of message processing, and can be used with existing mainstream middleware products to improve the shortcomings of existing mainstream middleware products. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0055] Figure 2 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0056] Figure 3 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0057] Figure 4 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0058] Figure 5 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0059] Figure 6This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0060] Figure 7 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0061] Figure 8 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0062] Figure 9 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0063] Figure 10 This is a flowchart illustrating a process-oriented message middleware processing method provided in an embodiment of this application;
[0064] Figure 11 This is a schematic diagram of the composition of a process-oriented message middleware processing device provided in an embodiment of this application;
[0065] Figure 12 This is a schematic diagram of the composition of a process-oriented message middleware processing system provided in an embodiment of this application. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0067] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0068] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0069] Example 1:
[0070] The following will be combined with the appendix Figures 1-2 This paper provides a detailed description of a process-oriented message middleware processing method provided in the embodiments of this application.
[0071] This application provides a process-oriented message middleware processing method, including a main processing flow S1 and an asynchronous message storage confirmation processing flow S2.
[0072] The main processing flow S1 includes:
[0073] S11. The main thread of the message client receives pending messages sent by external systems.
[0074] S12. The main thread determines whether the message to be processed belongs to the first message level.
[0075] If the message to be processed belongs to the first message level, proceed to step S13.
[0076] Otherwise, proceed to step S14.
[0077] S13. The main thread sends the message to be processed to the message server for processing. After receiving the processing completion message from the message server, it executes step S17.
[0078] S14. The main thread checks whether the message client's internal storage area is full.
[0079] If the internal storage area is full, proceed to step S15.
[0080] If the internal storage area is not full, proceed to step S16.
[0081] S15. The main thread determines whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed in the single-machine database to unaccepted status, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full. Then, it executes step S17.
[0082] S16. The main thread stores the message to be processed into the internal storage area and sets the status of the message to be processed in the internal storage area to be unprocessed. Then, step S17 is executed.
[0083] S17. The main thread sends a client message confirmation receipt to the external system.
[0084] The asynchronous message storage confirmation process S2 includes:
[0085] S21. The asynchronous message storage confirmation thread of the message client retrieves the internal storage area according to the first preset time and obtains the first batch of messages in the internal storage area that are in an unaccepted state.
[0086] S22. The asynchronous message storage confirmation thread stores the first batch of messages into the single-machine database and sets the status of the first batch of messages in the single-machine database to unaccepted.
[0087] S23. The asynchronous message storage confirmation thread retrieves the second batch of messages that are in an unaccepted state from the single-machine database and sends the second batch of messages to the message server for processing.
[0088] S24. The asynchronous message storage confirmation thread receives the processing completion message sent by the message server, sets the status of the second batch of messages in the single-machine database to the accepted status, and clears the first batch of messages stored in the internal storage area.
[0089] Based on the above embodiments, it further includes an asynchronous message subscription confirmation processing flow, wherein the asynchronous message subscription confirmation processing flow S3 includes:
[0090] S31. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain messages in the single-machine database that are in the accepted state.
[0091] S32. The asynchronous message subscription confirmation processing thread sends messages that are in the accepted state to the message server.
[0092] S33. The message server sets the status of messages in the accepted state to the subscribeable state in the message database, and determines whether messages in the accepted state have been subscribed to.
[0093] If a message in the accepted state has already been subscribed to, proceed to step S34.
[0094] If a message in the accepted state is not subscribed to, the processing of the accepted message ends.
[0095] S34. Set the status of messages in the "accepted" state to "subscribed" state in the message database.
[0096] S35. The message server sends messages that require a receipt and are in the accepted state to the asynchronous message subscription confirmation processing thread for processing.
[0097] Based on the above embodiments, it further includes an asynchronous message cleanup process, wherein the asynchronous message cleanup process S4 includes:
[0098] The asynchronous message cleanup thread of the message client polls the single-machine database at a third preset time to clean up messages that are in the subscribed state in the single-machine database.
[0099] The message server polls the message database at a fourth preset time and cleans up messages that are already subscribed to.
[0100] Based on the above embodiments, step S15 further includes:
[0101] S151, The main thread determines whether the message to be processed belongs to the second message level.
[0102] If the message to be processed does not belong to the second message level, proceed to step S152.
[0103] If the message to be processed belongs to the second message level, the main thread will send the message to the message server for processing.
[0104] S152, The main thread checks whether the single-machine database is full.
[0105] If the single-machine database is full, the main thread will send the messages to be processed to the message server for processing.
[0106] If the single-machine database is not full, the main thread stores the messages to be processed into the single-machine database, sets the status of the messages already stored in the single-machine database to the unprocessed state, and sends a client message confirmation receipt to the external system.
[0107] Based on the above embodiments, after sending the message to be processed to the message server for processing, the method further includes:
[0108] The message server stores the messages to be processed in its message database, sets the status of the messages in the message database to "unaccepted," and then sends a processing completion message to the main thread.
[0109] Based on the above embodiments, step S16 further includes:
[0110] S161. After the main thread stores the message to be processed into the internal storage area, it determines whether the message to be processed belongs to the second message level.
[0111] If the message to be processed belongs to the second message level, proceed to step S162.
[0112] Otherwise, the main thread sends a client message confirmation receipt to the external system.
[0113] S162. The main thread determines whether there are duplicate messages in the internal storage area for the message to be processed.
[0114] If duplicate messages exist, remove the message to be processed from the memory storage area.
[0115] Otherwise, store the pending message in the standalone database, set the status of the pending message in the standalone database to unaccepted, and send a client message confirmation receipt to the external system.
[0116] Based on the above embodiments, further, before step S33, the following is also included:
[0117] The message server determines whether a message in the accepted state has a preceding message.
[0118] If a message in the accepted state does not have a predecessor message, proceed to step S33.
[0119] If a message in the accepted state has a predecessor message, the message server determines whether the predecessor message of the accepted message has been subscribed to.
[0120] If the preceding message of a message that is in the accepted state has been subscribed to, proceed to step S33.
[0121] If the preceding message of a message in the accepted state has not been subscribed to, the processing of the accepted message ends.
[0122] Based on the above embodiments, step S34 further includes:
[0123] The message server determines if a message in the "accepted" state has a follow-up message, and sets the status of the follow-up message in the message database to "subscribed".
[0124] Based on the above embodiments, step S35 further includes:
[0125] S351. The message server determines whether a message in the accepted state needs to be subscribed to with a receipt.
[0126] If a message that has been accepted requires a receipt subscription, proceed to step S352.
[0127] If a message that has been accepted does not require a receipt subscription, proceed to step S353.
[0128] S352. The message server determines whether it has received the subscription message receipt for a message that is in the accepted state.
[0129] If received, end the processing of messages in the "accepted" status.
[0130] If not received, proceed to step S353.
[0131] S353. The message server sends a message indicating that the message has been subscribed to the asynchronous message subscription confirmation processing thread.
[0132] After receiving a message indicating that the asynchronous message subscription confirmation processing thread has subscribed, it sets the status of the message in the accepted state to the subscribed state in the single-machine database.
[0133] Based on the above embodiments, the asynchronous message subscription confirmation process S3 further includes:
[0134] The asynchronous message subscription confirmation processing thread of the S31 message client polls the single-machine database at a second preset time to obtain messages in the single-machine database that are in an unaccepted state.
[0135] S32' determines whether a message in the unaccepted state has exceeded a preset time.
[0136] If a message remains unaccepted for more than a preset time, the unaccepted message will be moved to the message client's standalone database failure database.
[0137] If a message in the unaccepted state has not exceeded the preset time, the processing of the unaccepted message will end.
[0138] This application provides a process-oriented message middleware processing method that, through the cooperation of a message client and a message server, improves the processing capability for a large number of messages received instantly, avoids message loss, solves the problems of handling duplicate messages and storage when message processing fails, and improves message processing efficiency. It can also be used with existing mainstream middleware products to overcome the shortcomings of existing mainstream middleware products.
[0139] Example 2:
[0140] The following will be combined with the appendix Figures 3-6 This paper provides a detailed description of a process-oriented message middleware processing method provided in the embodiments of this application.
[0141] The present application provides a process-oriented message middleware processing method including a main processing flow 100, an asynchronous message storage confirmation processing flow 200, an asynchronous message subscription confirmation processing flow 300, and an asynchronous message cleanup flow 400.
[0142] Main processing flow 100:
[0143] 110. The main thread of the message client receives pending messages sent by external systems.
[0144] 120. The main thread determines whether the message to be processed belongs to the first message level. If the message to be processed belongs to the first message level, proceed to step 130; otherwise, proceed to step 140.
[0145] 130. The main thread sends the message to be processed to the message server for processing, and after receiving the processing completion message from the message server, it executes step 170.
[0146] 140. The main thread checks whether the message client's internal storage area is full.
[0147] If the internal storage area is full, proceed to step 150.
[0148] If the internal storage area is not full, proceed to step 160.
[0149] 150. Determine whether the message to be processed belongs to the second message level.
[0150] If the message to be processed does not belong to the second message level, proceed to step 151.
[0151] If the message to be processed belongs to the second message level, the main thread will send the message to the message server for processing and execute step 170.
[0152] 151. The main thread determines whether the single-machine database is full.
[0153] If the single-machine database is full, the main thread will send the messages to be processed to the message server for processing, and execute step 170.
[0154] If the single-machine database is not full, proceed to step 152.
[0155] 152. The main thread stores the messages to be processed into the single-machine database, sets the status of the messages already stored in the single-machine database to the unprocessed status, and executes step 170.
[0156] 160. If the internal storage area is not full, the main thread will store the message to be processed in the internal storage area and set the status of the message to be processed in the internal storage area to be unprocessed.
[0157] 161. The main thread determines whether the message to be processed belongs to the second message level.
[0158] If the message to be processed belongs to the second message level, proceed to step 162.
[0159] Otherwise, the main thread sends a client message confirmation receipt to the external system.
[0160] 162. The main thread determines whether there are duplicate messages in the internal storage area of the message to be processed.
[0161] If duplicate messages exist, remove the message to be processed from the internal storage area.
[0162] Otherwise, store the message to be processed in the standalone database, set the status of the message to be processed in the standalone database to unaccepted, and proceed to step 170.
[0163] 170. The main thread sends a client message confirmation receipt to the external system.
[0164] The asynchronous message storage confirmation process 200 includes:
[0165] 210. The client's asynchronous message storage confirmation thread retrieves the internal storage area according to the first preset time and obtains the first batch of messages in the internal storage area that are in an unprocessed state.
[0166] 220. The asynchronous message storage confirmation thread stores the first batch of messages into the single-machine database and sets the status of the first batch of messages in the single-machine database to unprocessed.
[0167] 230. The asynchronous message storage confirmation thread retrieves the second batch of messages that are in an unaccepted state from the single-machine database and sends the second batch of messages to the message server for processing.
[0168] 240. When the asynchronous message storage confirmation thread receives the processing completion message sent by the message server, it sets the status of the second batch of messages in the single-machine database to the accepted status and clears the first batch of messages stored in the internal storage area.
[0169] The asynchronous message subscription confirmation process 300 includes:
[0170] 310. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database at the second preset time to obtain messages in the single-machine database that are in the accepted state.
[0171] 320. The asynchronous message subscription confirmation processing thread sends messages that are in the accepted state to the message server.
[0172] 330. The message server determines whether a message in the accepted state has a preceding message.
[0173] If a message in the accepted state has a predecessor message, proceed to step 340.
[0174] If a message in the accepted state does not have a preceding message, proceed to step 350.
[0175] 340. The message server determines whether the predecessor message of a message that has been accepted has been subscribed to.
[0176] If the preceding message of a message that is in the accepted state has been subscribed to, proceed to step 350.
[0177] Otherwise, the processing of messages that have been accepted will end.
[0178] 350. The message server sets the status of messages in the accepted state to the subscribeable state in the message database, and determines whether messages in the accepted state have been subscribed to.
[0179] If the message in the accepted state has already been subscribed to, proceed to step 360.
[0180] If a message in the accepted state is not subscribed to, the processing of the accepted message ends.
[0181] 360. Set the status of messages that are in the accepted state to the subscribed state in the message database.
[0182] The message server determines whether a message in the accepted state has a follow-up message. If so, it sets the follow-up message in the message database to be in a subscribeable state.
[0183] 371. The message server determines whether a message in the accepted state needs to be subscribed to with a receipt.
[0184] If a message that has been accepted requires a receipt subscription, proceed to step 372.
[0185] Otherwise, proceed to step 373.
[0186] 372. The message server determines whether it has received the subscription message receipt for a message that is in the accepted state.
[0187] If received, end the processing of messages in the "accepted" status.
[0188] Otherwise, proceed to step S373.
[0189] 373. The message server sends a message indicating that the message has been subscribed to the asynchronous message subscription confirmation processing thread.
[0190] 374. After receiving a message indicating that the message has been subscribed, the asynchronous message subscription confirmation processing thread sets the status of the message in the accepted state to the subscribed state in the single-machine database.
[0191] The asynchronous message cleanup process 400 includes:
[0192] 410. The asynchronous message cleanup thread of the message client polls the single-machine database at a third preset time and cleans up the messages in the single-machine database that are in the subscribed state.
[0193] 420. The message server polls the message database at the fourth preset time and cleans up the messages in the message database that are in the subscribed state.
[0194] The asynchronous message subscription confirmation process 300 also includes:
[0195] 310' The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain messages in the single-machine database that are in an unaccepted state.
[0196] 320' Determine whether a message in the unaccepted state has exceeded the preset time.
[0197] If a message remains unaccepted for more than a preset time, the unaccepted message will be moved to the message client's standalone database failure database.
[0198] If a message remains unprocessed for no more than the preset time has elapsed, the processing will end.
[0199] This application embodiment improves the processing capability of receiving a large number of messages instantly by cooperating with the message client and the message server, avoids message loss, solves the problem of handling duplicate messages and the storage problem when message processing fails, improves the efficiency of message processing, and can be used with existing mainstream middleware products to improve the shortcomings of existing mainstream middleware products.
[0200] Example 3:
[0201] The following section will use a practical application, specifically the message processing process in a workflow, as an example to illustrate the concept.
[0202] This embodiment uses the merchant application message, preliminary review message, director approval message, bank president approval message, and approval message in actual production as examples. The message following the merchant application message is the preliminary review message, the message preceding the preliminary review message is the merchant application message, the message following the director approval message is the director approval message, the message preceding the director approval message is the preliminary review message, the message following the bank president approval message is the bank president approval message, the message preceding the bank president approval message is the director approval message, the message following the approval message is the approval message, and the message preceding the approval message is the bank president approval message.
[0203] The processing procedure specifically includes the following steps:
[0204] S101, The main thread of the message client receives merchant application messages sent by external systems.
[0205] For example, the main thread receives the following merchant application message:
[0206] STEP1:{id:1,name:merchant application message,parentId:null,childIds:[2],msgLvl:lossless,msgStat:unreceive,placeOn:client}.
[0207] Here, msgLvl refers to the message level, lossless indicates a weakly lost message, placeOn indicates the message placement position, parentId is the ID of the predecessor message, and -1 indicates that the message has no predecessor message. childIds refers to the ID of the successor message, and null indicates that the message has no successor message.
[0208] S102. The main thread determines that the merchant application message is not of the non-loss type and that the memory circular queue in the internal storage area of the message client is not full. It then stores the merchant application message in the memory circular queue and sets the status of the merchant application message in the memory circular queue to the unaccepted status.
[0209] In this embodiment, the internal storage area is a memory circular queue.
[0210] For example: STAGE0:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113001,receiveTime:null,subscribTime:null}.
[0211] S103. The main thread determines that the merchant application message is a weakly lost message and that there are no duplicate messages of the merchant application message in the memory circular queue. It then stores the merchant application message in the single-machine database, sets the status of the merchant application message already stored in the single-machine database to the unaccepted status, and sends a client message confirmation receipt to the external system.
[0212] STAGE1:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113001,receiveTime:null,subscribTime:null} / / Not accepted (in client single-machine database).
[0213] S111, The main thread of the message client receives the initial review message sent by the external system.
[0214] For example, the main thread receives the following initial review message:
[0215] STEP2:{id:2,name:initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client}.
[0216] S112. The main thread determines that the initial review message does not belong to the non-lossable type and the memory circular queue is not full. It then stores the initial review message in the memory circular queue and sets the status of the initial review message in the memory circular queue to the unaccepted status.
[0217] STAGE0:{id:2,name:initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113011,receiveTime:null,subscribTime:null}.
[0218] S113. The main thread determines that the initial review message is a weakly lost message and that there are no duplicate messages of the initial review message in the memory circular queue. It then stores the initial review message in the single-machine database, sets the status of the initial review message already stored in the single-machine database to the unaccepted status, and sends a client message confirmation receipt to the external system.
[0219] STAGE1:{id:2,name:Initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113011,receiveTime:null,subscribTime:null} / / Not accepted (in client single-machine database).
[0220] S121. The main thread of the message client receives the director's approval message sent by the external system.
[0221] For example, the main thread receives the following approval message from the supervisor:
[0222] STEP3:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client}.
[0223] S122. The main thread determines that the director's approval message is not of the non-lossable type and that the memory circular queue is not full. It then stores the director's approval message in the memory circular queue and sets the status of the director's approval message in the memory circular queue to the unaccepted status.
[0224] STAGE0:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113021,receiveTime:null,subscribTime:null}.
[0225] S123. The main thread determines that the director's approval message is a weakly lost message and that there are no duplicate messages of the director's approval message in the memory circular queue. It then stores the director's approval message in the single-machine database, sets the status of the director's approval message already stored in the single-machine database to the unaccepted status, and sends a client message confirmation receipt to the external system.
[0226] STAGE1:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113021,receiveTime:null,subscribTime:null} / / Not accepted (in client single-machine database).
[0227] S131. The main thread of the message client receives the bank president's approval message sent by the external system.
[0228] For example, the main thread receives the following approval message from the bank manager:
[0229] STEP4:{id:4,name:bank president approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client}.
[0230] S132. The main thread determines that the bank manager's approval message is not of the non-lossable type and that the memory circular queue is not full. It then stores the bank manager's approval message in the memory circular queue and sets the status of the bank manager's approval message in the memory circular queue to the unaccepted status.
[0231] STAGE0: {id: 4, name: Approval by the bank manager, parentId: 3, childIds: [5], msgLvl: lossless, msgStat: unreceive, flowStat: ing, placeOn: client, publishTime: 20220916113031, receiveTime: null, subscribTime: null}.
[0232] S133. The main thread of the message client determines that the approval message by the bank manager belongs to the weakly lost message type, and there is no duplicate message in the in-memory circular queue for this approval message by the bank manager. The main thread stores the approval message by the bank manager in the stand-alone database, sets the status of the approval message by the bank manager that has been stored in the stand-alone database to the unaccepted status, and sends a client message confirmation receipt to the external system.
[0233] STAGE1: {id: 4, name: Approval by the bank manager, parentId: 3, childIds: [5], msgLvl: lossless, msgStat: unreceive, flowStat: ing, placeOn: client, publishTime: 20220916113031, receiveTime: null, subscribTime: null} / / Unaccepted (in the client stand-alone database).
[0234] S141. The main thread of the message client receives the approval passed message sent by the external system.
[0235] For example, the main thread receives the approval passed message:
[0236] STEP5: {id: 5, name: Approval passed message, parentId: 4, childIds: null, msgLvl: lossless, msgStat: unreceive, flowStat: ing, placeOn: client}.
[0237] S142. The main thread determines that the approval passed message does not belong to the non-loss type, and the in-memory circular queue is not full. The main thread stores the approval passed message in the in-memory circular queue and sets the status of the approval passed message in the in-memory circular queue to the unaccepted status.
[0238] STAGE0:{id:5,name:Approval message,parentId:4,childIds:null,msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113031,receiveTime:null,subscribTime:null}.
[0239] S143. The main thread determines that the approval message is a weakly lost message and that there are no duplicate messages of the approval message in the memory circular queue. It then stores the approval message in the single-machine database, sets the status of the approval message already stored in the single-machine database to the unaccepted status, and sends a client message confirmation receipt to the external system.
[0240] STAGE1:{id:5,name:Approved message,parentId:4,childIds:null,msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113031,receiveTime:null,subscribTime:null} / / Not accepted (in client-side single-machine database).
[0241] S201. The asynchronous message storage confirmation thread of the message client retrieves the memory circular queue according to the first preset time, and obtains the merchant application message, preliminary review message, director approval message, bank president approval message and approval message that are in the unaccepted state in the memory circular queue.
[0242] For example, STAGE1:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113001,receiveTime:null,subscribTime:null};
[0243] STAGE1:{id:2,name:Initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113011,receiveTime:null,subscribTime:null} / / Not accepted (in client single-machine database);
[0244] STAGE1:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113021,receiveTime:null,subscribTime:null} / / Not accepted (in client single-machine database);
[0245] STAGE1:{id:4,name:bank president approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113031,receiveTime:null,subscribTime:null} / / Not accepted (in client single-machine database);
[0246] STAGE1:{id:5,name:Approved message,parentId:4,childIds:null,msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113031,receiveTime:null,subscribTime:null} / / Not accepted (in client-side single-machine database).
[0247] S202. After the asynchronous message storage confirmation thread stores the merchant application messages, preliminary review messages, director approval messages, bank president approval messages, and approved messages that are in an unaccepted state in the memory circular queue into the single-machine database, it sets the status of the newly stored merchant application messages, preliminary review messages, director approval messages, bank president approval messages, and approved messages in the single-machine database to an unaccepted state.
[0248] S203. The asynchronous message storage confirmation thread retrieves merchant application messages, preliminary review messages, director approval messages, bank president approval messages, and approval messages that are in an unaccepted state from the single-machine database, and sends batch messages of remote acceptance confirmation to the message server.
[0249] S204. After receiving the batch message remote acceptance confirmation message, the message server stores the merchant application message, preliminary review message, director approval message, bank president approval message and approval message into the message database of the message server, and then sends the message "accepted" to the asynchronous message storage confirmation thread.
[0250] STAGE2:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113001,receiveTime:20220916113002,subscribTime:null} / / Accepted (on the server);
[0251] STAGE2:{id:2,name:Initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:null} / / Accepted (on the server);
[0252] STAGE2:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:null} / / Accepted (on the server);
[0253] STAGE2:{id:4,name:bank president approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (on the server);
[0254] STAGE2:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (on the server);
[0255] S205. When the asynchronous message storage confirmation thread receives the message that the application has been accepted, and the merchant application message, preliminary review message, director approval message, bank president approval message, and approval message have been accepted, the status of the merchant application message, preliminary review message, director approval message, bank president approval message, and approval message in the single-machine database is set to the accepted status, and the merchant application message, preliminary review message, director approval message, bank president approval message, and approval message stored in the memory circular queue are cleared.
[0256] STAGE3:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113001,receiveTime:20220916113002,subscribTime:null} / / Accepted (in client single-machine database);
[0257] STAGE3:{id:2,name:Initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:null} / / Accepted (in client single-machine database);
[0258] STAGE3:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:null} / / Accepted (in client single-machine database);
[0259] STAGE3:{id:4,name:bank president approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (in client single-machine database);
[0260] STAGE3:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (in client-side single-machine database);
[0261] S301. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain the merchant's application message in the single-machine database.
[0262] For example, STAGE3:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113001,receiveTime:20220916113002,subscribTime:null} / / Accepted (in client single-machine database);
[0263] STAGE3:{id:2,name:Initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:null} / / Accepted (in client single-machine database);
[0264] STAGE3:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:null} / / Accepted (in client single-machine database);
[0265] STAGE3:{id:4,name:bank president approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (in client single-machine database);
[0266] STAGE3:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (in client-side single-machine database);
[0267] S302. The asynchronous message subscription confirmation processing thread sends a message to the message server to retrieve the merchant's application message from the database.
[0268] S303. The message server retrieves the merchant application message and finds no preceding message. The message server then sets the merchant application message in the message database to a subscribeable state.
[0269] For example, STAGE4:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113001,receiveTime:20220916113002,subscribTime:null} / / can be subscribed to (on the server side)
[0270] S304. When the message server confirms that the merchant application message has been subscribed to and that there is a subsequent message, the preliminary review message, in the message database, the status of the subsequent message, the preliminary review message, is set to the subscribeable status, and the status of the merchant application message is set to the subscribed status.
[0271] STAGE4:{id:2,name:Initial Review Message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:null} / / Can be subscribed to (on the server)
[0272] STAGE5:{id:1,name:merchant application message,parentId:-1,childIds:[2],msgLvl:lossless,msgStat:subscribed,flowStat:ing,placeOn:server,publishTime:20220916113001,receiveTime:20220916113002,subscribTime:20220916113003} / / Subscription completed (on the server)
[0273] S305. The message server determines that the merchant's message application requires a subscription receipt, and receives the subscription message receipt for the merchant's message application, and ends the process.
[0274] S311. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain the initial review messages in the single-machine database that are in the accepted state.
[0275] For example, STAGE3:{id:2,name:Preliminary review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:null} / / Accepted (in client single-machine database)
[0276] S312. The asynchronous message subscription confirmation processing thread sends a message to the message server to retrieve the initial review message from the database.
[0277] S313. After the message server retrieves the preliminary review message and finds that there is a predecessor message, and that the predecessor message, the merchant application message, has been subscribed to, the preliminary review message in the message database is set to a subscribeable state.
[0278] For example, STAGE4:{id:2,name:initial review message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:null} / / can be subscribed to (on the server side)
[0279] S314. When the message server confirms that the preliminary review message has been subscribed to and that the preliminary review approval message has a follow-up message, the director approval message, in the message database is set to the subscribed status of the follow-up message, and the preliminary review approval message is set to the subscribed status.
[0280] STAGE4:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:null} / / Can be subscribed to (on the server)
[0281] STAGE5:{id:2,name:Initial Review Message,parentId:1,childIds:[3],msgLvl:lossless,msgStat:subscribed,flowStat:ing,placeOn:server,publishTime:20220916113011,receiveTime:20220916113012,subscribTime:20220916113013} / / Subscription complete (on the server)
[0282] S315. The message server confirms that the initial review message requires a subscription receipt and receives the subscription receipt for the initial review approval message, then the process ends.
[0283] S321. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain the director's approval message that is in the accepted state in the single-machine database.
[0284] For example, STAGE3:{id:3,name:Director Approval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:null} / / Accepted (in client single-machine database)
[0285] S322. The asynchronous message subscription confirmation processing thread sends a message to the message server to retrieve the director's approval message from the database.
[0286] S323. After the message server retrieves the director's approval message and finds that there is a predecessor message, and that the predecessor message of the director's approval message, the preliminary review message, has been subscribed to, the director's approval message in the message database is set to a subscribeable state.
[0287] For example, STAGE4:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:null} / / Can be subscribed (on the server)
[0288] S324. When the message server confirms that the director's approval message has been subscribed to and that the director's approval message has a follow-up message, the bank president's approval message, in the message database is set to the subscribed status of the follow-up message, the bank president's approval message, and the status of the director's approval message is set to the subscribed status.
[0289] STAGE4:{id:4,name:Bank Manager Approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Can be subscribed to (on the server)
[0290] STAGE5:{id:3,name:DirectorApproval,parentId:2,childIds:[4],msgLvl:lossless,msgStat:subscribed,flowStat:ing,placeOn:server,publishTime:20220916113021,receiveTime:20220916113022,subscribTime:20220916113023} / / Subscription complete (on the server)
[0291] S325. The message server determines that the director's approval message requires a subscription receipt, receives the subscription receipt for the director's approval message, and ends the process.
[0292] S331. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain the bank president's approval message in the single-machine database that is in the accepted state.
[0293] For example, STAGE3:{id:4,name:Bank Manager Approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (in client single-machine database)
[0294] S322. The asynchronous message subscription confirmation processing thread sends a message to the message server to retrieve the bank president's approval message from the database.
[0295] S323. After the message server retrieves the predecessor message of the bank president's approval message and finds that the predecessor message of the bank president's approval message, the director's approval message, has been subscribed to, the bank president's approval message in the message database is set to a subscribeable state.
[0296] For example, STAGE4:{id:4,name:bank president approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / can be subscribed (on the server side)
[0297] S324. When the message server confirms that the bank president's approval message has been subscribed to and that there is a follow-up approval message for the bank president's approval message, it sets the status of the follow-up approval message for the bank president's approval message in the message database to the subscribed status and sets the status of the bank president's approval message to the subscribed status.
[0298] STAGE4:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Can be subscribed to (on the server)
[0299] STAGE5:{id:4,name:Bank Manager Approval,parentId:3,childIds:[5],msgLvl:lossless,msgStat:subscribed,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:20220916113033} / / Subscription complete (on the server)
[0300] S335. The message server determines that the bank president's approval message requires a subscription receipt, receives the subscription receipt for the bank president's approval message, and ends the process.
[0301] S341. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain the approved messages in the single-machine database that are in the accepted state.
[0302] For example, STAGE3:{id:5,name:Approved message,parentId:4,childIds:null,msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (in client-side single-machine database)
[0303] S342. The asynchronous message subscription confirmation processing thread sends a message to the message server to retrieve the approved message from the database.
[0304] S343. After the message server retrieves the predecessor message of the approved message and finds that the predecessor message of the approved message, the bank president's approval message, has been subscribed to, the approved message in the message database is set to a subscribeable state.
[0305] For example, STAGE3:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Can be subscribed to (on the server side)
[0306] S344. The message server confirms that the approval message has been subscribed to and that there are no follow-up messages for the approval message, and sets the status of the approval message to the subscribed status.
[0307] STAGE5:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:subscribed,flowStat:done,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:20220916113033} / / Subscription complete (on the server)
[0308] S345. The message server determines that the approval message requires a subscription receipt, receives the subscription receipt for the approval message, and ends the process.
[0309] S401. The asynchronous message cleanup thread of the message client polls the single-machine database at a third preset time and cleans up the merchant application messages, preliminary review messages, director approval messages, bank president approval messages and approved messages that are in the subscribed state in the single-machine database.
[0310] S402. The message server polls the message database at the fourth preset time and cleans up the merchant application messages, preliminary review messages, director approval messages, bank president approval messages and approved messages that are in the subscribed state in the message database.
[0311] This application embodiment improves the processing capability of receiving a large number of messages instantly by cooperating with the message client and the message server, avoids message loss, solves the problem of handling duplicate messages and the storage problem when message processing fails, improves the efficiency of message processing, and can be used with existing mainstream middleware products to improve the shortcomings of existing mainstream middleware products.
[0312] Example 4:
[0313] The following will be combined with the appendix Figures 7-10 Taking the successful acceptance notification query message as an example, this application provides a detailed description of a process-oriented message middleware processing method. The successful acceptance notification query message is a weakly lost message and has no preceding or subsequent messages.
[0314] S501, The main thread of the message client receives a successful acceptance notification query message sent by an external system.
[0315] For example: STAGE0:{id:1,name:Payment Acceptance Successful Notification Query,parentId:null,childIds:null,msgLvl:littleloss,msgStat:unreceive,flowStat:null,placeOn:client,publishTime:20220916163001,receiveTime:null,subscribTime:null}
[0316] S502. The main thread determines that the successful acceptance notification query message is not of the non-lossable type and that the memory circular queue is not full. It then stores the successful acceptance notification query message into the memory circular queue and sets the status of the successful acceptance notification query message already stored in the memory circular queue to the unaccepted status.
[0317] S503: The main thread determines that the successful acceptance notification query message is a weakly lost message and that there are no duplicate messages of the successful acceptance notification query message in the memory circular queue. It then stores the successful acceptance notification query message in the single-machine database, sets the status of the successful acceptance notification query message in the single-machine database to the unaccepted status, and sends a client message confirmation receipt to the external system.
[0318] For example: STAGE1:{id:5,name:acceptance success notification query message,parentId:4,childIds:null,msgLvl:lossless,msgStat:unreceive,flowStat:ing,placeOn:client,publishTime:20220916113031,receiveTime:null,subscribTime:null} / / unaccepted (in client-side single-machine database)
[0319] S504. The main thread sends the successful acceptance notification query message to the message server. After receiving the successful acceptance notification query message and confirming receipt, the message server stores it in the message database, sets the status of the successful acceptance notification query message in the message database to unaccepted, and sends a message confirmation notification to the main thread.
[0320] S505. After receiving the message confirmation notification, the main thread sends a client message confirmation receipt to the external system.
[0321] S506. The asynchronous message storage confirmation thread of the message client retrieves the memory circular queue according to the first preset time and obtains the successful acceptance notification query message that is in the unaccepted state in the memory circular queue.
[0322] S507: After the asynchronous message storage confirmation thread stores the successful acceptance notification query message into the single-machine database, it sets the status of the successful acceptance notification query message in the single-machine database to an unaccepted status.
[0323] S508: The asynchronous message storage confirmation thread retrieves the successful acceptance notification query message from the single-machine database and sends a remote acceptance confirmation message to the message server.
[0324] S509. After receiving the message remote acceptance confirmation message, the message server stores the message remote acceptance confirmation message in the message database of the message server, and then sends a message that the message has been accepted to the asynchronous message storage confirmation thread.
[0325] S510: The asynchronous message storage confirmation thread determines that the successful acceptance notification query message in the single-machine database has been accepted, sets the status of the successful acceptance notification query message in the single-machine database to accepted, and deletes the successful acceptance notification query message from the memory circular queue.
[0326] For example, STAGE2:{id:5,name:Approval Message,parentId:4,childIds:null,msgLvl:lossless,msgStat:received,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / Accepted (on the server)
[0327] S511. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain the successful acceptance notification query message in the single-machine database that is in the accepted state.
[0328] S512, the asynchronous message subscription confirmation processing thread sends a message to the message server to retrieve the message database.
[0329] S513. If the message server does not find the predecessor message of the successful acceptance notification query message, set the status of the successful acceptance notification query message in the message database to be subscribingable.
[0330] For example, STAGE3:{id:5,name:acceptance success notification query message,parentId:4,childIds:null,msgLvl:lossless,msgStat:subscrib,flowStat:ing,placeOn:server,publishTime:20220916113031,receiveTime:20220916113032,subscribTime:null} / / can be subscribed to (on the server side)
[0331] S514. The message server determines that the successful acceptance notification query message has been subscribed to and that there are no follow-up messages for the successful acceptance notification query message, and sets the status of the successful acceptance notification query message to the subscribed status.
[0332] For example, STAGE4:{id:1,name:Payment Acceptance Successful Notification Query,parentId:null,childIds:null,msgLvl:littleloss,msgStat:subscribed,flowStat:null,placeOn:server,publishTime:20220916163001,receiveTime:20220916163002,subscribTime:20220916163003} / / Subscribed (on the server)
[0333] S515. The message server confirms that the successful acceptance notification query message requires a subscription receipt, and has received the subscription message receipt for the successful acceptance notification query message, and ends the processing.
[0334] This embodiment also includes an asynchronous message cleanup process:
[0335] S521. The asynchronous message cleanup thread of the message client polls the single-machine database at a third preset time and cleans up the successful acceptance notification query messages that are in the subscribed state in the single-machine database.
[0336] S522. The message server polls the message database according to the fourth preset time and cleans up the successful acceptance notification query messages that are in the subscribed state in the message database.
[0337] This application embodiment improves the processing capability of receiving a large number of messages instantly by cooperating with the message client and the message server, avoids message loss, solves the problem of handling duplicate messages and the storage problem when message processing fails, improves the efficiency of message processing, and can be used with existing mainstream middleware products to improve the shortcomings of existing mainstream middleware products.
[0338] Example 5:
[0339] The following will be combined with the appendix Figure 11 Taking a process-oriented message middleware processing device as an example, the device includes a main processing module and an asynchronous message storage and confirmation processing module;
[0340] The main processing module includes:
[0341] The first processing unit is used to receive messages to be processed sent by external systems;
[0342] The second processing unit is used to determine whether the message to be processed belongs to the first message level;
[0343] The third processing unit is used to send the message to be processed to the message server for processing if the message to be processed belongs to the first message level, and after receiving the processing completion message sent by the message server, send a client message confirmation receipt to the external system.
[0344] The fourth processing unit is used to determine whether the internal storage area of the message client is full if the message to be processed does not belong to the first message level.
[0345] The fifth processing unit is used to determine whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed in the single-machine database to an unaccepted status, and to send a client message confirmation receipt to the external system if the internal storage area is full, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full.
[0346] The sixth processing unit is used to store the message to be processed into the internal storage area if the internal storage area is not full, set the status of the message to be processed in the internal storage area to be unaccepted, and send a client message confirmation receipt to the external system.
[0347] The asynchronous message storage confirmation processing module includes:
[0348] The seventh processing unit is used to retrieve the internal storage area according to the first preset time to obtain the first batch of messages in the internal storage area that are in an unprocessed state;
[0349] The eighth processing unit is used to store the first batch of messages into the standalone database and set the status of the first batch of messages in the standalone database to be unaccepted.
[0350] The ninth processing unit is used to retrieve the second batch of messages that are in an unaccepted state from the single-machine database and send the second batch of messages to the message server for processing;
[0351] The tenth processing unit is used to receive the processing completion message sent by the message server, set the status of the second batch of messages in the single-machine database to the accepted status, and clear the first batch of messages stored in the internal storage area.
[0352] This application embodiment improves the processing capability of receiving a large number of messages instantly by cooperating with the message client and the message server, avoids message loss, solves the problem of handling duplicate messages and the storage problem when message processing fails, improves the efficiency of message processing, and can be used with existing mainstream middleware products to improve the shortcomings of existing mainstream middleware products.
[0353] Example 6:
[0354] The following will be combined with the appendix Figure 12 Taking a message middleware system as an example,
[0355] The message middleware system includes a message client and a message server. The message client includes a main thread unit and an asynchronous message storage and confirmation thread unit.
[0356] The main thread unit is used to receive messages to be processed from external systems;
[0357] The main thread unit is also used to determine whether a message to be processed belongs to the first message level;
[0358] The main thread unit is also used to send the message to be processed to the message server if the message to be processed belongs to the first message level.
[0359] The message server is used to send a processing completion message to the message client after processing the pending messages;
[0360] The main thread unit is also used to send a client message confirmation receipt to the external system after receiving the processing completion message;
[0361] The main thread unit is also used to determine whether the message client's internal storage area is full if the message to be processed does not belong to the first message level.
[0362] The main thread unit is also used to determine whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message already stored in the single-machine database to an unaccepted status, and to send a client message confirmation receipt to the external system if the internal storage area is full, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full.
[0363] The message server is also used to receive messages to be processed and to process those messages.
[0364] The main thread unit is also used to store the messages to be processed into the internal storage area if the internal storage area is not full, set the status of the messages to be processed in the internal storage area to be unaccepted, and send a client message confirmation receipt to the external system.
[0365] The asynchronous message storage confirmation thread unit is also used to retrieve the internal storage area according to the first preset time to obtain the first batch of messages in the internal storage area that are in an unaccepted state;
[0366] The asynchronous message storage confirmation thread unit is also used to store the first batch of messages into the single-machine database and set the status of the first batch of messages in the single-machine database to be unaccepted.
[0367] The asynchronous message storage confirmation thread unit is also used to retrieve the second batch of messages that are in an unaccepted state in the single-machine database and send the second batch of messages to the message server for processing;
[0368] The message server is also used to process the second batch of messages and send the message message indicating that the processing of the second batch of messages is complete to the message client.
[0369] The asynchronous message storage confirmation thread unit is also used to receive a processing completion message sent by the message server, set the status of the second batch of messages in the single-machine database to the accepted status, and clear the first batch of messages stored in the internal storage area.
[0370] This application embodiment improves the processing capability of receiving a large number of messages instantly by cooperating with the message client and the message server, avoids message loss, solves the problem of handling duplicate messages and the storage problem when message processing fails, improves the efficiency of message processing, and can be used with existing mainstream middleware products to improve the shortcomings of existing mainstream middleware products.
[0371] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, equivalent variations made in accordance with the claims of this application still fall within the scope of this application.
Claims
1. A process-oriented message middleware processing method, characterized in that, The method includes a main processing flow S1 and an asynchronous message storage confirmation processing flow S2; The main processing flow S1 includes: S11. The main thread of the message client receives pending messages sent by external systems; S12. The main thread determines whether the message to be processed belongs to the first message level; If the message to be processed belongs to the first message level, proceed to step S13; Otherwise, proceed to step S14; S13. The main thread sends the message to be processed to the message server for processing. After receiving the processing completion message sent by the message server, step S17 is executed. S14. The main thread determines whether the internal storage area of the message client is full; If the internal storage area is full, proceed to step S15; If the internal storage area is not full, proceed to step S16; S15. The main thread determines whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed in the single-machine database to an unaccepted status, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full, and executes step S17. S16. The main thread stores the message to be processed into the internal storage area and sets the status of the message to be processed in the internal storage area to be unaccepted. Then, step S17 is executed. S17. The main thread sends a client message confirmation receipt to the external system. The asynchronous message storage confirmation process S2 includes: S21. The asynchronous message storage confirmation thread of the message client retrieves the internal storage area according to a first preset time to obtain the first batch of messages in the internal storage area that are in an unaccepted state. S22. The asynchronous message storage confirmation thread stores the first batch of messages into the single-machine database and sets the status of the first batch of messages in the single-machine database to an unaccepted status. S23. The asynchronous message storage confirmation thread retrieves the second batch of messages that are in an unaccepted state from the single-machine database and sends the second batch of messages to the message server for processing. S24. The asynchronous message storage confirmation thread receives the processing completion message sent by the message server, sets the status of the second batch of messages in the single-machine database to the accepted status, and clears the first batch of messages stored in the internal storage area.
2. The method according to claim 1, characterized in that, The method further includes an asynchronous message subscription confirmation processing flow S3, which includes: S31. The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain messages in the single-machine database that are in the accepted state. S32. The asynchronous message subscription confirmation processing thread sends the message in the accepted state to the message server. S33. The message server sets the status of the message in the accepted state in the message database to the subscribing state, and determines whether the message in the accepted state has been subscribed to. If the message in the accepted state has been subscribed to, proceed to step S34; If the message in the accepted state is not subscribed to, the processing of the message in the accepted state ends; S34. Set the status of the message in the accepted state in the message database to the subscribed state; S35. The message server sends the message that needs to subscribe to the receipt and is in the accepted state to the asynchronous message subscription confirmation processing thread for processing.
3. The method according to claim 1, characterized in that, Step S15 specifically includes: S151, The main thread determines whether the message to be processed belongs to the second message level; If the message to be processed does not belong to the second message level, proceed to step S152; If the message to be processed belongs to the second message level, the main thread sends the message to be processed to the message server for processing, and executes step S17. S152, The main thread determines whether the single-machine database is full; If the single-machine database is full, the main thread will send the message to be processed to the message server for processing, and execute step S17; If the single-machine database is not full, the main thread stores the message to be processed in the single-machine database, sets the status of the message to be processed in the single-machine database to an unprocessed state, and sends a client message confirmation receipt to the external system.
4. The method according to claim 1 or 3, characterized in that, After sending the message to be processed to the message server for processing, the process further includes: The message server stores the message to be processed in its message database, sets the status of the message to be processed in the message database to "not accepted", and then sends a processing completion message to the main thread.
5. The method according to claim 1, characterized in that, Step S16 further includes: S161. After the main thread sets the status of the message to be processed in the internal storage area to be unaccepted, it determines whether the message to be processed belongs to the second message level. If the message to be processed belongs to the second message level, proceed to step S162; Otherwise, the main thread sends a client message confirmation receipt to the external system; S162. The main thread determines whether there is a duplicate message in the internal storage area of the message to be processed; If a duplicate message exists, the message to be processed is removed from the memory storage area, and step S17 is executed; Otherwise, the message to be processed is stored in the standalone database, the status of the message to be processed in the standalone database is set to unaccepted, and step S17 is executed.
6. The method according to claim 2, characterized in that, Before step S33, the following also includes: The message server determines whether the message in the accepted state has a preceding message; If the message in the accepted state does not have a preceding message, proceed to step S33. If the message in the accepted state has a predecessor message, the message server determines whether the predecessor message of the message in the accepted state has been subscribed to. If the preceding message of the message in the accepted state has been subscribed, proceed to step S33; If the preceding message of the message in the accepted state has not been subscribed to, the processing of the message in the accepted state ends.
7. The method according to claim 2, characterized in that, Step S34 also includes: The message server determines that if there is a follow-up message to the message that is in the accepted state, it sets the status of the follow-up message to be subscribed to in the message database.
8. The method according to claim 2, characterized in that, Step S35 specifically includes: S351. The message server determines whether the message in the accepted state needs to subscribe to a receipt. If the message in the accepted state requires a receipt subscription, proceed to step S352; If the message in the accepted state does not require subscription receipt, proceed to step S353; S352. The message server determines whether it has received the subscription message receipt for the message in the accepted state; If received, proceed to step S353; If not received, the processing of the message in the accepted state ends; S353, The message server sends a subscribed message to the asynchronous message subscription confirmation processing thread; After receiving the message that has been subscribed, the asynchronous message subscription confirmation processing thread sets the status of the message in the accepted state to the subscribed state in the single-machine database.
9. The method according to claim 2, characterized in that, The asynchronous message subscription confirmation process S3 also includes: S31' The asynchronous message subscription confirmation processing thread of the message client polls the single-machine database according to the second preset time to obtain messages in the single-machine database that are in an unaccepted state; S32' Determine whether the message in the unaccepted state has exceeded a preset time; If a message in an unaccepted state exceeds a preset time, the message in the unaccepted state will be moved to the failure database of the message client's standalone database. If the message in the unaccepted state does not exceed the preset time, the processing of the message in the unaccepted state ends.
10. The method according to claim 9, characterized in that, The method further includes an asynchronous message cleanup process S4, which includes: The asynchronous message cleanup thread of the message client polls the single-machine database at a third preset time to clean up messages in the single-machine database that are in the subscribed state; The message server polls the message database at a fourth preset time interval and cleans up messages in the message database that are already subscribed.
11. A process-oriented message middleware processing device, characterized in that, The device includes a main processing module and an asynchronous message storage confirmation processing module; The main processing module includes: The first processing unit is used to receive messages to be processed sent by external systems; The second processing unit is used to determine whether the message to be processed belongs to the first message level; The third processing unit is used to send the message to be processed to the message server for processing if the message to be processed belongs to the first message level, and after receiving the processing completion message sent by the message server, send a client message confirmation receipt to the external system. The fourth processing unit is used to determine whether the internal storage area of the message client is full if the message to be processed does not belong to the first message level. The fifth processing unit is used to determine whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed in the single-machine database to an unaccepted status, and to send a client message confirmation receipt to the external system if the internal storage area is full, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full. The sixth processing unit is used to store the message to be processed into the internal storage area if the internal storage area is not full, set the status of the message to be processed in the internal storage area to be unaccepted, and send a client message confirmation receipt to the external system. The asynchronous message storage confirmation processing module includes: The seventh processing unit is used to retrieve the internal storage area according to a first preset time to obtain the first batch of messages in the internal storage area that are in an unprocessed state; The eighth processing unit is used to store the first batch of messages into the standalone database and set the status of the first batch of messages in the standalone database to be unaccepted. The ninth processing unit is used to retrieve the second batch of messages that are in an unaccepted state from the single-machine database and send the second batch of messages to the message server for processing; The tenth processing unit is used to receive a processing completion message sent by the message server, set the status of the second batch of messages in the single-machine database to the accepted status, and clear the first batch of messages stored in the internal storage area.
12. A message middleware system, characterized in that, The message middleware system includes a message client and a message server. The message client includes a main thread unit and an asynchronous message storage confirmation thread unit. The main thread unit is used to receive messages to be processed sent by external systems; The main thread unit is also used to determine whether the message to be processed belongs to the first message level; The main thread unit is also used to send the message to be processed to the message server for processing if the message to be processed belongs to the first message level. The message server is used to send a processing completion message to the message client after processing the message to be processed; The main thread unit is also used to send a client message confirmation receipt to the external system after receiving the processing completion message; The main thread unit is also used to determine whether the internal storage area of the message client is full if the message to be processed does not belong to the first message level. The main thread unit is also used to determine whether to send the message to be processed to the message server for processing, and whether to store the message to be processed in the single-machine database and set the status of the message to be processed already stored in the single-machine database to an unaccepted status, and to send a client message confirmation receipt to the external system if the internal storage area is full, based on whether the message to be processed belongs to the second message level and whether the single-machine database of the message client is full. The message server is also used to receive the message to be processed and to process the message to be processed. The main thread unit is also used to store the message to be processed into the internal storage area if the internal storage area is not full, set the status of the message to be processed in the internal storage area to be unaccepted, and send a client message confirmation receipt to the external system. The asynchronous message storage confirmation thread unit is also used to retrieve the internal storage area according to a first preset time to obtain the first batch of messages in the internal storage area that are in an unaccepted state; The asynchronous message storage confirmation thread unit is also used to store the first batch of messages into the single-machine database and set the status of the first batch of messages in the single-machine database to be unaccepted. The asynchronous message storage confirmation thread unit is also used to retrieve the second batch of messages that are in an unaccepted state in the single-machine database and send the second batch of messages to the message server for processing; The message server is also used to process the second batch of messages and send a message indicating that the processing of the second batch of messages is complete to the message client. The asynchronous message storage confirmation thread unit is also used to receive the processing completion message sent by the message server, set the status of the second batch of messages in the single-machine database to the accepted status, and clear the first batch of messages stored in the internal storage area.
Citation Information
Patent Citations
Message queue-based processing method and message queue
CN110968430A
Message queue proxy method and device
CN115334155A