Remote multi-activity message processing method and device, computer equipment, storage medium and program product
By using routing identifiers and routing rules in off-site multi-live architectures, combined with message middleware clusters and logical consumption points, the problems of data consistency and failover complexity in traditional architectures are solved, and efficient and reliable service message processing and disaster recovery backup are achieved.
Patent Information
- Application Number
- CN202411766187.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-07
AI Technical Summary
The traditional off-site multi-live architecture is highly complex when implementing data consistency and failover, resulting in long recovery time and potentially threatening business continuity.
Through routing identifiers and routing rules, service messages are accurately allocated to the target data center, and the message middleware cluster and logical consumption points are used to ensure orderly processing of messages; when a failure occurs, quickly switch service traffic to the backup data center.
It improves the efficiency of business message processing, reduces the probability of message loss and duplicate processing, enhances the reliability of business processing, and realizes disaster recovery and backup, improving the stability and availability of the system.
Smart Images

Figure CN119576609A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a remote multi-active message processing method, device, computer equipment, storage medium and program product. Background Art
[0002] The multi-active geo-location architecture ensures high availability and strong disaster recovery capabilities by deploying business systems in multiple geographical locations and utilizing real-time data synchronization technology. The advantage of this architecture is that even if a data center fails, other data centers can quickly take over the business, thereby minimizing the duration and impact of business interruptions.
[0003] However, in the implementation process of traditional multi-site active-active architecture, in order to ensure data consistency between different data centers, it relies on complex data synchronization mechanisms. This is not only difficult to implement, but also the switching process is extremely complex when a failure occurs, and the recovery time is long, posing a potential threat to business continuity. Summary of the invention
[0004] Based on this, it is necessary to provide a remote multi-active message processing method, device, computer equipment, storage medium and program product that can effectively improve the efficiency of business message processing in order to address the above technical problems.
[0005] In a first aspect, the present application provides a remote multi-active message processing method, comprising:
[0006] Obtain the service message sent by the upstream service through the access layer. The service message carries a routing identifier.
[0007] Determine the target data center to which the business message belongs based on the current routing rules and routing identifiers; the target data center includes the local data center and the remote data center;
[0008] Through the message middleware cluster, the business message is sent to the message queue of the target data center, and the business message corresponding to the logical consumption point of the message queue is processed by the target data center; the logical consumption point is used to mark the message to be processed in the message queue;
[0009] When the traffic switching conditions are met, the current routing rules are updated, and according to the updated routing rules, the business traffic of the target data center is switched to the backup data center, and the business messages are processed by the backup data center.
[0010] In one embodiment, the step of processing the business message corresponding to the logical consumption point in the message queue by the target data center includes:
[0011] If the business message does not meet the multi-active message conditions, the target data center will execute the business logic operations corresponding to the business message corresponding to the logical consumption point in the message queue;
[0012] When the business message meets the multi-active message conditions, the routing identifier of the business message is valid, the target data center confirms that the business message belongs to the target data center, and the target data center is in normal service status, the target data center executes the corresponding business logic operations of the business message corresponding to the logical consumption point in the message queue.
[0013] In one embodiment, the method further comprises:
[0014] When the target data center confirms that the business message does not belong to the target data center, determine the source queue of the business message;
[0015] When the source queue is a retry queue or the target data center is not in normal service, the target data center responds to the message queue status.
[0016] In one embodiment, the step of updating the current routing rules includes:
[0017] The new routing rules are issued to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and the new routing rules are synchronized to the application layer of the corresponding region through the access layer.
[0018] In one embodiment, the step of processing the service message by the backup data center includes:
[0019] Update the logical consumption point of the message queue of the standby data center, and process the business messages corresponding to the updated logical consumption point through the standby data center.
[0020] In one embodiment, the step of updating the logical consumption point of the message queue of the standby data center includes:
[0021] Get the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point;
[0022] Determine the timestamp of the business traffic corresponding to the message ID being placed on the backup data center;
[0023] Determine the timestamp of the current consumption point and the timestamp of the disk, whichever comes first, and use the first timestamp as the target timestamp;
[0024] Update the logical consumption point of the message queue in the standby data center according to the target timestamp.
[0025] In a second aspect, the present application also provides a remote multi-active message processing device, including:
[0026] A service message acquisition module is used to acquire service messages sent by upstream services through the access layer. The service messages carry a routing identifier.
[0027] The data center determination module is used to determine the target data center to which the business message belongs according to the current routing rules and routing identifiers; the target data center includes a local data center and a remote data center;
[0028] The business message processing module is used to send business messages to the message queue of the target data center through the message middleware cluster, and process the business messages corresponding to the logical consumption points of the message queue through the target data center; the logical consumption points are used to mark the messages to be processed in the message queue;
[0029] The business traffic switching module is used to update the current routing rules when the traffic switching conditions are met, and switch the business traffic of the target data center to the backup data center according to the updated routing rules, and process the business messages through the backup data center.
[0030] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method steps of any one of the first aspects are implemented.
[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements any one of the method steps in the first aspect when the computer program is executed by a processor.
[0032] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements any one of the method steps in the first aspect when executed by a processor.
[0033] The above-mentioned remote multi-active message processing method, device, computer equipment, storage medium and program product can accurately distribute different business messages to the appropriate target data center through routing identifiers and routing rules, so that each data center can process the corresponding business according to its own resources and capabilities, improving the efficiency of overall business processing, and through the message middleware cluster and clear logical consumption points, it is ensured that the business messages can be processed in an orderly and accurate manner in the message queue of the target data center, reducing the probability of errors such as message loss and repeated processing, and improving the reliability of business processing. In addition, when traffic switching is required, the business traffic can be quickly switched from the target data center to the backup data center to ensure that it can continue to operate stably in the event of emergencies such as data center failures or network anomalies, realizing the function of disaster recovery and backup, and enhancing the stability and availability of the entire business system. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 A schematic diagram of the composition of a remote multi-active message queue in one embodiment;
[0036] Figure 2 A schematic diagram of a process of a remote multi-active message processing method in one embodiment;
[0037] Figure 3 A schematic diagram of a process of processing a service message by a target data center in one embodiment;
[0038] Figure 4 A schematic diagram of a process flow of switching service traffic in an embodiment;
[0039] Figure 5 A schematic diagram of a process for updating a logical consumption point in an embodiment;
[0040] Figure 6 A schematic diagram of a flow chart of a remote multi-active message processing method in another embodiment;
[0041] Figure 7 It is a structural block diagram of a remote multi-active message processing device in one embodiment;
[0042] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] In the current business operation environment, ensuring business continuity and high availability is a key element for the sustainable development of enterprises. Traditional disaster recovery solutions usually rely on a single primary data center and several backup data centers. When the primary data center is operating normally, the backup data center is often idle and is only enabled when the primary data center fails. Although this solution provides data protection and business recovery capabilities to a certain extent, it has problems such as low resource utilization, slow response speed and high cost.
[0045] Based on this, the embodiment of the present application provides a remote multi-active solution. By deploying message queues in multiple data centers, these message queues can provide services for business access in parallel. This design not only makes full use of resources and avoids the idleness of the backup center, but also improves the overall performance and reliability of the system. In the remote multi-active solution, the production center data of each data center is synchronized in both directions and can provide services to the outside world, thereby sharing business traffic and improving resource utilization. In addition, when one of the data centers fails, the system can immediately switch the business to other normally operating data centers through traffic switching to ensure business continuity.
[0046] The remote multi-active message processing method provided in the embodiment of the present application can be applied to Figure 1 In the multi-active message queue shown in Figure 1, the multi-active message queue is mainly composed of three parts: message middleware cluster, message synchronization service, and multi-active client. The message middleware cluster (MQ cluster) is used to build in multiple geographical regions and run independently to provide local message services for each region to ensure the regional support of data services. When a local application or business system generates a message in a specific area, the message middleware cluster in that area will immediately intervene to provide a series of services such as message publishing, subscription, storage, and delivery for various local applications. As the hub, the message synchronization service is responsible for the bidirectional data synchronization of message queues across regions, including message backup, cross-data center distribution, and centralized management of Topic, Group, and consumption points, and supports multiple disaster recovery strategies. The multi-active client uses Java agent technology to seamlessly integrate into the application, realize intelligent message routing and filtering, ensure that messages are accurately delivered to the target data center, and improve data processing efficiency.
[0047] In an exemplary embodiment, Figure 2 As shown, a remote multi-active message processing method is provided, and the method is applied to Figure 1 Taking the multi-active client in the example as an example, the method includes the following steps 202 to 208. Among them:
[0048] S202: Obtain a service message sent by an upstream service through the access layer, where the service message carries a routing identifier.
[0049] Optionally, the access layer is the front-end component of the system, responsible for receiving messages from upstream services, wherein the service messages carry a routing identifier, which is used to determine the data center to which the service message belongs, that is, to which data center the service message should be sent for processing.
[0050] S204: Determine the target data center to which the service message belongs according to the current routing rule and routing identifier; the target data center includes a local data center and a remote data center.
[0051] Optionally, routing rules refer to a series of regulations and criteria used to determine the path followed by data from a source node to a target node during network communication or data transmission, and are used to determine which data center a business message should be sent to based on a routing identifier. According to the current routing rules and the routing identifier in the message, the data center to which the business message should be sent is determined, wherein the data center includes a local data center and a remote data center. In this way, different business messages can be accurately diverted to appropriate processing locations, and through the message synchronization service, data synchronization between different data centers is ensured, thereby enabling multiple data centers to process business messages in parallel and improve business processing efficiency.
[0052] S206: Send the business message to the message queue of the target data center through the message middleware cluster, and process the business message corresponding to the logical consumption point of the message queue through the target data center; the logical consumption point is used to mark the message to be processed in the message queue.
[0053] Optionally, the message middleware cluster is responsible for message delivery, delivering business messages from the access layer to the target data center, where the messages are placed in a queue for processing. The logical consumption point is a mark in the message queue, which is used to indicate which messages in the queue have been processed and which messages are yet to be processed. When a message is consumed (i.e. processed), the logical consumption point will move accordingly, so that the processing process can be carried out in sequence or according to specific rules, ensuring that business messages will not be missed or processed incorrectly.
[0054] S208: When the traffic switching conditions are met, the current routing rules are updated, and according to the updated routing rules, the service traffic of the target data center is switched to the backup data center, and the service messages are processed through the backup data center.
[0055] Optionally, when specific traffic switching conditions are met, the current routing rules will be updated. Based on the updated routing rules, the business traffic originally sent to the target data center will be switched to the backup data center, which will then process these business messages, thereby ensuring the continuous operation of the business and avoiding business interruptions due to abnormalities in the target data center. It should be noted that the backup data center can be a local data center or an off-site data center, or it can be another data center. When switching traffic, the business traffic of the local data center can be switched to an off-site data center, or the business traffic of the off-site data center can be switched to the local data center. According to actual business needs, the business traffic can be switched to a designated data center for processing.
[0056] In the above-mentioned multi-active message processing method in different locations, different business messages can be accurately allocated to the appropriate target data center through routing identifiers and routing rules, so that each data center can process the corresponding business according to its own resources and capabilities, improving the efficiency of overall business processing. In addition, through the message middleware cluster and clear logical consumption points, it is ensured that business messages can be processed in an orderly and accurate manner in the message queue of the target data center, reducing the probability of errors such as message loss and repeated processing, and improving the reliability of business processing. In addition, when traffic switching is required, the business traffic can be quickly switched from the target data center to the backup data center to ensure that it can continue to operate stably in the event of emergencies such as data center failures or network anomalies, realizing the function of disaster recovery and backup, and enhancing the stability and availability of the entire business system.
[0057] In an exemplary embodiment, the step of processing a business message corresponding to a logical consumption point in a message queue through a target data center includes: when the business message does not meet the multi-active message condition, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center; when the business message meets the multi-active message condition, the routing identifier of the business message is valid, the target data center confirms that the business message belongs to the target data center, and the target data center is in normal service status, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center.
[0058] For example, Figure 3As shown, when processing business messages through the target data center, for business messages in the message queue, it is necessary to determine whether they meet the multi-active message conditions, for example, determine whether the Topic name and Group name of the business message match the identifier of the multi-active message. If the business message does not meet the multi-active message conditions, direct consumption is adopted, that is, the message is processed according to the local established business logic and processing flow so that it can complete the tasks undertaken in the local business scenario. In addition, since business messages are processed locally, there is no need to perform cross-regional and cross-data center routing operations, so there is no need to pass the routing identifier of the business message.
[0059] When a business message meets the multi-active message conditions, it is necessary to check whether the routing identifier of the business message is valid, so as to verify whether the source and routing information of the message are correct and reliable, and confirm through the target data center that the business message does belong to the target data center to avoid the message being mistakenly processed to other irrelevant data centers. At the same time, it is also necessary to confirm that the target data center is in normal service status. Only when these conditions are met will the business logic operation corresponding to the message be executed through the target data center.
[0060] In this embodiment, by directly processing locally the messages that do not meet the multi-active message conditions, unnecessary complex processes and resource consumption are avoided. Targeted processing is performed on the messages that meet specific conditions, so that resources can be better allocated according to business needs and the corresponding business logic can be executed, so that resources can be used more reasonably, the business process can be optimized, and the business processing efficiency can be improved.
[0061] In an exemplary embodiment, the method also includes: when the target data center confirms that the business message does not belong to the target data center, determining the source queue of the business message; when the source queue is a retry queue or the target data center is not in normal service status, responding to the message queue status through the target data center.
[0062] Optionally, after receiving a business message, if it is confirmed that the business message does not belong to the target data center, it is necessary to determine its source queue, where the source queue can be an ordinary business message queue, a retry queue, an error processing queue, etc. If it is determined that the source queue of the business message is a retry queue, it means that the message has previously gone through a certain processing flow but may not have been successfully processed due to some reasons, and is now sent again to try to reprocess. At this time, the target data center needs to decide how to respond to the message queue status based on its current resource status, business logic, and processing strategies related to the retry queue. If the target data center itself is not in normal service due to hardware failure, network problems or other reasons, then no matter what the source queue of the business message is, it is necessary to take corresponding measures to respond to the message queue status, for example, sending feedback information to the message queue to inform the queue that the current data center cannot process the message normally so that the queue can adopt other strategies.
[0063] In this embodiment, by clarifying whether the business message belongs to the target data center and determining its source queue, it can ensure that the message is processed correctly, avoiding the message being misprocessed in the wrong data center. In addition, by responding to the message queue status according to the status of different source queues and target data centers, resources can be allocated more reasonably, thereby improving the accuracy and reliability of the entire message processing system.
[0064] In an exemplary embodiment, the step of updating the current routing rules includes: issuing new routing rules to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and synchronizing the new routing rules to the application layer of the corresponding region through the access layer.
[0065] Optionally, when traffic switching is required, since the access layer is an important layer in the system that connects the external network and the internal data center network, it is responsible for receiving external requests and forwarding them to the appropriate internal application layer service or data center. By sending new routing rules to the access layer, business requests are prevented from flowing into the old data center from the source. Afterwards, the new routing rules are synchronized from the access layer to the application layer to ensure that the application layer services in the entire region can process business requests and data interactions according to the new rules, thereby ensuring the consistency and coordination of the system at the business logic level.
[0066] For example, Figure 4 As shown, when a target data center fails, is overloaded, or is required for disaster recovery and other strategic needs, the business traffic is switched to the backup data center by updating the current routing rules.
[0067] In this embodiment, by updating the routing rules, the routing direction of the service request can be dynamically adjusted according to the real-time status of the data center. When the target data center fails or the performance degrades, the service traffic can be quickly switched to the backup data center to ensure the continuity and availability of the service and reduce the risk of service interruption caused by single point failures in the system.
[0068] In an exemplary embodiment, the step of processing business messages through the backup data center includes: updating the logical consumption points of the message queue of the backup data center, and processing the business messages corresponding to the updated logical consumption points through the backup data center.
[0069] Optionally, in a message queue system, a logical consumption point is used to identify the consumer's consumption progress in a message queue, so that messages can continue to be obtained from the correct position in the subsequent consumption process to avoid duplicate consumption or missing messages. When it is necessary to process business messages through a backup data center, since the backup data center may have been in an incompletely synchronized or standby state, the logical consumption point of its message queue may be inconsistent with that of the target data center. Therefore, it is necessary to first update the logical consumption point of the message queue of the backup data center to match the consumption progress expected by the current system to ensure that the backup data center can start processing business messages from the correct position. After completing the update of the logical consumption point, the backup data center can obtain the corresponding business messages from the message queue according to the new logical consumption point, and process these messages according to the pre-defined business logic.
[0070] In this embodiment, by updating the logical consumption points of the message queue of the backup data center, it is possible to ensure that the logical consumption points of the backup data center match the message processing progress of the primary data center, avoid business messages being missed, and thus maintain business continuity and consistency.
[0071] In an exemplary embodiment, the step of updating the logical consumption point of the message queue of the backup data center includes: obtaining the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point; determining the timestamp of the business traffic corresponding to the message ID in the backup data center; determining the previous timestamp between the timestamp of the current consumption point and the timestamp of the disk landing, and taking the previous timestamp as the target timestamp; updating the logical consumption point of the message queue of the backup data center according to the target timestamp.
[0072] For example, Figure 5As shown, when updating the logical consumption point of the message queue of the standby data center, the latest consumption point of the target data center, that is, the current consumption point, is required first. The current consumption point represents the position in the message queue that the current target data center has processed, and the corresponding message ID is the identifier of the specific message at that point. After that, the disk drop timestamp of the business traffic in the standby data center is determined. The disk drop timestamp reflects the moment when the message is actually stored on the disk in the remote data center. By comparing the timestamp of the latest consumption point of the local data center and the disk drop timestamp of the message in the remote data center, the order of the message processing progress of the two data centers can be determined, and the timestamp with the earlier processing progress can be selected as the target timestamp, so that the standby data center processes the business message according to the logical consumption point corresponding to the target timestamp, ensuring the consistency and integrity of the data between the two data centers.
[0073] In this embodiment, by accurately determining the logical consumption point of the backup data center, it can ensure that the backup data center starts processing messages from the correct location, so that all messages that should be processed can be processed, and the same message will not be processed repeatedly, thereby ensuring the accuracy and completeness of message processing.
[0074] In one embodiment, Figure 6 As shown, a method for processing multi-site active messages is provided, the method comprising the following steps:
[0075] S602: Obtain a service message sent by an upstream service through the access layer, where the service message carries a routing identifier.
[0076] S604: Determine the target data center to which the service message belongs according to the current routing rule and routing identifier; the target data center includes a local data center and a remote data center.
[0077] S606: Through the message middleware cluster, the business message is sent to the message queue of the target data center. If the business message does not meet the multi-active message condition, the target data center executes the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue; if the business message meets the multi-active message condition, the routing identifier of the business message is valid, the target data center confirms that the business message belongs to the target data center, and the target data center is in normal service status, the target data center executes the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue. Among them, the logical consumption point is used to mark the message to be processed in the message queue.
[0078] S608: When the traffic switching conditions are met, new routing rules are issued to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and the new routing rules are synchronized to the application layer of the corresponding region through the access layer.
[0079] S610: According to the updated routing rules, the business traffic of the target data center is switched to the backup data center, and the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point are obtained; the timestamp of the business traffic corresponding to the message ID in the backup data center is determined; the timestamp of the current consumption point and the timestamp of the disk placement is determined, and the former timestamp is used as the target timestamp; the logical consumption point of the message queue of the backup data center is updated according to the target timestamp, and the business message corresponding to the updated logical consumption point is processed through the backup data center.
[0080] S612: When the target data center confirms that the business message does not belong to the target data center, determine the source queue of the business message; when the source queue is a retry queue or the target data center is not in normal service status, respond to the message queue status through the target data center.
[0081] In this embodiment, different business messages can be accurately assigned to the appropriate target data center through routing identifiers and routing rules, so that each data center can process the corresponding business according to its own resources and capabilities, improving the efficiency of overall business processing. In addition, through the message middleware cluster and clear logical consumption points, it is ensured that business messages can be processed in an orderly and accurate manner in the message queue of the target data center, reducing the probability of errors such as message loss and repeated processing, and improving the reliability of business processing. In addition, when traffic switching is required, the business traffic can be quickly switched from the target data center to the backup data center to ensure that it can continue to operate stably in the event of emergencies such as data center failures or network anomalies, realizing the function of disaster recovery and backup, and enhancing the stability and availability of the entire business system.
[0082] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0083] Based on the same inventive concept, the embodiment of the present application also provides a remote multi-active message processing device for implementing the remote multi-active message processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the remote multi-active message processing device provided below can refer to the limitations of the remote multi-active message processing method above, and will not be repeated here.
[0084] In an exemplary embodiment, Figure 7 As shown, a remote multi-active message processing device is provided, including: a service message acquisition module 10, a data center determination module 20, a service message processing module 30 and a service traffic switching module 40, wherein:
[0085] The service message acquisition module 10 is used to acquire the service message sent by the upstream service through the access layer, and the service message carries a routing identifier.
[0086] The data center determination module 20 is used to determine the target data center to which the service message belongs according to the current routing rules and routing identifiers; the target data center includes a local data center and a remote data center.
[0087] The business message processing module 30 is used to send business messages to the message queue of the target data center through the message middleware cluster, and process the business messages corresponding to the logical consumption points of the message queue through the target data center; the logical consumption points are used to mark the messages to be processed in the message queue.
[0088] The business traffic switching module 40 is used to update the current routing rules when the traffic switching conditions are met, and switch the business traffic of the target data center to the backup data center according to the updated routing rules, and process the business messages through the backup data center.
[0089] In an exemplary embodiment, the data center determination module 20 is also used to execute the business logic operations corresponding to the business messages corresponding to the logical consumption points in the message queue through the target data center when the business messages do not meet the multi-active message conditions; and to execute the business logic operations corresponding to the business messages corresponding to the logical consumption points in the message queue through the target data center when the business messages meet the multi-active message conditions, the routing identifier of the business messages is valid, the business messages are confirmed to belong to the target data center through the target data center, and the target data center is in normal service status.
[0090] In an exemplary embodiment, the data center determination module 20 is also used to determine the source queue of the business message when the target data center confirms that the business message does not belong to the target data center; when the source queue is a retry queue or the target data center is not in normal service status, the target data center responds to the message queue status.
[0091] In an exemplary embodiment, the business traffic switching module 40 is also used to issue new routing rules to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and synchronize the new routing rules to the application layer of the corresponding region through the access layer.
[0092] In an exemplary embodiment, the service traffic switching module 40 is also used to update the logical consumption point of the message queue of the standby data center, and process the service message corresponding to the updated logical consumption point through the standby data center.
[0093] In an exemplary embodiment, the business traffic switching module 40 is also used to obtain the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point; determine the disk landing timestamp of the business traffic corresponding to the message ID in the backup data center; determine the previous timestamp between the current consumption point timestamp and the disk landing timestamp, and use the previous timestamp as the target timestamp; update the logical consumption point of the message queue of the backup data center according to the target timestamp.
[0094] Each module in the above-mentioned multi-site active message processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0095] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a remote multi-active message processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0096] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0097] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a business message sent by an upstream business through an access layer, wherein the business message carries a routing identifier; determining a target data center to which the business message belongs based on current routing rules and routing identifiers; the target data center includes a local data center and a remote data center; sending the business message to a message queue of the target data center through a message middleware cluster, and processing the business message corresponding to a logical consumption point of the message queue through the target data center; the logical consumption point is used to mark messages to be processed in the message queue; when a traffic switching condition is met, updating the current routing rules, and switching the business traffic of the target data center to a backup data center based on the updated routing rules, and processing the business message through the backup data center.
[0098] In one embodiment, when a processor executes a computer program, the processing involved in processing business messages corresponding to logical consumption points in a message queue through a target data center includes: when the business message does not meet the multi-active message condition, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center; when the business message meets the multi-active message condition, the routing identifier of the business message is valid, the business message is confirmed to belong to the target data center through the target data center, and the target data center is in normal service status, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center.
[0099] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the target data center confirms that the business message does not belong to the target data center, the source queue of the business message is determined; when the source queue is a retry queue or the target data center is not in normal service status, the message queue status is responded to through the target data center.
[0100] In one embodiment, updating the current routing rules involved in executing a computer program by the processor includes: sending new routing rules to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and synchronizing the new routing rules to the application layer of the corresponding region through the access layer.
[0101] In one embodiment, the processing of business messages through a backup data center involved in the execution of a computer program by a processor includes: updating the logical consumption points of the message queue of the backup data center, and processing business messages corresponding to the updated logical consumption points through the backup data center.
[0102] In one embodiment, updating the logical consumption point of the message queue of the standby data center involved in executing a computer program by the processor includes: obtaining the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point; determining the disk landing timestamp of the business traffic corresponding to the message ID in the standby data center; determining the previous timestamp between the timestamp of the current consumption point and the disk landing timestamp, and taking the previous timestamp as the target timestamp; and updating the logical consumption point of the message queue of the standby data center according to the target timestamp.
[0103] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: obtaining a business message sent by an upstream business through an access layer, the business message carrying a routing identifier; determining a target data center to which the business message belongs based on current routing rules and routing identifiers; the target data center includes a local data center and a remote data center; sending the business message to a message queue of the target data center through a message middleware cluster, and processing the business message corresponding to a logical consumption point of the message queue through the target data center; the logical consumption point is used to mark messages to be processed in the message queue; when a traffic switching condition is met, updating the current routing rules, and switching the business traffic of the target data center to a backup data center based on the updated routing rules, and processing the business message through the backup data center.
[0104] In one embodiment, when a computer program is executed by a processor, the processing of business messages corresponding to logical consumption points in a message queue through a target data center involves: when the business message does not meet the multi-active message condition, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center; when the business message meets the multi-active message condition, the routing identifier of the business message is valid, the business message is confirmed to belong to the target data center through the target data center, and the target data center is in normal service status, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center.
[0105] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the target data center confirms that the business message does not belong to the target data center, the source queue of the business message is determined; when the source queue is a retry queue or the target data center is not in normal service status, the message queue status is responded to through the target data center.
[0106] In one embodiment, updating the current routing rules involved when the computer program is executed by the processor includes: issuing new routing rules to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and synchronizing the new routing rules to the application layer of the corresponding region through the access layer.
[0107] In one embodiment, the computer program executed by the processor involves processing business messages through the backup data center, including: updating the logical consumption points of the message queue of the backup data center, and processing the business messages corresponding to the updated logical consumption points through the backup data center.
[0108] In one embodiment, updating the logical consumption point of the message queue of the standby data center involved in the computer program executed by the processor includes: obtaining the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point; determining the disk landing timestamp of the business traffic corresponding to the message ID in the standby data center; determining the previous timestamp between the timestamp of the current consumption point and the disk landing timestamp, and taking the previous timestamp as the target timestamp; updating the logical consumption point of the message queue of the standby data center according to the target timestamp.
[0109] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: obtaining a business message sent by an upstream business through an access layer, the business message carrying a routing identifier; determining a target data center to which the business message belongs based on current routing rules and routing identifiers; the target data center includes a local data center and a remote data center; sending the business message to a message queue of the target data center through a message middleware cluster, and processing the business message corresponding to a logical consumption point of the message queue through the target data center; the logical consumption point is used to mark the message to be processed in the message queue; when the traffic switching condition is met, updating the current routing rules, and switching the business traffic of the target data center to a backup data center based on the updated routing rules, and processing the business message through the backup data center.
[0110] In one embodiment, when a computer program is executed by a processor, the processing of business messages corresponding to logical consumption points in a message queue through a target data center involves: when the business message does not meet the multi-active message condition, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center; when the business message meets the multi-active message condition, the routing identifier of the business message is valid, the business message is confirmed to belong to the target data center through the target data center, and the target data center is in normal service status, executing the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue through the target data center.
[0111] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the target data center confirms that the business message does not belong to the target data center, the source queue of the business message is determined; when the source queue is a retry queue or the target data center is not in normal service status, the message queue status is responded to through the target data center.
[0112] In one embodiment, updating the current routing rules involved when the computer program is executed by the processor includes: issuing new routing rules to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and synchronizing the new routing rules to the application layer of the corresponding region through the access layer.
[0113] In one embodiment, the computer program executed by the processor involves processing business messages through the backup data center, including: updating the logical consumption points of the message queue of the backup data center, and processing the business messages corresponding to the updated logical consumption points through the backup data center.
[0114] In one embodiment, updating the logical consumption point of the message queue of the standby data center involved in the computer program executed by the processor includes: obtaining the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point; determining the disk landing timestamp of the business traffic corresponding to the message ID in the standby data center; determining the previous timestamp between the timestamp of the current consumption point and the disk landing timestamp, and taking the previous timestamp as the target timestamp; updating the logical consumption point of the message queue of the standby data center according to the target timestamp.
[0115] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0116] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0117] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A remote multi-active message processing method, characterized in that: Applied to a client; the method comprises: Obtaining a service message sent by an upstream service through the access layer, wherein the service message carries a routing identifier; Determine the target data center to which the service message belongs according to the current routing rule and the routing identifier; the target data center includes a local data center and a remote data center; The business message is sent to the message queue of the target data center through the message middleware cluster, and the business message corresponding to the logical consumption point of the message queue is processed by the target data center; the logical consumption point is used to mark the message to be processed in the message queue; When the traffic switching conditions are met, the current routing rules are updated, and according to the updated routing rules, the business traffic of the target data center is switched to the backup data center, and the business message is processed by the backup data center.
2. The method according to claim 1, characterized in that The processing of the business message corresponding to the logical consumption point in the message queue by the target data center includes: When the business message does not meet the multi-active message condition, the target data center executes the business logic operation corresponding to the business message corresponding to the logical consumption point in the message queue; When the business message meets the multi-active message conditions, the routing identifier of the business message is valid, the target data center confirms that the business message belongs to the target data center, and the target data center is in normal service status, the target data center executes the corresponding business logic operation of the business message corresponding to the logical consumption point in the message queue.
3. The method according to claim 2, characterized in that The method further comprises: When the target data center confirms that the service message does not belong to the target data center, determining a source queue of the service message; In case the source queue is a retry queue or the target data center is not in normal service, the target data center responds to the message queue status.
4. The method according to claim 1, characterized in that: The updating of the current routing rules includes: The new routing rules are issued to the access layer of the region where the target data center is located and the access layer of the region where the backup data center is located, and the new routing rules are synchronized to the application layer of the corresponding region through the access layer.
5. The method according to claim 1, characterized in that The processing of the service message by the standby data center includes: The logical consumption point of the message queue of the standby data center is updated, and the business message corresponding to the updated logical consumption point is processed by the standby data center.
6. The method according to claim 5, characterized in that The updating of the logical consumption point of the message queue of the standby data center includes: Obtain the current consumption point of the message queue of the target data center and the message ID corresponding to the current consumption point; Determine the timestamp of the business traffic corresponding to the message ID being placed on the disk in the standby data center; Determine the previous timestamp between the timestamp of the current consumption point and the timestamp of the disk placement, and use the previous timestamp as the target timestamp; The logical consumption point of the message queue of the standby data center is updated according to the target timestamp.
7. A remote multi-active message processing device, characterized in that: The device comprises: A service message acquisition module, used to acquire a service message sent by an upstream service through an access layer, wherein the service message carries a routing identifier; A data center determination module, used to determine the target data center to which the service message belongs according to the current routing rule and the routing identifier; the target data center includes a local data center and a remote data center; A business message processing module is used to send the business message to the message queue of the target data center through the message middleware cluster, and process the business message corresponding to the logical consumption point of the message queue through the target data center; the logical consumption point is used to mark the message to be processed in the message queue; The business traffic switching module is used to update the current routing rules when the traffic switching conditions are met, and switch the business traffic of the target data center to the backup data center according to the updated routing rules, and process the business messages through the backup data center.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.