Message processing method and apparatus, electronic device, and storage medium

By automatically routing to the corresponding business cluster unit in the enterprise-level instant messaging system, the problem of coupling between business code and routing logic under multi-tenant and multi-unit deployment is solved, improving development efficiency and message processing efficiency, and reducing operation and maintenance costs.

CN122476083APending Publication Date: 2026-07-28BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610803905.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-04
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

In multi-tenant and multi-unit deployment scenarios, enterprise-level instant messaging systems suffer from high coupling between business code and routing logic, resulting in low development efficiency, poor system scalability, and high maintenance costs.

Method used

By identifying the tenant of a user or group message, the system automatically routes messages to the corresponding business cluster unit using pre-acquired unit routing rules, enabling cross-unit message processing. The system centrally manages routing rules using a unit routing rule management center, and combines caching and circuit breaker mechanisms to ensure system availability.

Benefits of technology

This decouples the business system from the routing logic, improving development and message processing efficiency while reducing operational costs and system complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122476083A_ABST
    Figure CN122476083A_ABST
Patent Text Reader

Abstract

The application provides a message processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: determining a tenant corresponding to a user who sends a group message; determining a first business cluster unit to which a group member belonging to the group message belongs based on the tenant and at least one unit routing rule obtained in advance; the unit routing rule represents a mapping relationship between the tenant or the group number and the business cluster unit; the business cluster unit comprises at least one service; and the group message is sent to a first service in the first business cluster unit, and the first service is used to send the group message to the group member. Since the unit routing rule represents the mapping relationship between the tenant or the group number and the business cluster unit, the group message can be automatically routed to the business cluster unit to which the group member belonging to the group message belongs through the at least one unit routing rule, cross-unit message processing of the business system and the routing logic is realized through the service in the business cluster unit, and the development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a message processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] Current enterprise-level instant messaging (IM) systems commonly employ a microservice architecture to achieve high scalability and flexibility. For example, service modules are built using the Java Spring Boot framework, remote calls between services are implemented through a distributed service framework, and asynchronous messages are handled by message queues. In a single-unit deployment scenario, all service instances share the same codebase and database, and inter-service calls are completed directly through local distributed service endpoints. However, with the increasing globalization of business and the growing demand for multi-tenancy, the system needs to support independent deployment of multiple units (such as overseas versions, merchant versions, etc.). In this case, each unit must completely isolate its database from the application instance.

[0003] In existing technologies, business systems need to handle cross-unit calling logic themselves: each service needs to hard-code the unit affiliation judgment rules (such as routing mapping based on user ID or group number) and embed cross-unit calling code in the interface (such as manually switching distributed service addresses). This requires business systems to frequently modify code to adapt to the calling logic of multiple units, resulting in high coupling between business code and routing logic, thus leading to low development efficiency. Summary of the Invention

[0004] This invention provides a message processing method, apparatus, electronic device, and storage medium to solve the problem of low development efficiency caused by the high coupling between business code and routing logic.

[0005] This invention provides a message processing method, comprising: Determine the tenant corresponding to the user who sent the group message; Based on the tenant and at least one pre-acquired unit routing rule, the first service cluster unit to which the group member corresponding to the group message belongs is determined; the unit routing rule represents the mapping relationship between the tenant or group number and the service cluster unit; the service cluster unit includes at least one service. The group message is sent to the first service in the first service cluster unit, and the first service is used to send the group message to the group members.

[0006] According to a message processing method provided by the present invention, determining the first service cluster unit to which the group member corresponding to the group message belongs, based on the tenant and at least one pre-acquired unit routing rules, includes: Based on the tenant and the pre-acquired routing rules of each unit, the second business cluster unit to which the user belongs is determined; Based on the second business cluster unit to which the user belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined.

[0007] According to a message processing method provided by the present invention, determining the first service cluster unit to which the group member corresponding to the group message belongs based on the second service cluster unit to which the user belongs includes: Send a first request to the second service in the second service cluster unit, the first request including the target group number corresponding to the group message; the second service is used to determine the third service cluster unit to which the target group number belongs based on the target group number and the pre-acquired routing rules of each of the units; Based on the third business cluster unit to which the target group number belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined.

[0008] According to a message processing method provided by the present invention, determining the first service cluster unit to which the group member corresponding to the group message belongs based on the third service cluster unit to which the target group number belongs includes: Send a second request to the third service in the third service cluster unit, the second request including the target group number corresponding to the group message; the third service is used to query the group member corresponding to the target group number based on the target group number, and determine the first service cluster unit to which the group member corresponding to the group message belongs based on the tenant corresponding to the group member and the mapping relationship between the tenant or group number and the service cluster unit represented by the pre-obtained routing rules of each unit respectively.

[0009] According to a message processing method provided by the present invention, the method further includes: Call the query interface to obtain the routing rules for each unit from the unit routing rule management center.

[0010] According to a message processing method provided by the present invention, the method further includes: If no unit routing rules are obtained from the unit routing rule management center, switch to the locally cached historical unit routing rules and record an alarm log.

[0011] According to a message processing method provided by the present invention, the method further includes: If the number of times the first request or the second request fails to be sent exceeds a preset number, the circuit breaker mechanism will be triggered or a response message will be returned.

[0012] The present invention also provides a message processing apparatus, comprising: The first determination module is used to determine the tenant corresponding to the user who sent the group message; The second determining module is used to determine the first business cluster unit to which the group member corresponding to the group message belongs, based on the tenant and at least one pre-acquired unit routing rule; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service; The sending module is used to send the group message to the first service in the first service cluster unit, and the first service is used to send the group message to the group members.

[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the message processing method described above.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the message processing method as described above.

[0015] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the message processing method as described above.

[0016] The message processing method, apparatus, electronic device, and storage medium provided by this invention determine the tenant corresponding to the user sending the group message; based on the tenant and at least one pre-acquired unit routing rule, determine the first business cluster unit to which the group member corresponding to the group message belongs; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service; and the group message is sent to a first service in the first business cluster unit, the first service being used to send the group message to the group member. Since the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit, and the business cluster unit includes at least one service, the message can be automatically routed to the first business cluster unit to which the group member corresponding to the group message belongs through the pre-acquired unit routing rule. This enables the first service in the first business cluster unit to send the group message to the group member, achieving cross-unit message processing decoupled from the business system and routing logic, improving development efficiency, and simultaneously improving message processing efficiency. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is one of the flowcharts of the message processing method provided by the present invention.

[0019] Figure 2 This is a schematic diagram of the collaborative architecture between the unit routing rule management center and the business cluster unit provided by the present invention.

[0020] Figure 3 This is the second flowchart of the message processing method provided by the present invention.

[0021] Figure 4 This is a schematic diagram of the message processing device provided by the present invention.

[0022] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0024] To facilitate a clear understanding of the various embodiments of this application, the relevant background knowledge of this application will be introduced first.

[0025] With the increasing globalization of business and the growing demand for multi-tenancy, enterprise-level instant messaging systems commonly adopt microservice architectures to achieve high scalability and flexibility. For example, service modules are built based on the Java Spring Boot framework, remote calls between services are implemented through distributed service frameworks, and asynchronous messages are processed using message queues. For instance, the distributed service framework could be JSF (Jingdong Service Framework), a high-performance service framework independently developed by JD.com. The message queue could be JD Message Queue (JMQ), a distributed message stream processing platform developed by JD.com. However, enterprise-level instant messaging systems need to support independent deployment of multiple units (such as overseas versions, merchant versions, etc.), requiring complete isolation between the database and application instances for each unit. In existing technologies, business systems must handle cross-unit call logic themselves: each service needs to hard-code unit affiliation rules (such as routing mapping based on user ID or group number) and embed cross-unit call code in the interface (such as manually switching distributed service addresses). Furthermore, unit routing rules are usually stored directly in the local configuration of the business system, lacking a unified management mechanism.

[0026] Existing technologies have significant drawbacks in multi-unit interoperability scenarios, mainly manifested in low development efficiency, poor system scalability, and high maintenance costs. The specific reasons are as follows: 1. High code invasiveness: Business systems require frequent code modifications to adapt to multi-unit logic. For example, each interface involving cross-unit calls requires manual implementation of unit affiliation determination (such as resolving the unit to which a user tenant belongs), target service address switching (such as modifying JSF call endpoints), and unit routing rule caching management, resulting in high coupling between business code and routing logic, thus leading to low development efficiency.

[0027] 2. Difficulty in Dynamic Expansion: Adding a new unit requires repeatedly modifying the routing rule code of all related services, making it impossible to add units dynamically through configuration. For example, adding an overseas version unit requires adding user tenant range judgment logic to the code of multiple services and redeploying service instances, resulting in long deployment cycles and a high risk of errors.

[0028] 3. High maintenance costs: The routing logic is scattered across various business systems. The same function (such as updating the unit routing rule cache) needs to be implemented repeatedly in multiple services, which requires a large amount of code to be modified synchronously when the version is upgraded or the rules are changed, increasing the complexity and maintenance difficulty of the system.

[0029] The following is combined with Figures 1-3 The message processing method of the present invention is described.

[0030] Figure 1This is one of the flowcharts illustrating the message processing method provided by the present invention, such as... Figure 1 As shown, the method includes the following steps 101-103.

[0031] Step 101: Determine the tenant corresponding to the user who sent the group message.

[0032] It should be noted that the message processing method provided by the present invention can be applied to the scenario of group message processing in enterprise-level instant messaging systems. The executing entity of the method can be a message processing device, such as an electronic device, or a control module in the message processing device for executing the message processing method.

[0033] Specifically, when a user sends a group message to a group, the user's corresponding tenant can be determined. For example, if user A sends a group message to a group through a gateway, the gateway's integrated routing software development kit (SDK) can parse the user's tenant and determine the corresponding tenant.

[0034] Step 102: Based on the tenant and at least one pre-acquired unit routing rule, determine the first business cluster unit to which the group member corresponding to the group message belongs; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service.

[0035] Specifically, a unit routing rule represents the mapping relationship between a tenant or group number and a business cluster unit; a business cluster unit includes at least one service, and each service includes a routing SDK. The routing SDK is a lightweight component integrated into the business system, encapsulating unit routing rule caching and cross-unit call logic.

[0036] When a business system starts up, the routing SDK in at least one service of at least one business cluster unit in the business system can actively obtain at least one unit routing rule.

[0037] Based on the tenant and at least one pre-acquired unit routing rules, the first business cluster unit to which the group member corresponding to the group message belongs can be determined, wherein the first business cluster unit is the unit to which the group member belongs.

[0038] Step 103: Send the group message to the first service in the first service cluster unit, wherein the first service is used to send the group message to the group members.

[0039] Specifically, the routing SDK sends a group message to the first service in the first business cluster unit, and the first service sends the group message to the group members, that is, delivers the group message.

[0040] The message processing method provided by this invention determines the tenant corresponding to the user sending the group message; based on the tenant and at least one pre-acquired unit routing rule, determines the first business cluster unit to which the group member corresponding to the group message belongs; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service; and sends the group message to the first service in the first business cluster unit, the first service being used to send the group message to the group member. Since the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit, and the business cluster unit includes at least one service, the method can automatically route to the first business cluster unit to which the group member corresponding to the group message belongs through the pre-acquired unit routing rule. This enables the first service in the first business cluster unit to send the group message to the group member, achieving cross-unit message processing decoupled from the business system and routing logic, improving development efficiency, and simultaneously improving message processing efficiency.

[0041] Optionally, the method further includes: Call the query interface to obtain the routing rules for each unit from the unit routing rule management center.

[0042] Specifically, the unit routing rule management center serves GlobalMeta. It uses MySQL for persistent storage of each unit's routing rules, supporting high availability and data consistency. The center generates a globally incrementing version number for each unit routing rule update, using this version number to mark the rule's change status.

[0043] The unit routing rule management center provides metadata query (such as GET / metadata / unit-mapping) and dynamic update capabilities (such as POST / metadata / update) through a RESTful application programming interface (API).

[0044] When a business system starts, the routing SDK in at least one service within at least one business cluster unit can proactively retrieve all unit routing rules from the unit routing rule management center periodically via a background thread, based on version number comparisons, using the unit routing rule query interface provided by the RESTful API. This retrieval is then stored in an in-memory cache, and the cache is updated incrementally at regular intervals. For example, the routing SDK requests the query interface provided by the unit routing rule management center every 60 seconds via a background thread. During scheduled synchronization, only the unit routing rules corresponding to the local version number need to be passed, and the cached rules are updated accordingly. If the version number of a unit routing rule changes, the locally cached unit routing rule is updated incrementally.

[0045] In this application, by calling the query interface, the unit routing rules are obtained from the unit routing rule management center, so that the full set of unit routing rules obtained from the unit routing rule management center is stored in the memory cache, thereby realizing incremental updates of unit routing rules, reducing network transmission overhead and ensuring data consistency.

[0046] Figure 2 This is a schematic diagram of the collaborative architecture between the unit routing rule management center and the business cluster unit provided by the present invention, as shown in the figure. Figure 2 As shown, the business system includes business cluster unit 1 and business cluster unit 2. Business cluster unit 1 includes service 1 and service 2, and business cluster unit 2 includes both service 1 and service 2. Service 1 includes a routing SDK, and service 2 includes a routing SDK. Service 1 and service 2 can communicate with each other. The routing rule management center (GlobalMeta service) uses MySQL to persistently store the routing rules of each unit, supporting high availability and data consistency. The unit routing rule management center generates a globally incrementing version number for updating unit routing rules, using the version number to mark the unit routing rule, thereby marking the change status of the unit routing rule.

[0047] When the business system starts, the routing SDKs in Service 1 and Service 2 can use the unit routing rule query interface provided by the RESTful API to actively retrieve the full set of unit routing rules from the unit routing rule management center (GlobalMeta service) through a background thread on a regular basis based on version number comparison. The full set of unit routing rules is then stored in the memory cache, and the memory cache is updated incrementally on a regular basis.

[0048] In this application, the GlobalMeta service centrally manages dynamically configurable unit routing rules, while the Route SDK implements non-intrusive routing decisions through cache synchronization and dynamic proxy mechanisms, eliminating the need for business systems to be aware of multi-unit deployment details. Through the collaborative work of the GlobalMeta service and the Route SDK, unit routing logic is decoupled from business systems, achieving a dynamic and configurable multi-unit interoperability mechanism. Business systems only need to import the Route SDK to automatically handle multi-unit routing logic; adding a new unit only requires updating the GlobalMeta configuration, significantly reducing development and maintenance costs.

[0049] Optionally, the method further includes: If no unit routing rules are obtained from the unit routing rule management center, switch to the locally cached historical unit routing rules and record an alarm log.

[0050] Specifically, when the routing SDK in at least one service of at least one business cluster unit in the business system fails to obtain the routing rules for each unit from the unit routing rule management center (i.e., GlobalMeta is unreachable), it can automatically switch to the locally cached historical unit routing rules, make cross-unit routing calls based on the historical unit routing rules, and record alarm logs to ensure service availability.

[0051] Optionally, the specific implementation of step 102 above includes: Based on the tenant and the pre-acquired routing rules of each unit, the second service cluster unit to which the user belongs is determined; based on the second service cluster unit to which the user belongs, the first service cluster unit to which the group member corresponding to the group message belongs is determined.

[0052] Specifically, based on the mapping relationship between tenants or group numbers and business cluster units represented by the pre-obtained routing rules for each unit, the business cluster unit corresponding to the tenant is determined, and this business cluster unit is identified as the second business cluster unit to which the user belongs. The second business cluster unit is the user's home unit. Then, based on the second business cluster unit to which the user belongs, the first business cluster unit to which the group member corresponding to the group message belongs can be determined.

[0053] In this application, based on the tenant and the pre-acquired routing rules of each unit, the system can automatically route to the second business cluster unit to which the user belongs; then, based on the second business cluster unit to which the user belongs, the system can automatically route to the first business cluster unit to which the group member corresponding to the group message belongs, so that the first service in the first business cluster unit can send the group message to the group member, thereby realizing cross-unit message processing that decouples the business system from the routing logic, improving development efficiency, and improving message processing efficiency.

[0054] Optionally, determining the first service cluster unit to which the group member corresponding to the group message belongs based on the second service cluster unit to which the user belongs includes: A first request is sent to the second service in the second service cluster unit, the first request including the target group number corresponding to the group message; the second service is used to determine the third service cluster unit to which the target group number belongs based on the target group number and the pre-acquired routing rules of each unit; and to determine the first service cluster unit to which the group member corresponding to the group message belongs based on the third service cluster unit to which the target group number belongs.

[0055] Specifically, a first request (e.g., an SDK request) is sent to the second service in the second service cluster unit. The first request includes the target group number corresponding to the group message. The routing SDK in the second service determines the service cluster unit corresponding to the target group number based on the target group number and the mapping relationship between the tenant or group number and the service cluster unit represented by the pre-obtained routing rules of each unit. This service cluster unit is then identified as the third service cluster unit to which the target group number belongs, and the third service cluster unit is the group's home unit. Based on the third service cluster unit to which the target group number belongs, the first service cluster unit to which the group member corresponding to the group message belongs can be determined.

[0056] In this application, a first request is sent to a second service in a second business cluster unit. The first request includes a target group number corresponding to the group message. The second service is used to determine the third business cluster unit to which the target group number belongs based on the target group number and the pre-acquired routing rules of each unit. Then, based on the third business cluster unit to which the target group number belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined. This enables the first service in the first business cluster unit to send the group message to the group member, thereby achieving cross-unit message processing that decouples the business system from the routing logic, improving development efficiency, and also improving message processing efficiency.

[0057] Optionally, determining the first service cluster unit to which the group member corresponding to the group message belongs based on the third service cluster unit to which the target group number belongs includes: Send a second request to the third service in the third service cluster unit, the second request including the target group number corresponding to the group message; the third service is used to query the group member corresponding to the target group number based on the target group number, and determine the first service cluster unit to which the group member corresponding to the group message belongs based on the tenant corresponding to the group member and the mapping relationship between the tenant or group number and the service cluster unit represented by the pre-obtained routing rules of each unit respectively.

[0058] Specifically, a second request (e.g., an SDK request) is sent to the third service in the third service cluster unit. The second request includes the target group number corresponding to the group message and is used to query the group members corresponding to the target group number. The routing SDK in the third service queries the group members corresponding to the target group number based on the target group number, and determines the first service cluster unit to which the group members corresponding to the group message belong based on the tenants corresponding to the group members and the mapping relationship between the tenants or group numbers and service cluster units represented by the pre-obtained routing rules of each unit.

[0059] In this application, a second request is sent to a third service in the third business cluster unit. The second request includes a target group number corresponding to the group message. The third service is used to query the group members corresponding to the target group number based on the target group number, and determine the first business cluster unit to which the group member corresponding to the group message belongs based on the tenant corresponding to the group member and the mapping relationship between the tenant or group number and the business cluster unit represented by the pre-obtained routing rules of each unit. This enables the first service in the first business cluster unit to send the group message to the group member, realizing cross-unit message processing that decouples the business system from the routing logic, improving development efficiency, and improving message processing efficiency.

[0060] Figure 3 This is a second flowchart illustrating the message processing method provided by the present invention, as shown below. Figure 3 As shown, the cross-unit call process involved in the message processing method, taking a user sending a group message as an example, includes the following steps 1-16.

[0061] Step 1: The user sends a group message to the group through the gateway.

[0062] Step 2: The gateway-integrated routing SDK parses the user's corresponding tenant. Based on the tenant, it queries multiple cached unit routing rules and determines the user's assigned business cluster unit based on the mapping relationship between the tenant or group number represented by each of the multiple unit routing rules and the business cluster unit. It then determines whether the user's assigned business cluster unit is business cluster unit 1, i.e., whether the user belongs to business cluster unit 1. If the user belongs to business cluster unit 1, proceed to step 3; otherwise, proceed to step 4.

[0063] Step 3: The gateway-integrated routing SDK sends a request to the service (group chat service) in business cluster unit 1. The request includes the target group number corresponding to the group message, and then proceeds to step 5.

[0064] Step 4: The gateway-integrated routing SDK sends a request to the service (group chat service) in business cluster unit 2. The request includes the target group number corresponding to the group message, and then proceeds to step 14.

[0065] Step 5: The routing SDK integrated in the service (group chat service) of business cluster unit 1 requests a query to the group member list and parses the target group number. Based on the target group number and the mapping relationship between the tenant or group number and the business cluster unit represented by the pre-obtained routing rules of each unit, the business integration unit to which the target group number belongs is determined. It is then determined whether the business integration unit to which the target group number belongs is business cluster unit 1, i.e., whether the target group number belongs to business cluster unit 1. If the target group number does not belong to business cluster unit 1, i.e., the business integration unit to which the target group number belongs is business cluster unit 2, proceed to step 6; if the target group number belongs to business cluster unit 1, i.e., it does not cross units, proceed to step 11.

[0066] Step 6: The routing SDK integrated in the service (group chat service) of business cluster unit 1 sends a request to the service (group chat service) of business cluster unit 2. The request includes the target group number corresponding to the group message, and then proceeds to step 7.

[0067] Step 7: The routing SDK integrated in the service (group chat service) of business cluster unit 2 requests a query for the group member list based on the target group number, and resolves the tenants corresponding to the group members. Based on the tenants corresponding to the group members and the mapping relationship between the tenants or group numbers and business cluster units represented by the pre-obtained routing rules of each unit, it determines the business integration unit to which the group member's tenant belongs, and determines whether the business integration unit to which the group member's tenant belongs is business cluster unit 2. If the business integration unit to which the group member's tenant belongs does not belong to business cluster unit 2, that is, the business integration unit to which the group member's tenant belongs is business cluster unit 1, proceed to step 8; if the first business integration unit belongs to business cluster unit 2, that is, the first business integration unit to which the group member's tenant belongs is business cluster unit 2, proceed to step 9.

[0068] Step 8: The routing SDK integrated in the service (group chat service) in business cluster unit 2 sends group messages to the service (message service) in business cluster unit 1. The service (message service) in cluster unit 1 then sends the group messages to the group members.

[0069] Step 9: The routing SDK integrated in the service (group chat service) of business cluster unit 2 sends the group message to the service (message service) of business cluster unit 2.

[0070] Step 11: The routing SDK integrated in the service (group chat service) of business cluster unit 1 sends group messages, parses the tenants corresponding to the group members, and determines the business integration unit to which the tenants corresponding to the group members belong, based on the pre-obtained mapping relationship between the tenants or group numbers represented by the routing rules of each unit and the business cluster units. It then determines whether the business integration unit to which the tenants corresponding to the group members belong is business cluster unit 1. If the business integration unit to which the tenants corresponding to the group members belong does not belong to business cluster unit 1, i.e., the business integration unit to which the tenants corresponding to the group members belong is business cluster unit 2, proceed to step 12; if the business integration unit to which the tenants corresponding to the group members belong to business cluster unit 1, proceed to step 13.

[0071] Step 12: The routing SDK integrated in the service (group chat service) in business cluster unit 1 sends group messages to the service (message service) in business cluster unit 2, and the service (message service) in cluster unit 2 sends the group messages to the group members.

[0072] Step 13: The routing SDK integrated in the service (group chat service) in business cluster unit 1 sends group messages to the service (message service) in business cluster unit 1, and the service (message service) in business cluster unit 1 sends the group messages to the group members.

[0073] Step 14: The routing SDK integrated in service cluster unit 2 (group chat service) requests a query to the group member list and parses the target group number. Based on the target group number and the mapping relationship between the tenant or group number and the service cluster unit represented by the pre-obtained routing rules of each unit, the service integration unit to which the target group number belongs is determined. It is then determined whether the service integration unit to which the target group number belongs is service cluster unit 2, i.e., whether the target group number belongs to service cluster unit 2. If the target group number does not belong to service cluster unit 2, i.e., the service integration unit to which the target group number belongs is service cluster unit 1, proceed to step 15; if the target group number belongs to service cluster unit 2, i.e., it does not cross units, proceed to step 11.

[0074] Step 15: The routing SDK integrated in the service (group chat service) in business cluster unit 2 sends a request to the service (group chat service) in business cluster unit 1. The request includes the target group number, and then proceeds to step 16.

[0075] Step 16: The routing SDK integrated in the service (group chat service) of business cluster unit 1 requests a query for the group member list based on the target group number, and resolves the tenants corresponding to the group members. Based on the tenants corresponding to the group members and the mapping relationship between the tenants or group numbers and business cluster units represented by the pre-obtained routing rules of each unit, it determines the business integration unit to which the group member's tenant belongs, and determines whether the business integration unit to which the group member's tenant belongs is business cluster unit 1. If the business integration unit to which the group member's tenant belongs does not belong to business cluster unit 1, that is, the business integration unit to which the group member's tenant belongs is business cluster unit 2, proceed to step 12; if the first business integration unit belongs to business cluster unit 1, that is, the first business integration unit to which the group member's tenant belongs is business cluster unit 1, proceed to step 13.

[0076] The method provided by this invention implements an automated call chain in the routing SDK: "unit routing rule caching → unit routing rule matching → dynamic replacement of RPC endpoints". After caching the unit routing rules, the method parses the request parameters (such as the user's corresponding tenant, group number, and the tenant corresponding to the group member), matches the cached routing rules to determine the target business cluster unit, and then automatically replaces the JSF service call endpoint to the service in the target business cluster unit through AOP interception or JSF dynamic proxy mechanism, realizing cross-unit calls with zero code modification.

[0077] Optionally, the method further includes: If the number of times the first request or the second request fails to be sent exceeds a preset number, the circuit breaker mechanism will be triggered or a response message will be returned.

[0078] Specifically, in response to network jitter, temporary unavailability of the second or third service cluster unit, the routing SDK has a built-in exponential retry mechanism. That is, when a cross-unit call fails, it will be retried through an exponential backoff algorithm, and the number of retries is preset. For example, a maximum of 3 retries, with the first retry taking 500ms, the second retry taking 1000ms, and the third retry taking 2000ms.

[0079] If the number of failed first or second requests exceeds a preset number, the circuit breaker mechanism is triggered, automatically degrading to a local ternary service for processing; or a response message is returned, such as an empty response, allowing the service provider to decide how to handle the situation.

[0080] In this application, a circuit breaker is used to monitor the failure rate of cross-unit calls. If the number of failed attempts for the first or second request exceeds a preset number, the circuit breaker mechanism is triggered. After the circuit breaker is triggered, the service automatically degrades to the local unit's service, prioritizing the use of the unit routing rules cached in the local unit's service's routing SDK to handle the failure or return a response message. The combination of the circuit breaker pattern and multi-level caching design ensures the availability of the system.

[0081] The message processing apparatus provided by the present invention will be described below. The message processing apparatus described below and the message processing method described above can be referred to in correspondence.

[0082] Figure 4 This is a schematic diagram of the message processing device provided by the present invention, as shown below. Figure 4 As shown, the message processing device 400 includes: a first determining module 401, a second determining module 402, and a sending module 403; wherein, The first determining module 401 is used to determine the tenant corresponding to the user who sent the group message; The second determining module 402 is used to determine the first service cluster unit to which the group member corresponding to the group message belongs, based on the tenant and at least one pre-acquired unit routing rule; the unit routing rule represents the mapping relationship between the tenant or group number and the service cluster unit; the service cluster unit includes at least one service; The sending module 403 is used to send the group message to the first service in the first service cluster unit, and the first service is used to send the group message to the group members.

[0083] The message processing apparatus provided by this invention determines the tenant corresponding to the user sending the group message; based on the tenant and at least one pre-acquired unit routing rule, determines the first business cluster unit to which the group member corresponding to the group message belongs; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service; and sends the group message to a first service in the first business cluster unit, the first service being used to send the group message to the group member. Since the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit, and the business cluster unit includes at least one service, the approximate routing can automatically route to the first business cluster unit to which the group member corresponding to the group message belongs, enabling the first service in the first business cluster unit to send the group message to the group member. This achieves cross-unit message processing decoupled from the business system and routing logic, improving development efficiency and message processing efficiency.

[0084] Optionally, the second determining module 402 is specifically used for: Based on the tenant and the pre-acquired routing rules of each unit, the second business cluster unit to which the user belongs is determined; Based on the second business cluster unit to which the user belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined.

[0085] Optionally, the second determining module 402 is further configured to: Send a first request to the second service in the second service cluster unit, the first request including the target group number corresponding to the group message; the second service is used to determine the third service cluster unit to which the target group number belongs based on the target group number and the pre-acquired routing rules of each of the units; Based on the third business cluster unit to which the target group number belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined.

[0086] Optionally, the second determining module 402 is further configured to: The step of determining the first service cluster unit to which the group member corresponding to the group message belongs, based on the third service cluster unit to which the target group number belongs, includes: Send a second request to the third service in the third service cluster unit, the second request including the target group number corresponding to the group message; the third service is used to query the group member corresponding to the target group number based on the target group number, and determine the first service cluster unit to which the group member corresponding to the group message belongs based on the tenant corresponding to the group member and the mapping relationship between the tenant or group number and the service cluster unit represented by the pre-obtained routing rules of each unit respectively.

[0087] Optionally, the message processing device 400 further includes: The calling module is used to call the query interface to obtain the routing rules of each unit from the unit routing rule management center.

[0088] Optionally, the message processing device 400 further includes: The switching module is used to switch to locally cached historical unit routing rules and record alarm logs when no unit routing rules are obtained from the unit routing rule management center.

[0089] Optionally, the message processing device 400 further includes: The triggering module is used to trigger the circuit breaker mechanism or return a response message if the number of times the first request or the second request fails to be sent exceeds a preset number.

[0090] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device 500 may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communication bus 540. The processor 510 may invoke logical instructions in the memory 530 to execute a message processing method, which includes: determining the tenant corresponding to the user sending the group message; determining, based on the tenant and at least one pre-acquired unit routing rule, the first service cluster unit to which the group member corresponding to the group message belongs; the unit routing rule representing the mapping relationship between the tenant or group number and the service cluster unit; the service cluster unit including at least one service; and sending the group message to a first service in the first service cluster unit, the first service being used to send the group message to the group member.

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

[0092] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the message processing method provided by the above methods. The method includes: determining the tenant corresponding to the user sending the group message; determining the first business cluster unit to which the group member corresponding to the group message belongs based on the tenant and at least one pre-acquired unit routing rule; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service; and sending the group message to a first service in the first business cluster unit, wherein the first service is used to send the group message to the group member.

[0093] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the message processing method provided by the above methods. The method includes: determining the tenant corresponding to the user sending the group message; determining, based on the tenant and at least one pre-acquired unit routing rule, a first service cluster unit to which the group member corresponding to the group message belongs; the unit routing rule representing a mapping relationship between the tenant or group number and the service cluster unit; the service cluster unit including at least one service; and sending the group message to a first service in the first service cluster unit, the first service being used to send the group message to the group member.

[0094] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A message processing method, characterized in that, include: Determine the tenant corresponding to the user who sent the group message; Based on the tenant and at least one pre-acquired unit routing rule, the first service cluster unit to which the group member corresponding to the group message belongs is determined; the unit routing rule represents the mapping relationship between the tenant or group number and the service cluster unit; the service cluster unit includes at least one service. The group message is sent to the first service in the first service cluster unit, and the first service is used to send the group message to the group members.

2. The message processing method according to claim 1, characterized in that, The step of determining the first service cluster unit to which the group member corresponding to the group message belongs, based on the tenant and at least one pre-acquired unit routing rule, includes: Based on the tenant and the pre-acquired routing rules of each unit, the second business cluster unit to which the user belongs is determined; Based on the second business cluster unit to which the user belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined.

3. The message processing method according to claim 2, characterized in that, The step of determining the first service cluster unit to which the group member corresponding to the group message belongs, based on the second service cluster unit to which the user belongs, includes: Send a first request to the second service in the second service cluster unit, the first request including the target group number corresponding to the group message; the second service is used to determine the third service cluster unit to which the target group number belongs based on the target group number and the pre-acquired routing rules of each of the units; Based on the third business cluster unit to which the target group number belongs, the first business cluster unit to which the group member corresponding to the group message belongs is determined.

4. The message processing method according to claim 3, characterized in that, The step of determining the first service cluster unit to which the group member corresponding to the group message belongs, based on the third service cluster unit to which the target group number belongs, includes: Send a second request to the third service in the third service cluster unit, the second request including the target group number corresponding to the group message; the third service is used to query the group member corresponding to the target group number based on the target group number, and determine the first service cluster unit to which the group member corresponding to the group message belongs based on the tenant corresponding to the group member and the mapping relationship between the tenant or group number and the service cluster unit represented by the pre-obtained routing rules of each unit respectively.

5. The message processing method according to any one of claims 1 to 4, characterized in that, The method further includes: Call the query interface to obtain the routing rules for each unit from the unit routing rule management center.

6. The message processing method according to claim 5, characterized in that, The method further includes: If no unit routing rules are obtained from the unit routing rule management center, switch to the locally cached historical unit routing rules and record an alarm log.

7. The message processing method according to claim 4, characterized in that, The method further includes: If the number of times the first request or the second request fails to be sent exceeds a preset number, the circuit breaker mechanism will be triggered or a response message will be returned.

8. A message processing device, characterized in that, include: The first determination module is used to determine the tenant corresponding to the user who sent the group message; The second determining module is used to determine the first business cluster unit to which the group member corresponding to the group message belongs, based on the tenant and at least one pre-acquired unit routing rule; the unit routing rule represents the mapping relationship between the tenant or group number and the business cluster unit; the business cluster unit includes at least one service; The sending module is used to send the group message to the first service in the first service cluster unit, and the first service is used to send the group message to the group members.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the message processing method as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the message processing method as described in any one of claims 1 to 7.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the message processing method as described in any one of claims 1 to 7.