Message sending method, device and system based on message middleware
Through the message configuration server, the message middleware cluster is detected and state-managed, and the message distribution strategy is automatically determined, which solves the problem of fault handling caused by untimely management by operation and maintenance personnel, and ensures the normality and efficiency of message transmission.
Patent Information
- Application Number
- CN202310787939.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
AI Technical Summary
When using message middleware to transmit messages, the management methods of operation and maintenance personnel are prone to error operations or failure discovery and failure handling in time, resulting in abnormal message transmission.
Through the message configuration server, the message middleware cluster is uniformly configured and managed, the availability detection and message backlog detection are performed, the status of the message middleware is determined based on the detection results, and the message distribution strategy is determined based on the status to achieve automated message distribution.
Avoid the problem of failing to detect and deal with faults in time during manual management, ensure the normal sending of request messages, reduce the problem of accidentally sending messages to fault middleware caused by untimely failure discovery, and improve the reliability of message transmission and efficiency.
Smart Images

Figure CN119232781A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of message processing, and in particular to a message sending method, device and system based on message middleware. Background Art
[0002] In some business scenarios, message transmission between business systems needs to be implemented through message middleware. For example, in a typical application scenario, when the clearing system submits the clearing instruction to the payment system, it needs to transmit the message through message middleware.
[0003] Generally, when using message middleware for message transmission, multiple message middleware can be deployed in multiple locations, that is, a message middleware cluster can be deployed, and the operation and maintenance personnel can manage the message middleware cluster through the management background. For example, the operation and maintenance personnel manually detect whether the message middleware has a fault, and when a certain message middleware is found to have a fault, the faulty message middleware is removed through the management background, that is, the faulty message middleware is not used to send messages, and other message middleware is used for message transmission. However, the way in which the operation and maintenance personnel manage the message middleware cluster is prone to misoperation or untimely fault detection and fault handling. Summary of the invention
[0004] The embodiments of the present application provide a message sending method, device and system based on message middleware, which are used to solve the problem that misoperation or untimely fault discovery and fault handling are prone to occur when operation and maintenance personnel manage the message middleware cluster through the management background.
[0005] To solve the above technical problems, the embodiments of the present application are implemented as follows:
[0006] In a first aspect, a message sending method based on a message middleware is proposed, which is applied to a message configuration server. The method includes:
[0007] Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system;
[0008] Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog;
[0009] A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0010] In a second aspect, a message sending device based on a message middleware is proposed, comprising:
[0011] A detection module, which detects multiple message middlewares in a message middleware cluster, wherein the detection includes availability detection and message backlog detection, and the message middleware cluster is used to forward a request message of a first business system to a second business system;
[0012] A first determination module inputs the availability detection result and the message backlog detection result into a state machine, and determines the state of the plurality of message middlewares according to the state machine, wherein the state includes at least one of normal, disabled, unavailable, and message backlog;
[0013] The second determining module determines a message distribution strategy according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0014] In a third aspect, an electronic device is provided, the electronic device comprising:
[0015] Processor; and
[0016] A memory arranged to store computer executable instructions which, when executed, cause the processor to:
[0017] Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system;
[0018] Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog;
[0019] A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0020] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device performs the following method:
[0021] Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system;
[0022] Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog;
[0023] A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0024] In a fifth aspect, a message sending system based on a message middleware is proposed, comprising a first business system, a message middleware cluster, a second business system and a message configuration server, wherein the message middleware cluster is used to forward a request message of the first business system to the second business system, wherein:
[0025] The message configuration server detects multiple message middleware in the message middleware cluster, wherein the detection includes availability detection and message backlog detection; inputs the availability detection result and the message backlog detection result into a state machine, and determines the status of the multiple message middleware according to the state machine, wherein the status includes at least one of normal, disabled, unavailable and message backlog; and determines a message distribution strategy according to the status of the multiple message middleware;
[0026] The message middleware cluster receives a request message from the first business system according to the message distribution strategy; and forwards the request message to the second business system;
[0027] The second business system receives the request message from the message middleware cluster; and performs business processing based on the request message.
[0028] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0029] In the embodiment of the present application, the message configuration server can uniformly configure and manage multiple message middlewares in the message middleware cluster, and the message configuration server can perform availability detection and message backlog detection on multiple message middlewares, determine the status of multiple message middlewares according to the detection results, and determine the message distribution strategy according to the status of multiple message middlewares. In this way, since the message configuration server can be used to perform availability detection and message backlog detection on multiple message middlewares and determine the status of the message middleware according to the detection results, the status of multiple message middlewares can be obtained in time, thereby avoiding the problem of not being able to timely discover and handle faults during manual management. In addition, since when the request message of the first business system is sent to the message middleware, the message distribution strategy can be determined according to the status of the message middleware obtained in time, and the message is distributed according to the message distribution strategy, therefore, the problem of mistakenly sending the request message to the faulty message middleware due to untimely fault discovery can also be avoided, ensuring the normal sending of the request message. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0031] Figure 1 It is a schematic diagram of a schematic system architecture provided in an embodiment of the present application;
[0032] Figure 2 It is a flowchart of a message sending method based on message middleware in one embodiment of the present application;
[0033] Figure 3 is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;
[0034] Figure 4 It is a structural diagram of a message sending device based on message middleware in one embodiment of the present application;
[0035] Figure 5 It is a flowchart of a message sending system based on message middleware in one embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0037] Message middleware, also known as MQ, is a supporting software system based on queue and message passing technology that provides synchronous or asynchronous, reliable message transmission for application systems in a network environment. Message middleware uses efficient and reliable message passing mechanisms for platform-independent data exchange and integrates distributed systems based on data communication. By providing message passing and message queuing models, it can expand inter-process communication in a distributed environment.
[0038] At present, in the scenario where the first business system uses a message middleware cluster to send a request message to the second business system, when managing the message middleware, the operation and maintenance personnel usually manage the message middleware through the management background. However, the manual operation and maintenance method is prone to operational errors, and requires approval and review at all levels, resulting in high labor costs and low efficiency in fault handling. In addition, for sudden failures of dedicated lines, the operation and maintenance personnel may not be able to discover them in time, so they need to rely entirely on automatic retries after the request message fails to be sent to discover the failure, resulting in invalid message sending. In addition, for message middleware with backlogs, the sender will still send messages to the message middleware, but the message middleware is actually unable to forward the message correctly, which will cause request losses.
[0039] In order to solve the above technical problems, the embodiment of the present application provides a message sending method, device and system based on message middleware, wherein a message configuration server can uniformly configure and manage multiple message middleware in a message middleware cluster, and the message configuration server can perform availability detection and message backlog detection on multiple message middleware, determine the status of multiple message middleware according to the detection results, and determine the message distribution strategy according to the status of multiple message middleware. In this way, since the message configuration server can be used to perform availability detection and message backlog detection on multiple message middleware and determine the status of the message middleware according to the detection results, the status of multiple message middleware can be obtained in time, thereby avoiding the problem of being unable to timely discover and handle faults during manual management. In addition, since when sending the request message of the first business system to the message middleware, the message distribution strategy can be determined according to the status of the message middleware obtained in time, and the message is distributed according to the message distribution strategy, therefore, the problem of mistakenly sending the request message to the faulty message middleware due to untimely fault discovery can also be avoided, thereby ensuring the normal sending of the request message.
[0040] It should be noted that the application scenario of the embodiment of the present application may be that the first business system sends a request message to the second business system through a message middleware cluster. In a typical application scenario, the first business system may be a transaction clearing system, the second business system may be a payment system, and the request message may be a clearing instruction.
[0041] It should also be noted that the message configuration server in the embodiment of the present application can be independent of the first business system, the second business system and the message middleware cluster, or it can be integrated in a module of the first business system, which is not specifically limited here.
[0042] Combine the following Figure 1 A possible application scenario of the technical solution provided in the embodiment of the present application is described.
[0043] Figure 1 is a schematic diagram of a system architecture provided in an embodiment of the present application, Figure 1 The system architecture shown includes a first business system 11, a message middleware cluster 12, and a second business system 13. The first business system 11 is integrated with a message configuration server 111, and the message middleware cluster 12 includes multiple message middlewares ( Figure 1 Not shown), multiple message middlewares can be deployed in multiple regions. Figure 1 In the example, when the first business system 11 transmits messages with the second business system 13 , the first business system 11 may send a request message to multiple message middlewares in the message middleware cluster 12 , and the multiple message middlewares may forward the request message to the second business system 13 .
[0044] Figure 1 The message configuration server 111 shown can uniformly configure and manage multiple message middlewares in the message middleware cluster 12. Specifically, the message configuration server 111 can perform availability detection and message backlog detection on multiple message middlewares, determine the status of multiple message middlewares according to the detection results, and the status can be, for example, normal, disabled, unavailable, and message backlog, and then determine the message distribution strategy according to the status of multiple message middlewares, and send the request message of the first business system 11 to multiple message middlewares based on the message distribution strategy. For example, for a certain message middleware, if the status of the message middleware is normal, the request message can be sent to the message middleware so that the message middleware forwards the request message to the second business system 13. If the status of the message middleware is disabled or unavailable, the request message may not be sent to the message middleware. If the status of the message middleware is message backlog, the request message may be sent to the message middleware after a set period of time, or the request message may not be sent to the message middleware.
[0045] In this way, since the message configuration server can be used to perform availability detection and message backlog detection on multiple message middlewares and determine the status of the message middleware based on the detection results, the status of multiple message middlewares can be obtained in time, thereby avoiding the problem of not being able to discover and handle faults in time during manual management. In addition, when the request message of the first business system is sent to the message middleware, the message distribution strategy can be determined according to the status of the message middleware obtained in time, and the message is distributed according to the message distribution strategy. Therefore, the problem of mistakenly sending the request message to the faulty message middleware due to untimely fault discovery can be avoided, thereby ensuring the normal sending of the request message.
[0046] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0047] Figure 2 It is a flowchart of a message sending method based on message middleware according to an embodiment of the present application. Figure 2 The execution subject of the embodiment shown may be Figure 1 The message configuration server 111 shown, Figure 2 The method shown is described below.
[0048] S202: Detect multiple message middlewares in the message middleware cluster, including availability detection and message backlog detection. The message middleware cluster is used to forward the request message of the first business system to the second business system.
[0049] In S202, in a scenario where the first business system sends a request message to the second business system through a message middleware cluster (including multiple message middlewares, which can be deployed in multiple areas), that is, in a scenario where the message middleware cluster forwards the request message of the first business system to the second business system, the message configuration server can perform availability detection and message backlog detection on multiple message middlewares in the message middleware cluster.
[0050] The first business system may be a transaction system, the second business system may be a payment system, and the request message may be a clearing request. In this embodiment, the message configuration server may periodically perform availability detection and message backlog detection on multiple message middlewares, for example, multiple message middlewares may be detected once per second. Of course, the message configuration server may also perform irregular detection on multiple message middlewares according to actual business needs, which is not specifically limited here.
[0051] When performing availability detection on multiple message middlewares, optionally, for each message middleware, it can be detected whether the message middleware can successfully receive and forward the request message. If the message middleware can successfully receive and forward the request message, it can be said that the message middleware has not failed, and it can be determined that the message middleware is available. On the contrary, if the message middleware cannot successfully receive or forward the request message, it can be said that the message middleware has failed, and it can be determined that the message middleware is unavailable.
[0052] When performing message backlog detection on multiple message middlewares, optionally, for each message middleware, it is possible to detect whether the number of messages to be sent cached in the message middleware exceeds a preset number. Specifically, the number of messages to be sent cached in the message queue of the message middleware can be detected first, and then it is determined whether the number of messages to be sent exceeds the preset number. If it exceeds, it can be determined that there is a message backlog in the message middleware; if it does not exceed, it can be determined that there is no message backlog in the message middleware. Among them, the preset number can be set according to the actual situation, and no specific limitation is made here.
[0053] After performing availability detection and message backlog detection on multiple message middlewares, availability detection results and message backlog detection results can be obtained. The availability detection results can include whether each message middleware in the multiple message middlewares is available. The message backlog detection results can include whether messages of each message middleware in the multiple message middlewares are backlogged.
[0054] S204: Input the availability detection result and the message backlog detection result into a state machine, and determine the states of the multiple message middlewares according to the state machine. The states of the multiple message middlewares include at least one of normal, disabled, unavailable, and message backlog.
[0055] After obtaining the availability detection results and message backlog detection results of multiple message middlewares, these detection results can be input into the state machine, and the states of the multiple message middlewares can be determined according to the state machine. Among them, for each message middleware, the state of the message middleware can include at least one of normal, disabled, unavailable and message backlog. Normal means that the message middleware can receive and forward messages normally, disabled means that the message middleware has been disabled, unavailable means that the message middleware cannot successfully receive or forward messages, and message backlog means that there are many unsent messages in the message middleware.
[0056] When determining the states of multiple message middlewares according to the state machine, for each message middleware, the state of the message middleware can be determined according to the availability detection result and the message backlog detection result of the message middleware. Specifically, at least one of the following (1) to (3) can be included:
[0057] (1) When the availability detection result is available and the message backlog detection result is that there is no message backlog, it can be determined that the status of the message middleware is normal.
[0058] The availability of the message middleware indicates that the message middleware can successfully receive and forward messages. If the message middleware is available and there is no message backlog, the status of the message middleware is considered normal.
[0059] (2) When the availability detection result is available and the message backlog detection result is message backlog, determine that the state of the message middleware is message backlog.
[0060] When the availability detection result is available and the message backlog detection result is message backlog, it can be explained that the message middleware can receive and forward messages normally, but there are many messages to be sent. At this time, it can be determined that the status of the message middleware is message backlog.
[0061] (3) When the availability detection result is unavailable, determine that the status of the message middleware is unavailable.
[0062] When the availability detection result is unavailable, it can be explained that the message middleware cannot successfully receive or forward the request message. In this case, it can be determined that the status of the message middleware is unavailable.
[0063] Optionally, considering that in the case of unavailable message middleware, the request message is usually not sent to the message middleware. In this way, when all the message middleware in the message middleware cluster are unavailable, the request message cannot be sent to the second business system through the message middleware cluster, resulting in business interruption, and the actual business demand does not expect this situation. Therefore, it is necessary to ensure that the message middleware cluster includes message middleware with normal status to avoid determining the status of all message middleware in the message middleware cluster as unavailable. In order to achieve this purpose, for each message middleware, when its availability detection result is unavailable, it can be further determined whether the number of message middlewares with normal status in the message middleware cluster is greater than or equal to a preset threshold. If so, the status of the message middleware can be determined as unavailable, otherwise, the status of the message middleware can not be determined as unavailable. Optionally, the current status of the message middleware can be maintained unchanged, or its status can be determined as message backlog, thereby avoiding the problem of business interruption caused by setting all the message middleware in the message middleware cluster to unavailable.
[0064] The above preset threshold can be a value greater than 0 and less than the total number of message middlewares, and can be set according to actual business needs, and is not specifically limited here. For example, if the total number of message middlewares is 6, the preset threshold can be 2 or 3.
[0065] Optionally, in one implementation, the status of multiple message middlewares can also be set by a user (such as an operation and maintenance personnel, etc.). Specifically, the user can set the status of one or more target message middlewares among the multiple message middlewares according to the usage requirements of the multiple message middlewares, and then send a trigger instruction for the target message middleware to the message configuration server, and the trigger instruction can indicate the status of the target message middleware. After receiving the trigger instruction, the message configuration server can set the status of the target message middleware to the status indicated by the trigger instruction.
[0066] The state indicated by the trigger instruction can be normal or disabled. That is to say, the user can actively enable or disable one or more target message middleware according to actual business needs, and specify the state of the target message middleware as normal or disabled. For example, when a message middleware needs to be repaired, the user can disable the message middleware in advance and specify its state as disabled. For another example, when a message middleware is added to the message middleware cluster, the user can actively enable the message middleware and specify its state as normal. When the user actively enables or disables a message middleware, the user can operate the message middleware in the operation interface used to manage the message middleware. When the user's enable or disable operation is approved, it can be regarded as initiating a trigger instruction for the message middleware to the message configuration server. The trigger instruction can be used to indicate the enablement or disablement of a message middleware, that is, to indicate that the state of the message middleware is normal or disabled.
[0067] Optionally, in an implementation, before determining the states of the multiple message middlewares according to the detection results, the multiple message middlewares may have initial states, which may be at least one of normal, unavailable, message backlog, and deactivated. Thus, when determining the states of the multiple message middlewares according to the state machine, at least one of the following may be included:
[0068] For the message middleware in the disabled state, maintain the disabled state of the message middleware;
[0069] For message middleware in other states, the state of the message middleware is determined based on the availability detection results and the message backlog detection results.
[0070] Specifically, for message middleware in a disabled state, since its disabled state is generally changed manually by the user, when the state of these message middleware is determined according to the state machine, its disabled state can continue to be maintained. Optionally, if a trigger instruction from the user for a message middleware in a disabled state is received, its state can be determined according to the trigger instruction. For example, if the trigger instruction indicates that the state of the message middleware is disabled, the disabled state of the message middleware can continue to be maintained; if the trigger instruction indicates that the state of the message middleware is normal, the state of the message middleware can be switched from disabled to normal. In this way, the user can implement the state change of the message middleware in a disabled state, thereby satisfying the user's use requirements for the message middleware.
[0071] The above-mentioned other states may be normal, unavailable, and message backlog. For message middleware in other states, when determining the states of these message middleware according to the state machine, the states of these message middleware may be updated according to the state machine. Among them, when updating the states of these message middleware according to the state machine, the states of the message middleware may be determined according to the availability detection results and message backlog detection results of these message middleware, and the previous states of the message middleware may be updated to the states obtained according to the availability detection results and message backlog detection results. For example, if the previous state of the message middleware was normal, after performing the availability detection and message backlog detection, the detection results are available and the messages are backlogged, then the state of the message middleware may be switched from normal to message backlog. For another example, if the previous state of the message middleware was message backlog, after performing the availability detection and message backlog detection, the detection results are available and the messages are not backlogged, then the state of the message middleware may be switched from message backlog to normal.
[0072] Optionally, for message middleware in other states, when updating its state, if a trigger instruction from the user for these message middleware is received, the state of the message middleware can be determined according to the trigger instruction, without having to determine its state according to the availability detection results and the message backlog detection results. Specifically, if the trigger instruction indicates that the state of the message middleware is disabled, the state of the message middleware can be updated from the previous state to disabled; if the trigger instruction indicates that the state of the message middleware is normal, the state of the message middleware can be updated from the previous state to normal. In this way, the user can implement the state change of the message middleware in the normal, unavailable and message backlog states, thereby meeting the user's use requirements for the message middleware.
[0073] It should be noted that, considering that the detection results for the same message middleware may include multiple types, different detection results may obtain different states, and the user may also change the state of the message middleware through a trigger instruction. Therefore, in order to avoid obtaining multiple states for a message middleware, this embodiment may set a priority for the user's trigger instruction and different detection results, and determine the state of the message middleware according to the priority. Optionally, the state indicated by the trigger instruction may be set to have the highest priority, and the unavailable priority is higher than the message backlog. In this way, for a certain message middleware, when determining the state of the message middleware, if a trigger instruction for the message middleware is received, then, regardless of whether the message middleware is available or whether there is a message backlog, the state of the message middleware will be determined as the state indicated by the trigger instruction. If the detection result of the message middleware is unavailable and no trigger instruction for the message middleware is received, then, regardless of whether the message middleware has a message backlog, the state of the message middleware will be determined as unavailable.
[0074] Optionally, as an embodiment, after determining the status of the message middleware, if the status of the message middleware has changed compared to the previous status, an alarm can be issued so that the operation and maintenance personnel can know the message middleware whose status has changed and then manage the message middleware. For example, if the status of a message middleware changes from normal to unavailable, an alarm can be issued to the operation and maintenance personnel so that the operation and maintenance personnel can repair the unavailable message middleware.
[0075] S206: Determine a message distribution strategy according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0076] After determining the status of multiple message middlewares in the message middleware cluster, a message distribution strategy can be determined according to the status of the multiple message middlewares, so that the first business system can send a request message to the message middleware cluster based on the message distribution strategy, and the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0077] In the embodiment of the present application, for each message middleware, after determining its status, it can be determined whether to send a request message of the first business system to the message middleware according to the status. The details are as follows:
[0078] When the status of the message middleware is normal, a request message is sent to the message middleware. Specifically, if the status of the message middleware is normal, it can be said that the message middleware is available and there is no message backlog. At this time, a request message can be sent to the message middleware, and the message middleware can normally receive the request message and send the request message to the second business system.
[0079] When the status of the message middleware is manually deactivated, cancel sending the request message to the message middleware. Specifically, if the status of the message middleware is manually deactivated, it means that the message middleware cannot receive the request message or send the request message to the second business system. At this time, the request message may not be sent to the message middleware to avoid the problem of message sending failure caused by the request message being sent to the message middleware but not being sent to the second business system normally.
[0080] In the case where the status of the message middleware is unavailable or the message is backlogged, cancel sending the request message to the message middleware, or determine whether to send the request message to the message middleware according to the preset rules. Specifically, in the case where the status of the message middleware is unavailable or the message is backlogged, there are two options. One option is not to send a request message to the message middleware to avoid the problem that the request message cannot be sent normally to the second business system after being sent to the message middleware. The other option is to determine whether to send a request message to the message middleware according to the preset rules. The preset rules can be determined according to actual business needs and are not specifically limited here. Optionally, the preset rule can be to determine whether the status of other message middleware in the message middleware cluster is all unavailable. If the judgment result is yes, a request message can be sent to the message middleware to avoid business interruption. If the judgment result is no, a request message can be not sent to the message middleware to avoid the problem that the request message cannot be sent normally to the second business system after being sent to the message middleware. Alternatively, the preset rule may also be to determine whether the number of message middlewares in the message middleware cluster that are in normal status and have message backlogs is less than a preset value. If the judgment result is yes, a request message may be sent to the message middleware to ensure the smooth progress of the business. If the judgment result is no, a request message may not be sent to the message middleware to avoid the problem that the request message cannot be sent normally to the second business system after being sent to the message middleware.
[0081] Based on the above content, when sending the request message of the first business system, different message distribution strategies can be set according to the states of multiple message middlewares.
[0082] Optionally, in the case where the states of multiple message middlewares include normal, message backlog, and unavailable, the message distribution strategy may include: taking normal, message backlog, and unavailable as the priority order from high to low, so that the message middlewares in normal, message backlog, and unavailable states receive the request message of the first business system in the order of priority. That is, if the message middleware cluster includes message middlewares in the states of normal, message backlog, and unavailable, when distributing messages, the request message may be sent to the message middleware in the normal state first. If the normal message middleware cannot meet the business needs, the request message may be sent to the message middleware in the message backlog state. If the business needs are still not met, the request message may be sent to the message middleware in the unavailable state to ensure the smooth progress of the business.
[0083] Optionally, in the case where the states of multiple message middlewares include normal and message backlog, the message distribution strategy may include: taking normal and message backlog as the priority order from high to low, so that the message middlewares in the normal and message backlog states receive the request message of the first business system in the order of priority. That is, if the message middleware cluster includes message middlewares in the normal and message backlog states, when distributing messages, the request message may be sent to the message middleware in the normal state first. If the normal message middleware cannot meet the business requirements, the request message may be sent to the message middleware in the message backlog state to ensure the smooth progress of the business.
[0084] Optionally, as an embodiment, the message distribution strategy may also be determined by the following steps:
[0085] For each sending end in the first business system, counting the time taken by the sending end to send request messages to multiple message middlewares;
[0086] Determine the traffic distribution ratio of the sender sending request messages to multiple message middlewares based on the time consumption;
[0087] Determine the message distribution strategy according to the traffic distribution ratio.
[0088] The multiple message middlewares here can be multiple message middlewares to which request messages are sent according to the status confirmation of the message middleware. The multiple sending ends can be multiple sending ends in the first business system for sending request messages to the message middleware, such as applications, etc. Considering that multiple message middlewares are deployed in multiple different areas, each sending end has a cross-region situation when sending request messages to multiple message middlewares, and it takes a long time to send request messages across regions. Therefore, in order to reduce the time consumption, this embodiment can count the time consumption of the sending end sending request messages to multiple message middlewares for each sending end in the first business system, and determine the traffic distribution ratio of the sending end sending request messages to multiple message middlewares according to the time consumption of the sending end sending request messages to each message middleware. The traffic distribution ratio can be the ratio of the number of request messages sent by the sending end to multiple message middlewares, wherein the shorter the time consumption of the sending end sending to the message middleware, the higher the traffic distribution ratio corresponding to the message middleware, that is, the traffic distribution ratio is inversely proportional to the time consumption. After determining the traffic distribution ratio of multiple message middlewares, the message distribution strategy can be determined according to the traffic distribution ratio. The message distribution strategy here can be to determine the number of request messages sent to each message middleware according to the traffic distribution ratio of multiple message middlewares, and send the request message of the sender to the corresponding message middleware according to the number of messages. In this way, the time spent on sending the request message to the message middleware can be reduced, and the pressure of cross-regional traffic can be effectively reduced to maintain the stability of the system.
[0089] Assume that multiple message middlewares are MQ1 to MQ6, MQ1 and MQ2 are deployed in area 1, the corresponding local application is 31, MQ3 and MQ4 are deployed in area 2, MQ5 and MQ6 are deployed in area 3, the corresponding local application is 10, the time taken for application 31 and application 10 to send request messages to MQ1 to MQ6 respectively is shown in Table 1 below.
[0090] Table 1
[0091]
[0092] As can be seen from Table 1, for application 31, it takes a shorter time to send request messages to MQ1 and MQ2, and a longer time to send request messages to MQ3 to MQ6. Therefore, based on these time consumptions, it can be determined that the traffic distribution ratio of application 31 sending request messages to MQ1 to MQ6 can be approximately 100:100:1:1:1:1. Similarly, based on the time consumption of application 10 sending request messages to MQ1 to MQ6, it can be determined that the traffic distribution ratio of application 10 sending request messages to MQ1 to MQ6 can be approximately 2:2:3:3:42:42.
[0093] In this embodiment, after sending the request message of the first business system to multiple message middlewares, the multiple message middlewares can forward the request message to the second business system, and the second business system can perform business processing based on the request message. For example, if the request message is a settlement request, the second business system can perform transaction settlement based on the request message.
[0094] The technical solution provided by the embodiment of the present application can be configured and managed uniformly by the message configuration server for multiple message middleware in the message middleware cluster, and the message configuration server can perform availability detection and message backlog detection on multiple message middleware, determine the status of multiple message middleware according to the detection results, and determine the message distribution strategy according to the status of multiple message middleware. In this way, since the message configuration server can be used to perform availability detection and message backlog detection on multiple message middleware and determine the status of the message middleware according to the detection results, the status of multiple message middleware can be obtained in time, thereby avoiding the problem of not being able to find and handle faults in time during manual management. In addition, since when the request message of the first business system is sent to the message middleware, the message distribution strategy can be determined according to the status of the message middleware obtained in time, and the message is distributed according to the message distribution strategy, therefore, the problem of mistakenly sending the request message to the faulty message middleware due to untimely fault discovery can also be avoided, ensuring the normal sending of the request message. When sending request messages, the number of request messages sent to each message middleware can be allocated proportionally according to the time it takes each sender to send the request message. Therefore, not only can the time it takes to send the request message to the message middleware be reduced, but the pressure of cross-regional traffic can also be reduced, thereby maintaining the stability of the system.
[0095] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0096] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 3 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0097] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0098] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0099] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a message sending device based on the message middleware at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0100] Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system;
[0101] Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog;
[0102] A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0103] The above application Figure 3The method performed by the message sending device based on the message middleware disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0104] The electronic device may also perform Figure 2 Method, and realize the message sending device based on message middleware Figure 2 The functions in the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0105] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0106] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 2 The method of the embodiment shown is specifically used to perform the following operations:
[0107] Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system;
[0108] Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog;
[0109] A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0110] Figure 4 This is a schematic diagram of the structure of a message sending device 40 based on message middleware according to an embodiment of the present application. Figure 4 In a software implementation, the message sending device 40 based on the message middleware may include: a detection module 41, a first determination module 42 and a second determination module 43, wherein:
[0111] A detection module 41 detects multiple message middlewares in a message middleware cluster, wherein the detection includes availability detection and message backlog detection, and the message middleware cluster is used to forward a request message of a first business system to a second business system;
[0112] A first determination module 42 inputs the availability detection result and the message backlog detection result into a state machine, and determines the state of the plurality of message middlewares according to the state machine, wherein the state includes at least one of normal, disabled, unavailable, and message backlog;
[0113] The second determining module 43 determines a message distribution strategy according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
[0114] Optionally, as an embodiment, the detection module 41 further includes:
[0115] A trigger instruction for a target message middleware is received, and a state of the target message middleware is set to a state indicated by the trigger instruction.
[0116] Optionally, as an embodiment, the state indicated by the trigger instruction is normal or disabled; the first determining module 42 determines the states of the plurality of message middlewares according to the state machine, including at least one of the following:
[0117] For the message middleware in the disabled state, maintain the disabled state of the message middleware;
[0118] For message middleware in other states, the state of the message middleware is determined according to the availability detection result and the message backlog detection result, and the other states include normal, unavailable and message backlog.
[0119] Optionally, as an embodiment, the first determining module 42 determines the states of the plurality of message middlewares according to the state machine, including at least one of the following:
[0120] For each message middleware,
[0121] When the availability detection result is available and the message backlog detection result is not backlogged, determining that the state of the message middleware is normal;
[0122] When the availability detection result is available and the message backlog detection result is backlog, it is determined that the state of the message middleware is message backlog.
[0123] Optionally, as an embodiment, the first determining module 42 determines the states of the plurality of message middlewares according to the state machine, including:
[0124] For each message middleware, when the availability detection result is unavailable, determining the status of the message middleware as unavailable;
[0125] The message distribution strategy includes:
[0126] Normal, message backlog and unavailable are used as the priority order from high to low, so that the message middleware in the normal, message backlog and unavailable states receives the request message of the first business system according to the priority order.
[0127] Optionally, as an embodiment, the first determining module 42 determines the states of the plurality of message middlewares according to the state machine, including:
[0128] For each message middleware, if the availability detection result is unavailable, determine whether the number of message middlewares in the current normal state is greater than a preset threshold, if so, determine that the state of the message middleware is unavailable, otherwise do not change the current state of the message middleware;
[0129] The message distribution strategy includes:
[0130] Normal and message backlog are used as the priority order from high to low, so that the message middleware in the normal and message backlog states receives the request message of the first business system according to the priority order.
[0131] Optionally, as an embodiment, the message first determination module 42 further includes:
[0132] For each sending end in the first business system, counting the time taken by the sending end to send the request message to the multiple message middlewares;
[0133] Determine, according to the time consumption, a traffic allocation ratio for the sending end to send the request message to the multiple message middlewares;
[0134] The message distribution strategy is determined according to the traffic allocation ratio.
[0135] The message sending device 40 based on the message middleware provided in the embodiment of the present application can also execute Figure 2 Method, and realize the message sending device based on message middleware Figure 2 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0136] Figure 5 This is a flow chart of a message sending system 50 based on message middleware according to an embodiment of the present application. Figure 5 , Figure 5 The message sending system 50 based on the message middleware shown may include a first business system 51, a message middleware cluster 52, a second business system 53 and a message configuration server 54, wherein the message middleware cluster 52 is used to forward the request message of the first business system 51 to the second business system 53, wherein:
[0137] The message configuration server 54 detects the multiple message middleware in the message middleware cluster 52, wherein the detection includes availability detection and message backlog detection; inputs the availability detection result and the message backlog detection result into a state machine, and determines the status of the multiple message middleware according to the state machine, wherein the status includes at least one of normal, disabled, unavailable and message backlog; and determines the message distribution strategy according to the status of the multiple message middleware;
[0138] The message middleware cluster 52 receives the request message of the first business system 51 according to the message distribution strategy; forwards the request message to the second business system 53;
[0139] The second business system 53 receives the request message from the message middleware cluster 52 , and performs business processing based on the request message.
[0140] In this embodiment, the first business system 51 can implement the above Figure 2 In the embodiment shown, the first business system implements the functions, and the message middleware cluster 52 can implement the above Figure 2 In the embodiment shown, the message middleware cluster implements the functions. The second business system 53 can implement the above Figure 2In the embodiment shown, the second business system implements the function, and the message configuration server 54 can implement the above Figure 2 The functions implemented by the message configuration server in the embodiment shown in the figure can be seen in the above Figure 2 The specific implementation of the corresponding steps in the illustrated embodiment will not be described again here. The message configuration server 54 may be independent of the first business system 51 , the message middleware cluster 52 and the second business system 53 , or may be integrated into the first business system 51 . Figure 5 It is described by taking the example that the message configuration server 54 can be independent of the first business system 51 , the message middleware cluster 52 and the second business system 53 .
[0141] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0142] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0143] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0144] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0145] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A message sending method based on message middleware, characterized in that: Applicable to the message configuration server, including: Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system; Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog; A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
2. The method according to claim 1, characterized in that The method further comprises: A trigger instruction for a target message middleware is received, and a state of the target message middleware is set to a state indicated by the trigger instruction.
3. The method according to claim 2, characterized in that The state indicated by the trigger instruction is normal or disabled; and the determining the states of the plurality of message middlewares according to the state machine includes at least one of the following: For the message middleware in the disabled state, maintain the disabled state of the message middleware; For message middleware in other states, the state of the message middleware is determined according to the availability detection result and the message backlog detection result, and the other states include normal, unavailable and message backlog.
4. The method according to claim 1, characterized in that The determining the states of the plurality of message middlewares according to the state machine includes at least one of the following: For each message middleware: When the availability detection result is available and the message backlog detection result is not backlogged, determining that the state of the message middleware is normal; When the availability detection result is available and the message backlog detection result is backlog, it is determined that the state of the message middleware is message backlog.
5. The method according to claim 1, characterized in that The determining the states of the plurality of message middlewares according to the state machine includes: For each message middleware, when the availability detection result is unavailable, determining the status of the message middleware as unavailable; The message distribution strategy includes: Normal, message backlog and unavailable are used as the priority order from high to low, so that the message middleware in the normal, message backlog and unavailable states receives the request message of the first business system according to the priority order.
6. The method according to claim 1, characterized in that The determining the states of the plurality of message middlewares according to the state machine includes: For each message middleware, if the availability detection result is unavailable, determine whether the number of message middlewares in the current normal state is greater than a preset threshold, if so, determine that the state of the message middleware is unavailable, otherwise do not change the current state of the message middleware; The message distribution strategy includes: Normal and message backlog are used as the priority order from high to low, so that the message middleware in the normal and message backlog states receives the request message of the first business system according to the priority order.
7. The method according to claim 1, characterized in that The method further comprises: For each sending end in the first business system, counting the time taken by the sending end to send the request message to the multiple message middlewares; Determine, according to the time consumption, a traffic allocation ratio for the sending end to send the request message to the multiple message middlewares; The message distribution strategy is determined according to the traffic allocation ratio.
8. A message sending device based on message middleware, characterized in that: include: A detection module, which detects multiple message middlewares in a message middleware cluster, wherein the detection includes availability detection and message backlog detection, and the message middleware cluster is used to forward a request message of a first business system to a second business system; A first determination module inputs the availability detection result and the message backlog detection result into a state machine, and determines the state of the plurality of message middlewares according to the state machine, wherein the state includes at least one of normal, disabled, unavailable, and message backlog; The second determining module determines a message distribution strategy according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
9. An electronic device, characterized in that: include: processor; as well as A memory arranged to store computer executable instructions which, when executed, cause the processor to: Performing detection on multiple message middleware in a message middleware cluster, the detection including availability detection and message backlog detection, the message middleware cluster being used to forward a request message of a first business system to a second business system; Inputting the availability detection result and the message backlog detection result into a state machine, and determining the status of the plurality of message middlewares according to the state machine, wherein the status includes at least one of normal, disabled, unavailable, and message backlog; A message distribution strategy is determined according to the states of the plurality of message middlewares, so that the message middleware cluster receives the request message of the first business system according to the message distribution strategy.
10. A message sending system based on message middleware, characterized in that: It includes a first business system, a message middleware cluster, a second business system and a message configuration server, wherein the message middleware cluster is used to forward a request message of the first business system to the second business system, wherein: The message configuration server detects multiple message middleware in the message middleware cluster, wherein the detection includes availability detection and message backlog detection; inputs the availability detection result and the message backlog detection result into a state machine, and determines the status of the multiple message middleware according to the state machine, wherein the status includes at least one of normal, disabled, unavailable and message backlog; and determines a message distribution strategy according to the status of the multiple message middleware; The message middleware cluster receives a request message from the first business system according to the message distribution strategy; and forwards the request message to the second business system; The second business system receives the request message from the message middleware cluster; and performs business processing based on the request message.
