Business processing method and device, business system and equipment, and computer program product

By using message queues and consumer mechanisms in the front-end cluster to process session connections and business messages in the banking system, the session consistency problem in the certificate mode is solved, multi-functional deployment and correct business request routing are achieved, and the system flexibility and scalability are improved.

CN119996483AActive Publication Date: 2025-05-13中国邮政储蓄银行股份有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510208443.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-05-13
Estimated Expiration
2045-02-25

Smart Images

  • Figure CN119996483A_ABST
    Figure CN119996483A_ABST
Patent Text Reader

Abstract

The invention discloses a service processing method and device, a service system, equipment and a computer program product, the method is executed by a front-end processor cluster deployed with multiple front-end processor nodes, and a first consumer and a second consumer are created in the front-end processor nodes. Processing a session connection message of the core service cluster based on the first consumer, and establishing a session connection between the core service cluster and a third-party system through the target front-end processor node; after the session connection is established, a session initialization message is sent through the target front-end processor node, and the message carries a service channel identifier and an IP address of the target front-end processor node; and receiving a service message of the core service cluster based on the second consumer, and consuming the service message through the target front-end processor node. According to the application, the service channel is associated with the IP address of the front-end processor based on the message queue, so that multi-activity deployment of the front-end processor cluster is realized, session consistency is ensured, decoupling of the front-end processor and the core service is realized, and the flexibility and expandability of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of business processing technology, and in particular to a business processing method, device, business system and equipment, and computer program product. Background Art

[0002] In banking systems, data accessed by third-party systems usually involves data exchange and system integration with external service providers (such as payment gateways, financial information service providers, credit rating agencies, identity authentication service providers, etc.). This type of data access needs to ensure security, high availability, session consistency, and data consistency, especially when processing sensitive financial information. With the continuous improvement of the digitalization level of banks, in response to scenarios with a large number of business types and complex business processes, the banking industry has gradually formed a general system architecture model that combines third-party systems, front-end clusters, and core business clusters, in which the core business cluster and the front-end cluster are combined as business system clusters.

[0003] Generally, to ensure security, third-party systems use TCP protocol and TLS / SSL channel encryption technology to authenticate the login of front-end system users. After the business channel user successfully logs in, a session is established between the front-end and the third-party system to maintain information exchange between them. For security and management considerations, the third-party system provides a single certificate, and the business channel session is established in a single certificate mode, that is, at the same time, a channel user can only log in to one front-end server and establish a session on this front-end server. In a multi-front-end cluster deployment, since all front-end servers use the same certificate for encrypted communication, the problem of cross-system session consistency becomes complicated. Different front-end nodes do not know each other's session information, which may lead to the following problems: If the business system cannot accurately determine which front-end node has established a connection with the third-party system, the session request may be mistakenly routed to the incorrect node, thereby affecting subsequent business processing.

[0004] In response to the above problems, the existing technology provides several solutions, including distributed session management based on Redis, session management based on API gateway, and event-driven architecture based on message queue. However, these solutions still have different limitations when dealing with distributed session consistency and cross-system session management, such as increasing data transmission risks and failing to ensure the consistency of session information. Summary of the invention

[0005] The embodiments of the present application provide a business processing method, apparatus, business system and equipment, and computer program product to implement multi-active deployment of a front-end cluster in a single certificate mode and ensure session consistency.

[0006] The present application embodiment adopts the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides a service processing method, wherein the service processing method is executed by a front-end cluster, wherein multiple active front-end nodes are deployed in the front-end cluster, and each front-end node has a first consumer and a second consumer based on a message queue created therein, and the service processing method includes:

[0008] Processing a session connection message of the core service cluster based on the first consumer and establishing a session connection between the core service cluster and a third-party system through a target front-end node, wherein the target front-end node is one of the multi-active front-end nodes;

[0009] When the session connection is successfully established, a session initialization message is sent through the target front-end node, wherein the session initialization message carries a service channel identifier and an IP address of the target front-end node, so that the service node of the core service cluster caches the service channel identifier and the IP address of the target front-end node;

[0010] Based on the second consumer receiving the business message of the core business cluster and consuming the business message through the target front-end node, the business message carries a label, and the label is set to the IP address of the target front-end node corresponding to the cached business channel identifier.

[0011] Optionally, the processing of the session connection message of the core service cluster based on the first consumer and establishing a session connection between the core service cluster and the third-party system through the target front-end node includes:

[0012] Receive a session connection message of a core service cluster based on a subscribed connection message topic, wherein the session connection message carries a service channel identifier;

[0013] In single certificate mode, establishing a communication connection between the front-end node and the third-party system;

[0014] Determine the target front-end processor node among the multiple active front-end processor nodes based on the load balancing strategy;

[0015] Based on the communication connection between the target front-end node and the third-party system, the session connection message is forwarded to the third-party system, so that the third-party system performs user identity authentication according to the session connection message.

[0016] Optionally, when the session connection is successfully established, sending a session initialization message through the target front-end node includes:

[0017] Receiving a session connection success message returned by the third-party system;

[0018] Based on the session connection success message, generate a session initialization message;

[0019] The session initialization message is sent to a message queue through the target front-end node, so that a service node of a core service cluster that has subscribed to the session initialization message receives the session initialization message.

[0020] Optionally, the receiving the service message of the core service cluster based on the second consumer and consuming the service message through the target front-end node includes:

[0021] Receiving a service message of a core service cluster based on a service message topic subscribed by the second consumer;

[0022] The target front-end node is determined based on the tag corresponding to the second consumer and the tag carried in the service message, and the service message is consumed through the target front-end node.

[0023] Optionally, the first consumer is created in the following manner:

[0024] Create an implementation class for the first message receiving and processing interface;

[0025] A first annotation is added to the implementation class of the first message receiving and processing interface, where the first annotation is used to establish a corresponding consumer group and subscription connection message topic for each front-end node.

[0026] Optionally, the second consumer is created in the following manner:

[0027] Create an implementation class for the second message receiving and processing interface;

[0028] A second annotation is added to the implementation class of the second message receiving and processing interface, and the second annotation is used to establish corresponding consumer groups and tags for each front-end node and subscribe to a business message topic, and the business message topic is configured as the service name of the front-end node.

[0029] Optionally, the service processing method further includes:

[0030] When the session connection triggers a termination condition, a session termination message is sent to a message queue, so that a service node of a core service cluster that has subscribed to the session termination message receives the session termination message.

[0031] In a second aspect, an embodiment of the present application further provides a service processing device, which is applied to a front-end cluster, in which multiple active front-end nodes are deployed, and each front-end node has a first consumer and a second consumer based on a message queue, and the service processing device includes:

[0032] A first consumer unit is used to process a session connection message of a core business cluster based on the first consumer and establish a session connection between the core business cluster and a third-party system through a target front-end node, where the target front-end node is one of the multi-active front-end nodes;

[0033] A first sending unit is used to send a session initialization message through the target front-end node when the session connection is successfully established, wherein the session initialization message carries a service channel identifier and an IP address of the target front-end node, so that the service node of the core service cluster caches the service channel identifier and the IP address of the target front-end node;

[0034] The second consumption unit is used to receive the business message of the core business cluster based on the second consumer and consume the business message through the target front-end node, the business message carries a label, and the label is set to the IP address of the target front-end node corresponding to the cached business channel identifier.

[0035] In a third aspect, an embodiment of the present application further provides a business system, the business system comprising a core business cluster and a front-end cluster, the front-end cluster being used to execute any of the aforementioned business processing methods.

[0036] Optionally, the core service cluster includes multiple service nodes, and the service nodes are further used to:

[0037] Receiving a session initialization message based on a subscription, wherein the session initialization message carries a service channel identifier and an IP address of a front-end node;

[0038] The business channel identifier and the IP address of the front-end node are cached accordingly.

[0039] Optionally, the service node is further used for:

[0040] Receiving a service request and obtaining a service channel identifier according to the service request;

[0041] Acquire the IP address of the front-end node corresponding to the service channel identifier from the cache according to the service channel identifier;

[0042] Encapsulating a service message according to the service request and the IP address of the front-end node;

[0043] The service message is sent to a message queue whose message subject is the service name of the front-end node, and the label of the service message is set to the IP address of the front-end node.

[0044] In a fourth aspect, an embodiment of the present application further provides a device, including:

[0045] A processor; and a memory arranged to store computer executable instructions, which, when executed, cause the processor to perform any of the aforementioned business processing methods.

[0046] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program / instruction, which implements any of the aforementioned business processing methods when executed by a processor.

[0047] At least one of the above-mentioned technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: the business processing method of the embodiments of the present application is executed by a front-end machine cluster, and multiple active front-end machine nodes are deployed in the front-end machine cluster. A first consumer and a second consumer based on a message queue are created in each front-end machine node. The business processing method includes: based on the first consumer, processing the session connection message of the core business cluster and establishing a session connection between the core business cluster and the third-party system through the target front-end machine node, and the target front-end machine node is one of the multiple active front-end machine nodes; when the session connection is successfully established, sending a session initialization message through the target front-end machine node, the session initialization message carries a business channel identifier and the IP address of the target front-end machine node, so that the business node of the core business cluster caches the business channel identifier and the IP address of the target front-end machine node; receiving the business message of the core business cluster based on the second consumer and consuming the business message through the target front-end machine node, the business message carries a label, and the label is set to the IP address of the target front-end machine node corresponding to the cached business channel identifier. The business processing method of the embodiment of the present application is based on a message queue. Under the premise of meeting security requirements, by associating the business channel with the front-end IP address, and using message topics and tags to filter messages, multi-active deployment of the front-end cluster and the core business cluster is achieved, and session consistency is ensured. The introduction of the message queue also realizes the decoupling of the front-end and the core business, thereby improving the flexibility and scalability of the entire system. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0049] Figure 1 A flowchart of a business processing method in an embodiment of the present application;

[0050] Figure 2 This is a schematic diagram of an overall business processing flow in an embodiment of the present application;

[0051] Figure 3 This is a schematic diagram of the structure of a service processing device in an embodiment of the present application;

[0052] Figure 4 This is a schematic diagram of the structure of a device in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0054] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0055] The technical terms involved in this application mainly include:

[0056] 1) RocketMQ: RocketMQ is Alibaba's open source distributed messaging middleware that supports transactional messaging, sequential messaging, batch messaging, scheduled messaging, message backtracking, etc. The system consists of Producer, Consumer, Broker, NameServer, etc. Consumers filter messages by subscribing to different topics and tags.

[0057] 2) Redis: Redis (Remote Dictionary Server) is an open source memory database that complies with the BSD protocol. It provides a high-performance key-value storage system, which is often used in application scenarios such as caching, message queues, and session storage. Redis not only supports simple key-value data, but also provides storage for data structures such as list, set, zset (ordered set), and hash. These data types can better meet specific business needs.

[0058] 3) IP address: IP (Internet Protocol) is an Internet protocol that stipulates that all devices on the network must have a unique IP address.

[0059] 4) Front-end: In the system architecture of financial institutions such as banks, "front-end" usually refers to an intermediate device or system that caches, forwards and isolates data between the intranet and the extranet. As a bridge between the core business system and external systems (such as third-party payment platforms, partners, other financial institutions, etc.), it undertakes multiple key tasks such as data exchange, protocol adaptation, and performance optimization. As an intermediary connecting the intranet and the extranet, it has important functions such as caching and database isolation.

[0060] 5) Business channels: In financial business, "business channels" not only refer to the way or platform to communicate with customers, but also involve the management and processing of transactions, especially for different transaction types (such as pledged repurchase, foreign exchange transactions, etc.). By assigning different channel accounts to different types of transaction requests such as RFT (Request for Tender), ODM (Order driven Market) and RFQ (Request For Quotation), banks and other financial institutions can effectively manage and control operations of different transaction types to ensure safe, compliant and efficient transaction execution. This design helps to improve transaction transparency and operational flexibility, while enhancing risk management capabilities for complex transaction types.

[0061] To solve the problem of session routing errors that may occur in the single certificate mode, the existing technology provides the following solutions:

[0062] 1) Distributed session management based on Redis

[0063] As an efficient caching and storage solution, Redis is often used to implement distributed session management. In this solution, session information is stored in a Redis cluster, and multiple services can share session status through Redis.

[0064] 2) Session management based on API gateway

[0065] In a microservice architecture, API gateways (such as Kong, Nginx, etc.) can be used to handle cross-service request routing, authentication, and session management. The API gateway carries session information in the request header and passes it to the backend service so that the server can identify the user's session status.

[0066] 3) Event-driven architecture based on message queue

[0067] In some event-driven architectures, message queues are used to handle asynchronous communication between systems. In this solution, message queues are used to achieve decoupling between systems and can transmit some event information between systems, such as user login, session change, etc. Common implementations include: event-driven architecture based on Kafka or RabbitMQ, where systems synchronize state changes through message transmission. For example, after a user logs in, the login event will be sent to the core business system, front-end system, etc. through the message queue, and the relevant systems synchronize session information by consuming these messages.

[0068] The above solutions have different limitations when dealing with distributed session consistency and cross-system session management, which are as follows:

[0069] 1) Distributed session management based on Redis

[0070] In the microservice architecture that combines the front-end cluster and the core business cluster, the front-end serves as an isolation layer between the internal and external networks. The front-end can prevent external applications from directly accessing the core business system, thereby enhancing the security of the system. If Redis distributed session management is added to both the front-end cluster and the core business cluster, although consistency can be provided, the risk of the core business data being stolen or tampered with during transmission increases.

[0071] 2) Session management based on API gateway

[0072] This solution is mainly applicable to request routing and authentication, and does not involve session information synchronization or distributed session management across multiple systems. If the system has multiple front-end machines and services, the API gateway cannot automatically synchronize session information, resulting in the inability to ensure the consistency of session information.

[0073] 3.) Event-driven architecture based on message queue

[0074] Although this solution provides asynchrony and decoupling, in complex multi-front-end clusters and distributed session management, it is still a challenge to correctly route session information in a multi-front-end cluster in a single certificate mode to ensure that subsequent business requests can be processed correctly. If the subscription and consumption strategies of the message queue are not designed properly, it may cause delays or inconsistencies in session status updates, especially in an environment across multiple systems and clusters.

[0075] In summary, in the banking system, the single certificate mode can effectively ensure the security of communication and the reliability of encrypted transmission and identity authentication. However, in the complex environment of multiple front-end clusters, there are problems with using existing solutions for session management and load balancing: the single certificate mode may cause session consistency issues, making it difficult to load business channel requests to a specific front-end that has established a connection with a third-party system. In the case of a multi-active cluster deployment of front-ends, business cannot be carried out and proceed smoothly.

[0076] Based on this, an embodiment of the present application provides a business processing method, which is executed by a front-end cluster. Multiple active front-end nodes are deployed in the front-end cluster, and a first consumer and a second consumer based on a message queue are created in each front-end node.

[0077] The business processing method of the embodiment of the present application is executed by a front-end machine cluster, in which multiple active front-end machine nodes are deployed. Two consumers are created in each front-end machine node based on the message queue, which respectively process connection messages and business messages from business channels. The purpose is to achieve more efficient message processing, decouple different types of business logic, and improve the scalability and fault tolerance of the system.

[0078] Furthermore, if Figure 1 As shown, a flowchart of a service processing method in an embodiment of the present application is provided, and the service processing method at least includes the following steps S110 to S130:

[0079] Step S110 , based on the first consumer processing the session connection message of the core business cluster and establishing a session connection between the core business cluster and a third-party system through a target front-end node, wherein the target front-end node is one of the multi-active front-end nodes.

[0080] Combination Figure 2 , provides a schematic diagram of the overall business processing flow in an embodiment of the present application. The role of the first consumer is to monitor and process session connection request messages from the core business cluster. When a core business cluster (a collection of multiple business nodes) needs to establish a session connection with a third-party system (such as a payment gateway, database service, etc.), it sends a session connection request message to the message queue of the front-end cluster. The first consumer is responsible for monitoring the message queue, and once a session connection request message is detected, it selects a target front-end node (i.e., one of the multi-active front-end nodes) to process the message according to the load balancing strategy or other rules.

[0081] The selected front-end node, ie, the target front-end node, is responsible for actually establishing a session connection with the third-party system. This connection may be implemented based on TCP / IP or other communication protocols.

[0082] Step S120, when the session connection is successfully established, a session initialization message is sent through the target front-end node, and the session initialization message carries a service channel identifier and the IP address of the target front-end node, so that the service node of the core service cluster caches the service channel identifier and the IP address of the target front-end node.

[0083] After the target front-end node successfully establishes a session connection with the third-party system, the target front-end node sends a session initialization message through the message queue. This session initialization message contains two key pieces of information:

[0084] 1) Business channel identification: This is a unique identifier of a business channel, used to distinguish different business channels or business flows. It helps the core business cluster know which business channel needs to use this session connection.

[0085] 2) IP address of the target front-end node: This is the network address of the target front-end node. The core business cluster needs to know this address so that it can subsequently route business messages to the correct front-end node to ensure session consistency.

[0086] After receiving the session initialization message, the core business cluster will cache the business channel identifier and the IP address of the target front-end node in the message for use in subsequent business processing.

[0087] It should be noted that in addition to using the IP address of the front-end node as the unique identifier associated with the business channel, the snowflake algorithm can also be used to generate a globally unique ID to replace the front-end IP address, which can also achieve the purpose of associating the business channel with the corresponding front-end node.

[0088] Step S130, based on the second consumer receiving the business message of the core business cluster and consuming the business message through the target front-end node, the business message carries a label, and the label is set to the IP address of the target front-end node corresponding to the cached business channel identifier.

[0089] The role of the second consumer is to monitor and process business messages from the core business cluster. Business messages contain specific business data and tag information that need to be processed. This tag is set to the IP address of the target front-end node corresponding to the previously cached business channel identifier. When the second consumer receives the subscribed business message, it needs to determine whether to process the business message based on its own IP address and the tag carried in the business message. Since the tag is associated with the IP address of the target front-end node, it can ensure that the business message is consumed by the correct node.

[0090] The message queue used in the business processing method of the embodiment of the present application may be, for example, RocketMQ, RabbitMQ, etc. The specific form of the message queue may be flexibly selected by those skilled in the art according to actual needs, and is not specifically limited here.

[0091] The business processing method of the embodiment of the present application is based on a message queue. Under the premise of meeting security requirements, by associating the business channel with the front-end IP address, and using message topics and tags to filter messages, multi-active deployment of the front-end cluster and the core business cluster is achieved, and session consistency is ensured. The introduction of the message queue also realizes the decoupling of the front-end and the core business, thereby improving the flexibility and scalability of the entire system.

[0092] In some embodiments of the present application, the processing of the session connection message of the core business cluster based on the first consumer and establishing a session connection between the core business cluster and the third-party system through the target front-end node include: receiving the session connection message of the core business cluster based on the subscribed connection message topic, the session connection message carrying a business channel identifier; establishing a communication connection between the front-end node and the third-party system in a single certificate mode; determining the target front-end node among the multi-active front-end nodes based on a load balancing strategy; and forwarding the session connection message to the third-party system based on the communication connection between the target front-end node and the third-party system, so that the third-party system performs user identity authentication according to the session connection message.

[0093] The first consumer in the front-end cluster subscribes to a specific message topic, which is used to receive session connection requests from the core business cluster. When the core business cluster needs to establish a session connection with a third-party system, it sends a session connection message containing a business channel identifier to the message queue of this topic. The business channel identifier is an important piece of information that is used to distinguish different business channels or business scenarios to ensure that messages can be processed and routed correctly.

[0094] After the microservices of the core business cluster are started, they will encapsulate session connection messages of different channels. The session connection messages contain code attributes that identify different business channels. The microservices of the core business cluster send the encapsulated messages to the message queue with the topic of session connection (such as "tdconnect"). The front-end cluster will receive the connection message because it has subscribed to the message with the topic of "tdconnect". The target front-end node that receives the connection message then sends the connection message to the third-party system. After receiving the session connection message, the third-party system will perform user identity authentication based on the information in the message to establish a session connection with the core business cluster.

[0095] Because each front-end node server stores the certificate file of the certificate authority approved by the National Cryptography Administration, the front-end node and the third-party system can establish a TCP connection in single-certificate mode and establish an encrypted connection channel based on the file path of the certificate on the Linux server. Single-certificate mode means that all nodes in the front-end cluster use the same certificate for identity authentication and encrypted communication.

[0096] In the above steps, one may also be selected as the target front-end node from the multiple active front-end nodes according to a load balancing strategy (such as polling, minimum number of connections, hash algorithm, etc.). The purpose of the load balancing strategy is to ensure the uniform distribution of session connections and avoid situations where some nodes are overloaded while other nodes are idle. The process of selecting the target front-end node may be dynamic and adjusted according to factors such as real-time load conditions and node health status. Of course, the specific setting of the load balancing strategy can be flexibly set by technicians in this field according to actual needs, and no specific limitation is made here.

[0097] The embodiment of the present application improves the scalability and flexibility of the system by deploying multiple active front-end nodes and using load balancing strategies. In a multiple active front-end cluster, even if a node fails or is under maintenance, other nodes can still continue to process session connection requests to ensure business continuity.

[0098] In some embodiments of the present application, when the session connection is successfully established, sending the session initialization message through the target front-end node includes: receiving a session connection success message returned by the third-party system; generating a session initialization message based on the session connection success message; sending the session initialization message to a message queue through the target front-end node, so that the business nodes of the core business cluster that have subscribed to the session initialization message receive the session initialization message.

[0099] After the third-party system authenticates the front-end user and passes the authentication, it returns a successful connection message. After receiving the successful connection feedback from the third-party system, the front-end cluster generates a session initialization message and sends it through the message queue. The session initialization message contains the business channel code attribute carried in the connection request, the local IP address of the front-end, and other necessary session information.

[0100] Each node in the core business cluster subscribes to the session initialization message. When the core business cluster receives the session initialization message, it saves the service channel code attribute and the front-end IP address in the session initialization message into the cache in the form of hash, etc., and updates the session mapping table. The session mapping table here can maintain the mapping relationship between the service channel code attribute and the front-end IP address in the form of key-value.

[0101] The above cache technology can be implemented based on cache middleware such as Redis, MongoDB or Memecache. The specific cache technology to be adopted can be flexibly selected by technicians in this field according to actual needs, and no specific limitation is made here.

[0102] By carrying the service channel code attribute and the local IP address of the front-end in the session initialization message, each service node can maintain the mapping relationship between the service channel code attribute and the front-end node based on the cache, thereby providing strong support for the correct routing of subsequent session messages and ensuring session consistency.

[0103] In some embodiments of the present application, receiving the business message of the core business cluster based on the second consumer and consuming the business message through the target front-end node includes: receiving the business message of the core business cluster based on the business message topic subscribed by the second consumer; determining the target front-end node based on the tag corresponding to the second consumer and the tag carried in the business message, and consuming the business message through the target front-end node.

[0104] The second consumer will subscribe to the business message topics published by the core business cluster. These topics are usually divided according to business logic and message type to ensure that the second consumer can receive business messages related to it. Once the core business cluster publishes new business messages to the topics subscribed by the second consumer, the second consumer can receive these messages.

[0105] After receiving the service message, the front-end node corresponding to the second consumer needs to determine whether it needs to process the target front-end node of the service message based on its own label and the label carried in the service message. If the front-end node corresponding to the second consumer needs to match its own label with the label carried in the service message, the front-end node corresponding to the second consumer is the target front-end node, that is, the service message is consumed by the front-end node, thereby achieving the correct routing of the service channel message to the front-end.

[0106] In some embodiments of the present application, in a front-end processor cluster, when each front-end processor node application is started, the IP address of its own node is saved as a system attribute.

[0107] In the microservice startup method, use the InetAddress.getLocalHost method to obtain the IP address of the node and assign it to LOCAL_IP. For example, you can use System.setProperty("localIp"LOCAL_IP) to assign a value to LOCAL_IP and set the IP address of the microservice as an environment variable.

[0108] In some embodiments of the present application, the first consumer is created in the following manner: creating an implementation class of a first message receiving and processing interface; adding a first annotation to the implementation class of the first message receiving and processing interface, wherein the first annotation is used to establish a corresponding consumer group and subscription connection message topic for each front-end node.

[0109] The first consumer is responsible for processing business channel connection messages. Taking RocketMQ message queue as an example, when creating the first consumer, you can first create a class that implements the RocketMQListenr interface and add the annotation @RocketMQMessageListener to the class. In the annotation, set consumerGroup = "tdconnect" to indicate that a corresponding consumer group is established for the front-end cluster node, and set topic = "tdconnect" to determine the topic of the message.

[0110] By creating a class that implements a specific message receiving and processing interface and adding annotations to the class to configure the message listener, an efficient, flexible and reliable message processing mechanism is implemented. This provides a strong guarantee for the scalability, performance optimization, centralized management and reliability of the system. At the same time, it also simplifies the configuration process of the message processing logic and improves development efficiency.

[0111] In some embodiments of the present application, the second consumer is created in the following manner: creating an implementation class of a second message receiving and processing interface; adding a second annotation to the implementation class of the second message receiving and processing interface, the second annotation being used to establish corresponding consumer groups and tags for each front-end node and to subscribe to a business message topic, the business message topic being configured as the service name of the front-end node.

[0112] The second consumer is responsible for processing business messages. Taking RocketMQ message queue as an example, when creating the second consumer, the microservice first introduces RocketMQ development dependency, creates a class that implements RocketMQListenr interface, and adds annotation @RocketMQMessageListener to the class. In the annotation, let consumerGroup = "${spring.application.name}${local.ip}" and selectorExpression = "${local.ip}", which means to establish the corresponding consumer group and label (local.ip) for the front-end system cluster node, and let topic = "${spring.application.name}" to determine the subscribed message topic.

[0113] The "application.name" in the above topic is the service name of the front-end node. The topic of the message queue is named after the service. When different services use message queues for communication, the sender and consumer of the message need to be clear. Therefore, when the core business cluster and the front-end cluster interact, the service name of the front-end node needs to be dynamically obtained and mapped to the consumer of the business message.

[0114] Based on the above embodiment, system properties and consumers are all initialized after the Spring microservice is started.

[0115] In some embodiments of the present application, the business processing method further includes: when the session connection triggers a termination condition, sending a session termination message to a message queue so that a business node of a core business cluster that has subscribed to the session termination message receives the session termination message.

[0116] When a session triggers an end condition, such as user logout or session timeout, the front-end system sends a "session termination" message through the message queue. This message informs the core business cluster that the session has ended and any subsequent requests are no longer valid. In the core business cluster, each business node subscribes to the message queue of the session termination message to receive the session termination message.

[0117] By decoupling session termination events from core business logic and processing them asynchronously through message queues, each part of the system can be made more independent and flexible. Even if a part fails or performance degrades, it will not have much impact on the entire system. At the same time, this decoupling and asynchronous processing method also makes the system easier to expand and upgrade.

[0118] The present application embodiment also provides a service processing device 300, such as Figure 3 As shown, a schematic diagram of the structure of a service processing device in an embodiment of the present application is provided, wherein the service processing device 300 is applied to a front-end cluster, wherein multiple active front-end nodes are deployed in the front-end cluster, and each front-end node is created with a first consumer and a second consumer based on a message queue, wherein the service processing device 300 includes: a first consumer unit 310, a first sending unit 320, and a second consumer unit 330, wherein:

[0119] A first consumer unit 310 is configured to process a session connection message of a core service cluster based on the first consumer and establish a session connection between the core service cluster and a third-party system through a target front-end node, wherein the target front-end node is one of the multi-active front-end nodes;

[0120] A first sending unit 320 is used to send a session initialization message through the target front-end node when the session connection is successfully established, wherein the session initialization message carries a service channel identifier and an IP address of the target front-end node, so that the service node of the core service cluster caches the service channel identifier and the IP address of the target front-end node;

[0121] The second consumption unit 330 is used to receive the business message of the core business cluster based on the second consumer and consume the business message through the target front-end node, wherein the business message carries a label, and the label is set to the IP address of the target front-end node corresponding to the cached business channel identifier.

[0122] In some embodiments of the present application, the first consumption unit 310 is specifically used to: receive a session connection message of a core business cluster based on a subscribed connection message topic, wherein the session connection message carries a business channel identifier; establish a communication connection between the front-end node and the third-party system in a single certificate mode; determine the target front-end node among multiple active front-end nodes based on a load balancing strategy; and forward the session connection message to the third-party system based on the communication connection between the target front-end node and the third-party system, so that the third-party system performs user identity authentication according to the session connection message.

[0123] In some embodiments of the present application, the first sending unit 320 is specifically used to: receive a session connection success message returned by the third-party system; generate a session initialization message based on the session connection success message; and send the session initialization message to a message queue through the target front-end node, so that the business nodes of the core business cluster that have subscribed to the session initialization message receive the session initialization message.

[0124] In some embodiments of the present application, the second consumption unit 330 is specifically used to: receive business messages of the core business cluster based on the business message topic subscribed by the second consumer; determine the target front-end node based on the tag corresponding to the second consumer and the tag carried in the business message, and consume the business message through the target front-end node.

[0125] In some embodiments of the present application, the first consumer is created in the following manner: creating an implementation class of a first message receiving and processing interface; adding a first annotation to the implementation class of the first message receiving and processing interface, wherein the first annotation is used to establish a corresponding consumer group and subscription connection message topic for each front-end node.

[0126] In some embodiments of the present application, the second consumer is created in the following manner: creating an implementation class of a second message receiving and processing interface; adding a second annotation to the implementation class of the second message receiving and processing interface, the second annotation being used to establish corresponding consumer groups and tags for each front-end node and to subscribe to a business message topic, the business message topic being configured as the service name of the front-end node.

[0127] In some embodiments of the present application, the business processing device 300 also includes: a second sending unit, used to send a session termination message to a message queue when the session connection triggers a termination condition, so that a business node of the core business cluster that has subscribed to the session termination message receives the session termination message.

[0128] It can be understood that the above-mentioned business processing device can implement each step of the business processing method provided in the above-mentioned embodiment, and the relevant explanations about the business processing method are applicable to the business processing device and will not be repeated here.

[0129] The embodiment of the present application further provides a business system, which includes a core business cluster and a front-end cluster, and the front-end cluster is used to execute any of the business processing methods described above.

[0130] In some embodiments of the present application, the core business cluster includes multiple business nodes, and the business nodes are also used to: receive a session initialization message based on a subscribed session initialization message, wherein the session initialization message carries a business channel identifier and an IP address of a front-end node; and cache the business channel identifier and the IP address of the front-end node accordingly.

[0131] In the core business cluster, each business node subscribes to the message queue of the session initialization message. This means that when a session initialization message is generated, the corresponding session initialization message will be sent to the message queue, and the business node can receive these messages in real time. When the business node receives the session initialization message, it parses the message content, extracts the business channel identifier and the IP address of the front-end node, and caches them. Caching is usually performed in the local memory of the business node to ensure fast access and update. The cache can be in the form of caching the business channel identifier and the IP address of the front-end node in hash form.

[0132] By caching the business channel identifier and the IP address of the front-end node, the business node can find the corresponding front-end node more quickly and establish a connection with it when processing subsequent business requests. On the one hand, it reduces the time overhead of search and routing and improves the efficiency of business processing. On the other hand, it ensures that business messages can be routed to the correct front-end node, thereby ensuring session consistency.

[0133] In some embodiments of the present application, the business node is also used to: receive a business request, and obtain a business channel identifier based on the business request; obtain the IP address of the front-end node corresponding to the business channel identifier from the cache based on the business channel identifier; encapsulate a business message based on the business request and the IP address of the front-end node; send the business message to a message queue whose message subject is the service name of the front-end node, and set the label of the business message to the IP address of the front-end node.

[0134] Taking the transaction scenario of a bank as an example, after the core business cluster receives the transaction request from the front-end trader, it first obtains the code corresponding to the business channel, and then obtains the IP address of the front-end node corresponding to the business channel from the session mapping table of the Redis cache through this code, and then encapsulates the business message, dynamically obtains the service name of the front-end node, and determines the subscribed message topic (i.e. topic="${spring.application.name}), sends the business message to the message queue with the subject as the corresponding front-end node service name, and sets the message tag to the IP address of the corresponding front-end node, and adds the corresponding hashkey at the same time, and puts the message into the specified queue in the order of business. The hashkey is a hash value obtained by combining the IP address of the front-end node with the hashcode function, and then performing a hash slot modulus operation on the IP address. This hashkey is the same as the hashkey stored in the corresponding front-end node, and the hashkey can ensure the order of the business.

[0135] Since the subscription groups and tags of consumers processing business messages in each front-end node are different, after the front-end node receives a message from the business channel, the front-end node will consume the business message only when the tag of the consumer group of the front-end node matches the tag in the message, thereby achieving correct routing of the business channel message to the front-end.

[0136] In summary, the key points of this application are mainly:

[0137] 1) Use the microservice name as the consumer name, generate a unique identifier for each node in the front-end cluster, and use this identifier as a global variable to associate and generate a consumer through the unique identifier. The label and consumer group name of this consumer carry a unique identifier.

[0138] 2) Different business channels are associated with unique identifiers. When sending and receiving messages between business clusters, the unique identifier in the cache is obtained through the business channel encoding. The label carried by the encapsulated business message is this unique identifier, which is filtered through the consumer grouping and label of the message queue and processed by different front-end nodes to achieve correct traffic routing and load balancing.

[0139] This application has achieved at least the following technical effects:

[0140] This application is based on message queues. Under the premise of meeting security requirements, by associating business channels with front-end IP addresses and using message topics and tags for message filtering, it achieves multi-active deployment of front-end clusters and core business clusters, and guarantees traffic load in scenarios with a wide variety of business types. The introduction of message queues also decouples the front-end and core business, improving the flexibility and scalability of the entire system.

[0141] Figure 4 Schematic diagram of the structure of a device in the embodiment of the present application. Figure 4 As shown, the device includes one or more processors (or processing units), may further include one or more memories coupled to the processors, and may further include a communication module coupled to the processors.

[0142] The communication module can be used to communicate with other devices or apparatuses, such as the transmission or reception of data and / or signals. The communication module can have at least one communication module for communication. The communication module can include any interface necessary for communicating with other devices. Exemplarily, the communication module can be a transceiver, a circuit, a bus, a module, or other types of communication modules.

[0143] The processor may include, but is not limited to, at least one of the following: a general-purpose computer, a special-purpose computer, a microcontroller, a digital signal controller (DSP), or one or more of a controller-based multi-core controller architecture. The device may have multiple processors, such as application-specific integrated circuit chips, which are time-dependent and synchronized with a clock of a main processor.

[0144] The memory may include one or more non-volatile memories and one or more volatile memories. Examples of non-volatile memories include, but are not limited to, at least one of the following: read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, hard disk, compact disc (CD), digital video disc (DVD), or other magnetic storage and / or optical storage. Examples of volatile memories include, but are not limited to, at least one of the following: random access memory (RAM), or other volatile memories that do not persist during the duration of a power outage.

[0145] The computer program includes computer executable instructions executed by an associated processor. The program can be stored in ROM. The processor can perform any suitable actions and processes by loading the program into RAM.

[0146] The possible implementation of the present application can be implemented by means of a program, so that the communication device can perform any process discussed in the above embodiments. The possible implementation of the present application can also be implemented by hardware or by a combination of software and hardware.

[0147] In some embodiments, the program may be tangibly contained in a computer-readable storage medium, which may be included in the device (such as in a memory) or other storage device accessible by the device. The program may be loaded from the computer-readable storage medium to the RAM for execution. The computer-readable storage medium may include any type of tangible non-volatile memory, such as ROM, EPROM, flash memory, hard disk, CD, DVD, etc.

[0148] The present application embodiment also provides a computer-readable storage medium, on which computer instructions or program codes are stored, and when the processor runs the instructions or the program codes, the processor executes the methods and functions involved in any of the above embodiments. Computer-readable media can be any tangible medium containing or storing programs for or related to instruction execution systems, devices or equipment. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or devices, or any suitable combination thereof. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrations. More detailed examples of computer-readable storage media include electrical connections with one or more wires, magnetic media (e.g., disks, floppy disks, hard disks, tapes, magnetic storage devices), optical media (e.g., optical storage devices, DVDs), semiconductor media (e.g., solid-state hard drives), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), or any suitable combination thereof, etc.

[0149] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The embodiment of the present application also provides at least one computer program product tangibly stored on a non-temporary computer-readable storage medium. The computer program product includes one or more computer executable instructions, such as instructions included in a program module, which are executed in a device on a real or virtual processor of the target to perform the process, method and function involved in any of the above embodiments. When the computer program instruction is loaded and executed on a computer, a process or function according to an embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.

[0150] The present application embodiment also proposes a computer program product, including a computer program or instruction, when the computer program or instruction is run on a computer, the computer is made to perform the process, method and function in the above-mentioned embodiment. Usually, a program module includes routines, programs, libraries, objects, classes, components, data structures, etc. that perform specific tasks or realize specific abstract data types. In various embodiments, the functions of program modules can be combined or divided between program modules as needed. Machine executable instructions for program modules can be executed in local or distributed devices. In distributed devices, program modules can be located in local and remote storage media.

[0151] In general, various embodiments of the present application may be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software, which may be performed by a controller, microprocessor, or other computing device. Although various aspects of the embodiments of the present disclosure are shown and described as block diagrams, flow charts, or using some other graphical representations, it should be understood that the boxes, devices, systems, techniques, or methods described herein may be implemented as, for example, non-limiting examples, hardware, software, firmware, dedicated circuits or logic, general hardware or controllers or other computing devices, or some combination thereof.

[0152] It should be noted that although the embodiments of the present application are described above in conjunction with the accompanying drawings, the above embodiments are not independent of each other, and they can also be combined to obtain other embodiments. The division of the modes, situations, categories and embodiments in the embodiments of the present application is only for the convenience of description and should not constitute a special limitation. The features in the various modes, categories, situations and embodiments can be combined with each other in a logical manner. The various implementation methods of the present application can be combined arbitrarily to achieve different technical effects. The embodiments of the present application no longer list various combinations.

[0153] In addition, although the operation of the method of the present disclosure is described in a particular order in the accompanying drawings, this does not require or imply that these operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flow chart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution. It should also be noted that the features and functions of two or more devices according to the present disclosure can be embodied in one device. Conversely, the features and functions of a device described above can be further divided into being embodied by multiple devices.

[0154] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0155] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A business processing method, characterized in that: The service processing method is executed by a front-end processor cluster, in which multiple active front-end processor nodes are deployed, and a first consumer and a second consumer based on a message queue are created in each front-end processor node. The service processing method includes: Processing a session connection message of the core service cluster based on the first consumer and establishing a session connection between the core service cluster and a third-party system through a target front-end node, wherein the target front-end node is one of the multi-active front-end nodes; When the session connection is successfully established, a session initialization message is sent through the target front-end node, wherein the session initialization message carries a service channel identifier and an IP address of the target front-end node, so that the service node of the core service cluster caches the service channel identifier and the IP address of the target front-end node; Based on the second consumer receiving the business message of the core business cluster and consuming the business message through the target front-end node, the business message carries a label, and the label is set to the IP address of the target front-end node corresponding to the cached business channel identifier.

2. The service processing method according to claim 1, characterized in that: The processing of the session connection message of the core service cluster based on the first consumer and establishing a session connection between the core service cluster and the third-party system through the target front-end node includes: Receive a session connection message of a core service cluster based on a subscribed connection message topic, wherein the session connection message carries a service channel identifier; In single certificate mode, establishing a communication connection between the front-end node and the third-party system; Determine the target front-end processor node among the multiple active front-end processor nodes based on the load balancing strategy; Based on the communication connection between the target front-end node and the third-party system, the session connection message is forwarded to the third-party system, so that the third-party system performs user identity authentication according to the session connection message.

3. The service processing method according to claim 1, characterized in that: In the case where the session connection is successfully established, sending a session initialization message through the target front-end node includes: Receiving a session connection success message returned by the third-party system; Based on the session connection success message, generate a session initialization message; The session initialization message is sent to a message queue through the target front-end node, so that a service node of a core service cluster that has subscribed to the session initialization message receives the session initialization message.

4. The business processing method according to claim 1, characterized in that: The receiving the service message of the core service cluster based on the second consumer and consuming the service message through the target front-end node includes: Receiving a service message of a core service cluster based on a service message topic subscribed by the second consumer; The target front-end node is determined based on the tag corresponding to the second consumer and the tag carried in the service message, and the service message is consumed through the target front-end node.

5. The service processing method according to any one of claims 1 to 4, characterized in that: The first consumer is created in the following way: Create an implementation class for the first message receiving and processing interface; A first annotation is added to the implementation class of the first message receiving and processing interface, wherein the first annotation is used to establish a corresponding consumer group and subscription connection message topic for each front-end node.

6. The service processing method according to any one of claims 1 to 4, characterized in that: The second consumer is created in the following way: Create an implementation class for the second message receiving and processing interface; A second annotation is added to the implementation class of the second message receiving and processing interface, and the second annotation is used to establish corresponding consumer groups and tags for each front-end node and subscribe to a business message topic, and the business message topic is configured as the service name of the front-end node.

7. The service processing method according to claim 1, characterized in that: The business processing method further includes: When the session connection triggers a termination condition, a session termination message is sent to a message queue, so that a service node of a core service cluster that has subscribed to the session termination message receives the session termination message.

8. A service processing device, characterized in that: The service processing device is applied to a front-end cluster, in which multiple active front-end nodes are deployed, and a first consumer and a second consumer based on a message queue are created in each front-end node. The service processing device includes: A first consumer unit is used to process a session connection message of a core business cluster based on the first consumer and establish a session connection between the core business cluster and a third-party system through a target front-end node, where the target front-end node is one of the multi-active front-end nodes; A first sending unit is used to send a session initialization message through the target front-end node when the session connection is successfully established, wherein the session initialization message carries a service channel identifier and an IP address of the target front-end node, so that the service node of the core service cluster caches the service channel identifier and the IP address of the target front-end node; The second consumption unit is used to receive the business message of the core business cluster based on the second consumer and consume the business message through the target front-end node, the business message carries a label, and the label is set to the IP address of the target front-end node corresponding to the cached business channel identifier.

9. A business system, characterized in that: The business system includes a core business cluster and a front-end cluster, and the front-end cluster is used to execute the business processing method according to any one of claims 1 to 7.

10. The business system according to claim 9, characterized in that: The core service cluster includes multiple service nodes, and the service nodes are further used for: Receiving a session initialization message based on a subscription, wherein the session initialization message carries a service channel identifier and an IP address of a front-end node; The business channel identifier and the IP address of the front-end node are cached accordingly.

11. The business system according to claim 10, characterized in that: The service node is also used for: Receiving a service request and obtaining a service channel identifier according to the service request; Acquire the IP address of the front-end node corresponding to the service channel identifier from the cache according to the service channel identifier; Encapsulating a service message according to the service request and the IP address of the front-end node; The service message is sent to a message queue whose message subject is the service name of the front-end node, and the label of the service message is set to the IP address of the front-end node.

12. A device comprising: processor; and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor executes the business processing method according to any one of claims 1 to 7.

13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the business processing method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Message queue system, service processing method and computer readable storage medium

    CN114338063A

  • Message processing method and device under same-city multi-activity data center

    CN115480929A

  • Edge cluster management method and system based on publish / subscribe message protocol

    CN117135156A

  • Topic subscription provisioning for communication protocol

    US11811884B1

  • Distributed message queue stream verification

    US20170310628A1