Message notification system implementation method and system based on cloud native
By designing a message notification system based on Kubernetes and NATS in the cloud native environment, the alarm notification problem of some applications in the cloud native environment not being connected to the Prometheus monitoring system has been solved. Multiple notification methods and high concurrency capabilities have been implemented, which is suitable for traditional applications. Cloud native migration provides an easy-to-access message notification system.
Patent Information
- Application Number
- CN202410799993.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-06-20
AI Technical Summary
In a cloud-native environment, some applications are not connected to the Prometheus monitoring system and cannot directly use Alertmanager for alarm notification, resulting in the inability to implement real-time message notification functions. Especially for traditional applications that have been migrated to cloud-native, there is a lack of easy-to-access non-Prometheus Ecological message notification system.
Designed a message notification system based on cloud native, using Kubernetes' custom resource definition and ListWatch mechanism, combined with NATS message queue, to implement message reception, preprocessing, routing matching, scheduled notification and retry functions, supporting SMS, email, Instant messaging software and API notification method, modular design, providing HTTP API interface, users can customize tag matching rules to determine templates and receivers, support multiple notification types and receivers, and use the traffic peak-cutting function of NATS to improve high concurrency capabilities .
It provides a simpler application access method, supports multiple notification methods, has good high concurrency capabilities and maintainability, simplifies the program architecture, and is suitable for applications that are not connected to the Prometheus monitoring system and can be implemented with only a few modifications. Alarm notification function.
Smart Images

Figure CN118694731A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud native technology, and specifically to a method and system for implementing a cloud native-based message notification system. Background Art
[0002] In a cloud-native environment, a large number of microservice applications are often running. The calling relationships between applications are complex, and one function may involve multiple applications. In order to fully understand the running status of the application and locate the abnormality of the application in a timely and accurate manner, it is necessary to build a complete and reliable observability system. In order to know the abnormal status of the application in a timely manner, the observability system needs to support the alarm notification function. When the alarm rule is triggered, real-time notification is provided through SMS, email, etc.
[0003] Currently, in the cloud native field, the most commonly used alarm notification component is Alertmanager, which supports functions such as alarm grouping, suppression, and silencing, and supports multiple notification methods. In actual use, Alertmanager is usually used in conjunction with Prometheus; Prometheus collects monitoring indicators and sets a series of alarm rules. When the indicator data triggers the alarm rule, Alertmanager is called to send a notification.
[0004] However, not all programs running in cloud-native environments are connected to the Prometheus monitoring system. Some applications have their own monitoring and alarm modules and cannot directly use Alertmanager for alarm notifications. This is very common for some applications that have migrated from traditional architectures to cloud-native environments. Therefore, a non-Prometheus ecological message notification system is needed to facilitate notification access for applications with their own alarm modules. Summary of the invention
[0005] The purpose of the present invention is to provide a cloud-native based message notification system implementation method and system to solve the problems raised in the above background technology.
[0006] To achieve the above object, the present invention provides the following technical solution: a method for implementing a cloud-native message notification system, the method comprising the following steps:
[0007] It carries out message reception, preprocessing, route matching, timed notification, and retry functions with modular design; it supports SMS, email, instant messaging software, and API calls;
[0008] Using cloud-native features, including Kubernetes' custom resource definition mechanism and ListWatch mechanism, makes program rule configuration more flexible and efficient, and can perceive changes in configuration data in real time;
[0009] Use multiple interrelated NATS message queues to decouple the system modules, allowing each module to perform asynchronous processing and improve the system's high concurrency capabilities;
[0010] By utilizing the traffic peak shaving function of the NATS message queue and providing good support for horizontal expansion, the system has good high concurrency capabilities.
[0011] Preferably, when receiving a message, an HTTP API is provided to receive notification requests from user programs. In addition to the notification content, the request also includes user-defined tags. The template, notification type, and receiver used by the message are determined based on a series of tag matching rules pre-configured by the user. The receiver is a specific notification target configured by the user in the message notification system, such as a mobile phone number, an email recipient, an instant messaging software group chat robot, or an external API interface.
[0012] Message preprocessing: preprocessing messages, including template variable replacement, message splitting, and keyword filtering;
[0013] Route matching: if the message is of the instant notification type, the tag is read and the message is routed to the corresponding receiver program, such as SMS or email, according to the route matching rules configured by the user. The route matching rules support sending one message to multiple receivers. If the message is of the scheduled notification type, the message is sent to the scheduled notification module.
[0014] Scheduled notification: Process messages that require scheduled notification, read tags, and generate instant notification messages based on the user-configured timing rules and send them to the routing matching module;
[0015] Retry: When the notification sending program fails to send, the retry module will temporarily store these messages. After a certain retry waiting time, it will generate an instant notification message and send it to the route matching module. The user needs to set the maximum number of retries.
[0016] Preferably, the specific operations of the NATS message queue are as follows:
[0017] Preprocessing queue: The producer of the queue is the message receiving module, and the consumer is the preprocessing module;
[0018] Route matching queue: The producers of the queue are the pre-processing module, the timed notification module, and the retry module, and the consumer is the route matching module;
[0019] Instant notification queue: The producer of the queue is the routing matching module, and the consumer is the sending module of the notification sending program. Each notification method has an instant notification queue, which is monitored by the respective notification sending program.
[0020] Scheduled notification queue: The producer of the queue is the routing matching module, and the consumer is the scheduled notification module;
[0021] Retry queue: The producer of the queue is the sending module of the notification sending program, and the consumer is the retry module.
[0022] Preferably, it also includes message flow, specifically:
[0023] a) When the user's program triggers an alarm, the notification management program HTTP API is called to send the notification content;
[0024] b) After receiving the message, the receiving module of the notification management program directly sends the message to the pre-processing queue of NATS;
[0025] c) The preprocessing module monitors the preprocessing queue of NATS, performs preprocessing after receiving the message, and then sends the message to the routing matching queue of NATS;
[0026] d) The route matching module monitors the NATS route matching queue. After receiving the message, it checks the label in the message. If the message type is an immediate notification, it is sent to the corresponding NATS immediate notification queue according to the route matching rules. If the type is a scheduled notification, it is sent to the NATS scheduled notification queue.
[0027] e) The sending module of the notification sending program listens to the NATS instant notification queue of the notification type, and sends the message after receiving it. If the sending fails, a retry message is generated and sent to the NATS retry queue;
[0028] f) The retry module monitors the NATS retry queue. After receiving the message, it counts according to the retry rules. After the timing ends, it generates an instant notification message and sends it to the NATS route matching queue, and continues to step d);
[0029] g) For the timing module, it monitors the NATS timing queue. After receiving the message, it generates an instant notification message according to the timing rules configured by the user and sends it to the NATS routing matching queue, and continues to step d).
[0030] Preferably, data storage is also included, specifically:
[0031] The receivers, rules, and configuration data created by users are all stored in Kubernetes custom resources. The Kubernetes API server monitors the creation, editing, and deletion of resources and updates the cache in memory in real time. Since the data is stored in Kubernetes, in addition to the front-end page provided by the message notification system, operations can also be performed in the cluster through tools such as kubectl.
[0032] For log data such as sending records, choose to store them in a relational database such as MySQL, PostgreSQL, or store them in files, and clean them up regularly at a certain period to avoid continuous growth of data.
[0033] A cloud-native-based message notification system implementation system, the system consists of a message sending and receiving module, a data configuration module, a NATS message queue module, and a NATS message queue application module;
[0034] The message sending and receiving module performs message reception, preprocessing, route matching, timed notification, and retry functions. It has a modular design and supports SMS, email, instant messaging software, and API calls.
[0035] The data configuration module uses cloud-native features, including Kubernetes' custom resource definition mechanism and ListWatch mechanism, to make the program's rule configuration more flexible and efficient, and to perceive changes in configuration data in real time;
[0036] NATS message queue module, which uses multiple interrelated NATS message queues to decouple the system modules, allowing each module to perform asynchronous processing and improve the system's high concurrency capability;
[0037] The NATS message queue application module uses the traffic peak shaving function of the NATS message queue to provide good support for horizontal expansion, giving the system good high concurrency capabilities.
[0038] Preferably, the message sending and receiving module provides HTTP API when receiving messages, and is responsible for receiving notification requests from user programs. In addition to the notification content, the request also includes user-defined tags. According to a series of tag matching rules pre-configured by the user, the template, notification type, and receiver used by the message are determined; the receiver is a specific notification target configured by the user in the message notification system, such as a mobile phone number, an email recipient, an instant messaging software group chat robot, and an external API interface;
[0039] Message preprocessing: preprocessing messages, including template variable replacement, message splitting, and keyword filtering;
[0040] Route matching: if the message is of the instant notification type, the tag is read and the message is routed to the corresponding receiver program, such as SMS or email, according to the route matching rules configured by the user. The route matching rules support sending one message to multiple receivers. If the message is of the scheduled notification type, the message is sent to the scheduled notification module.
[0041] Scheduled notification: Process messages that require scheduled notification, read tags, and generate instant notification messages based on the user-configured timing rules and send them to the routing matching module;
[0042] Retry: When the notification sending program fails to send, the retry module will temporarily store these messages. After a certain retry waiting time, it will generate an instant notification message and send it to the route matching module. The user needs to set the maximum number of retries.
[0043] Preferably, NATS message queue module, pre-processing queue: the producer of the queue is the message receiving module, and the consumer is the pre-processing module;
[0044] Route matching queue: The producers of the queue are the pre-processing module, the timed notification module, and the retry module, and the consumer is the route matching module;
[0045] Instant notification queue: The producer of the queue is the routing matching module, and the consumer is the sending module of the notification sending program. Each notification method has an instant notification queue, which is monitored by the respective notification sending program.
[0046] Scheduled notification queue: The producer of the queue is the routing matching module, and the consumer is the scheduled notification module;
[0047] Retry queue: The producer of the queue is the sending module of the notification sending program, and the consumer is the retry module.
[0048] Preferably, the NATS message queue module further includes:
[0049] a) When the user's program triggers an alarm, the notification management program HTTP API is called to send the notification content;
[0050] b) After receiving the message, the receiving module of the notification management program directly sends the message to the pre-processing queue of NATS;
[0051] c) The preprocessing module monitors the preprocessing queue of NATS, performs preprocessing after receiving the message, and then sends the message to the routing matching queue of NATS;
[0052] d) The route matching module monitors the NATS route matching queue. After receiving the message, it checks the label in the message. If the message type is an immediate notification, it is sent to the corresponding NATS immediate notification queue according to the route matching rules. If the type is a scheduled notification, it is sent to the NATS scheduled notification queue.
[0053] e) The sending module of the notification sending program listens to the NATS instant notification queue of the notification type, and sends the message after receiving it. If the sending fails, a retry message is generated and sent to the NATS retry queue;
[0054] f) The retry module monitors the NATS retry queue. After receiving the message, it counts according to the retry rules. After the timing ends, it generates an instant notification message and sends it to the NATS route matching queue, and continues to step d);
[0055] g) For the timing module, it monitors the NATS timing queue. After receiving the message, it generates an instant notification message according to the timing rules configured by the user and sends it to the NATS route matching queue, and continues to step d).
[0056] Preferably, in the NATS message queue module, the receivers, rules, and configuration data created by the user are stored in Kubernetes custom resources. The Kubernetes API server monitors the creation, editing, and deletion of resources, and updates the cache in memory in real time. Since the data is stored in Kubernetes, in addition to the front-end page provided by the message notification system, operations are also performed in the cluster through tools such as kubectl.
[0057] For log data such as sending records, choose to store them in a relational database such as MySQL, PostgreSQL, or store them in files, and clean them up regularly at a certain period to avoid continuous growth of data.
[0058] Compared with the prior art, the present invention has the following beneficial effects:
[0059] The cloud-native-based message notification system implementation method and system proposed in the present invention provide a simpler application access method, support multiple notification methods, and can also perform well in high-concurrency scenarios. It uses cloud-native features and relies on NATS message queues to simplify the program architecture and provide good maintainability and scalability. For applications that are not connected to the Prometheus monitoring system and have self-developed monitoring and alarm modules, only a few modifications are required to connect to the system and provide the application with the ability to provide alarm notifications. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 The figure is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0061] In order to make the purpose and technical solution of the present invention clearly and completely described, and the advantages more clearly understood, the embodiments of the present invention are further described in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are part of the embodiments of the present invention, rather than all of the embodiments, and are only used to explain the embodiments of the present invention, and are not used to limit the embodiments of the present invention. All other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0062] Embodiment 1
[0063] See also Figure 1 The present invention provides a technical solution: a method for implementing a cloud-native message notification system, the method comprising the following steps:
[0064] 1) Development language
[0065] Go is selected as the development language. Go has the characteristics of high development efficiency, fast compilation speed, and support for high concurrency. Many cloud-native infrastructures and middleware use Go as the development language.
[0066] 2) Operating environment
[0067] Cloud native environment.
[0068] 3) Cloud native features used
[0069] The message notification system needs to rely on some cloud-native features to simplify the implementation process and improve the robustness of the program.
[0070] a) Custom Resource Definition. Kubernetes, the core component of cloud native, provides a custom resource definition mechanism and opens up the resource management capabilities of the Kubernetes API server. This allows user-defined resources to be managed in the same way as the resources provided by Kubernetes.
[0071] b) List Watch mechanism. The Kubernetes API server provides a List Watch mechanism that relies on HTTP persistent connections to monitor events related to specified resources in real time. When resources are created, modified, or deleted, the listener can receive and process events in a timely manner. The client-go library provided by Kubernetes provides the List Watch code.
[0072] 4) Dependent components
[0073] NATS. The core component of the message notification system is the NATS message queue, which is an open source, lightweight, high-performance distributed message middleware that implements multiple message delivery models. It can improve the application decoupling, asynchronous messaging, and traffic peak shaving functions of the message notification system, providing a guarantee for the high concurrency of the system.
[0074] 5) Overall architecture
[0075] The message notification system is divided into two parts: notification management program and notification sending program.
[0076] a) Notify Manager: Responsible for message reception, preprocessing, route matching, timed notification, retry, etc. It has a modular design and each module is only responsible for its own function.
[0077] b) Notify Sender: responsible for message notifications, supporting SMS, email, instant messaging software, API calls, etc. Different notification methods are handled by different programs and run separately to carry out targeted horizontal expansion according to actual conditions.
[0078] 6) Module division
[0079] Notification Manager:
[0080] a) Message receiving module: Provides HTTP API and is responsible for receiving notification requests from user programs. In addition to the notification content, the request also includes a series of user-defined tags. Other modules will determine the template, notification type (instant notification, scheduled notification, etc.), receiver, etc. used by the message based on a series of tag matching rules pre-configured by the user. The receiver is the specific notification target configured by the user in the message notification system, such as mobile phone number, email recipient, instant messaging software group chat robot, and external API interface.
[0081] b) Preprocessing module: preprocess the message, including template variable replacement, message splitting, keyword filtering, etc.
[0082] i. Template variable replacement: The template is the notification content predefined by the user in the message notification system. Variables can be defined in the template. When the user's program triggers an alarm, the variable value is sent to the message notification system, and then the preprocessing module reads the template and replaces the variable value.
[0083] ii. Message splitting: If the message content is too long, the user can configure the message splitting function as needed to split the message into multiple sub-messages, and each sub-message is sent independently.
[0084] iii. Keyword filtering: Users can configure keywords as needed. Whitelist and blacklist modes are supported. Keyword matching is performed on notification content to determine whether the message should be sent.
[0085] c) Routing matching module: If the message is of the instant notification type, the tag is read and the message is routed to the corresponding receiver program, such as SMS, email, etc., according to the routing matching rules configured by the user. The routing matching rules support sending a message to multiple receivers. If the message is of the scheduled notification type, the message is sent to the scheduled notification module.
[0086] d) Scheduled notification module: This module processes messages that require scheduled notification, reads tags, and generates instant notification messages based on the user-configured timing rules and sends them to the routing matching module.
[0087] e) Retry module: When the notification sending program fails to send, the retry module will temporarily store these messages. After a certain retry waiting time, it will generate an instant notification message and send it to the route matching module. The user needs to set the maximum number of retries.
[0088] Notification sending procedure:
[0089] a) Sending module: responsible for sending messages to corresponding receivers, such as SMS, email, instant messaging software, calling API, etc. Each notification method is handled by a separate program.
[0090] 7) NATS message queue
[0091] The above modules communicate through NATS queues. The specific NATS queues are as follows:
[0092] a) Preprocessing queue: The producer of the queue is the message receiving module, and the consumer is the preprocessing module.
[0093] b) Route matching queue: The producers of the queue are the preprocessing module, the timing notification module, and the retry module, and the consumer is the route matching module.
[0094] c) Instant notification queue: The producer of the queue is the routing matching module, and the consumer is the sending module of the notification sending program. Each notification method has an instant notification queue, which is monitored by the respective notification sending program.
[0095] d) Scheduled notification queue: The producer of the queue is the routing matching module, and the consumer is the scheduled notification module.
[0096] e) Retry queue: The producer of the queue is the sending module of the notification sending program, and the consumer is the retry module.
[0097] 8) Message Flow Process
[0098] a) When the user's program triggers an alarm, the notification management program HTTP API is called to send the notification content.
[0099] b) After receiving the message, the receiving module of the notification management program directly sends the message to the pre-processing queue of NATS.
[0100] c) The preprocessing module listens to the preprocessing queue of NATS, preprocesses the message after receiving it, and then sends the message to the routing matching queue of NATS.
[0101] d) The route matching module monitors the NATS route matching queue. After receiving the message, it checks the label in the message. If the message type is an immediate notification, it is sent to the corresponding NATS immediate notification queue according to the route matching rules. If the type is a scheduled notification, it is sent to the NATS scheduled notification queue.
[0102] e) The sending module of the notification sending program monitors the NATS instant notification queue of the notification type, and sends the message after receiving it. If the sending fails, a retry message is generated and sent to the NATS retry queue.
[0103] f) The retry module monitors the NATS retry queue. After receiving the message, it counts according to the retry rules. After the timing ends, it generates an instant notification message and sends it to the NATS route matching queue, and continues to step d).
[0104] g) For the timing module, it monitors the NATS timing queue. After receiving the message, it generates an instant notification message according to the timing rules configured by the user and sends it to the NATS routing matching queue, and continues to step d).
[0105] 9) Data Storage
[0106] a) Configuration data such as receivers and rules (including notification type rules, template matching rules, route matching rules, timing rules, retry rules, etc.) created by users are all stored in Kubernetes custom resources. Modules that need to use this data listen to the creation, editing, and deletion of resources through the Kubernetes API server and update the cache in memory in real time. Since this data is stored in Kubernetes, in addition to the front-end page provided by the message notification system, it can also be operated in the cluster through tools such as kubectl.
[0107] b) For log data such as sending records, you can choose to store them in a relational database, such as MySQL, PostgreSQL database, or store them in a file and clean them up regularly at a certain period to avoid continuous growth of data.
[0108] Embodiment 2
[0109] Based on the first embodiment, a cloud-native-based message notification system implementation system is proposed, which consists of a message sending and receiving module, a data configuration module, a NATS message queue module, and a NATS message queue application module;
[0110] The message sending and receiving module performs message reception, preprocessing, route matching, timed notification, and retry functions with modular design; it supports SMS, email, instant messaging software, and API calling methods; when receiving messages, it provides HTTPAPI and is responsible for receiving notification requests from user programs. In addition to the notification content, the request also includes user-defined tags. According to a series of tag matching rules pre-configured by the user, the template, notification type, and receiver used by the message are determined; the receiver is the specific notification target configured by the user in the message notification system, such as mobile phone number, email recipient, instant messaging software group chat robot, and external API interface;
[0111] Message preprocessing: preprocessing messages, including template variable replacement, message splitting, and keyword filtering;
[0112] Route matching: if the message is of the instant notification type, the tag is read and the message is routed to the corresponding receiver program, such as SMS or email, according to the route matching rules configured by the user. The route matching rules support sending one message to multiple receivers. If the message is of the scheduled notification type, the message is sent to the scheduled notification module.
[0113] Scheduled notification: Process messages that require scheduled notification, read tags, and generate instant notification messages based on the user-configured timing rules and send them to the routing matching module;
[0114] Retry: When the notification sending program fails to send, the retry module will temporarily store these messages. After a certain retry waiting time, it will generate an instant notification message and send it to the route matching module. The user needs to set the maximum number of retries.
[0115] The data configuration module uses cloud-native features, including Kubernetes' custom resource definition mechanism and ListWatch mechanism, to make the program's rule configuration more flexible and efficient, and to perceive changes in configuration data in real time;
[0116] NATS message queue module uses multiple interrelated NATS message queues to decouple the system modules, allowing each module to perform asynchronous processing and improve the system's high concurrency capability; preprocessing queue: the producer of the queue is the message receiving module, and the consumer is the preprocessing module;
[0117] Route matching queue: The producers of the queue are the pre-processing module, the timed notification module, and the retry module, and the consumer is the route matching module;
[0118] Instant notification queue: The producer of the queue is the routing matching module, and the consumer is the sending module of the notification sending program. Each notification method has an instant notification queue, which is monitored by the respective notification sending program.
[0119] Scheduled notification queue: The producer of the queue is the routing matching module, and the consumer is the scheduled notification module;
[0120] Retry queue: The producer of the queue is the sending module of the notification sending program, and the consumer is the retry module.
[0121] The NATS message queue module also includes:
[0122] a) When the user's program triggers an alarm, the notification management program HTTP API is called to send the notification content;
[0123] b) After receiving the message, the receiving module of the notification management program directly sends the message to the pre-processing queue of NATS;
[0124] c) The preprocessing module monitors the preprocessing queue of NATS, performs preprocessing after receiving the message, and then sends the message to the routing matching queue of NATS;
[0125] d) The route matching module monitors the NATS route matching queue. After receiving the message, it checks the label in the message. If the message type is an immediate notification, it is sent to the corresponding NATS immediate notification queue according to the route matching rules. If the type is a scheduled notification, it is sent to the NATS scheduled notification queue.
[0126] e) The sending module of the notification sending program listens to the NATS instant notification queue of the notification type, and sends the message after receiving it. If the sending fails, a retry message is generated and sent to the NATS retry queue;
[0127] f) The retry module monitors the NATS retry queue. After receiving the message, it counts according to the retry rules. After the timing ends, it generates an instant notification message and sends it to the NATS route matching queue, and continues to step d);
[0128] g) For the timing module, it monitors the NATS timing queue. After receiving the message, it generates an instant notification message according to the timing rules configured by the user and sends it to the NATS route matching queue, and continues to step d).
[0129] NATS message queue module: The receivers, rules, and configuration data created by users are all stored in Kubernetes custom resources. The Kubernetes API server monitors the creation, editing, and deletion of resources, and updates the cache in memory in real time. Since the data is stored in Kubernetes, in addition to the front-end page provided by the message notification system, operations can also be performed in the cluster through tools such as kubectl.
[0130] For log data such as sending records, choose to store them in a relational database such as MySQL, PostgreSQL, or store them in files, and clean them up regularly at a certain period to avoid continuous growth of data.
[0131] The NATS message queue application module uses the traffic peak shaving function of the NATS message queue to provide good support for horizontal expansion, giving the system good high concurrency capabilities.
[0132] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for implementing a cloud-native message notification system. Features: The method comprises the following steps: It carries out message reception, preprocessing, route matching, timed notification, and retry functions with modular design; it supports SMS, email, instant messaging software, and API calls; Using cloud-native features, including Kubernetes' custom resource definition mechanism and ListWatch mechanism, makes program rule configuration more flexible and efficient, and can perceive changes in configuration data in real time; Use multiple interrelated NATS message queues to decouple the system modules, allowing each module to perform asynchronous processing and improve the system's high concurrency capabilities; By utilizing the traffic peak shaving function of the NATS message queue and providing good support for horizontal expansion, the system has good high concurrency capabilities.
2. According to claim 1, a method for implementing a cloud-native message notification system, Features: When receiving messages, HTTP API is provided to receive notification requests from user programs. In addition to notification content, the request also includes user-defined tags. Based on a series of tag matching rules pre-configured by the user, the template, notification type, and receiver used by the message are determined; the receiver is the specific notification target configured by the user in the message notification system, such as mobile phone number, email recipient, instant messaging software group chat robot, and external API interface; Message preprocessing: preprocessing messages, including template variable replacement, message splitting, and keyword filtering; Route matching: If the message is of the instant notification type, the tag is read and the message is routed to the corresponding receiver program, such as SMS or email, according to the route matching rules configured by the user; The routing matching rules support sending a message to multiple receivers. If the message is of the scheduled notification type, the message is sent to the scheduled notification module; Scheduled notification: Process messages that require scheduled notification, read tags, and generate instant notification messages based on the user-configured timing rules and send them to the routing matching module; Retry: When the notification sending program fails to send, the retry module will temporarily store these messages. After a certain retry waiting time, it will generate an instant notification message and send it to the route matching module. The user needs to set the maximum number of retries.
3. According to claim 1, a method for implementing a cloud-native message notification system, Features: The specific operations of NATS message queue are as follows: Preprocessing queue: The producer of the queue is the message receiving module, and the consumer is the preprocessing module; Route matching queue: The producers of the queue are the pre-processing module, the timed notification module, and the retry module, and the consumer is the route matching module; Instant notification queue: The producer of the queue is the routing matching module, and the consumer is the sending module of the notification sending program. Each notification method has an instant notification queue, which is monitored by the respective notification sending program. Scheduled notification queue: The producer of the queue is the routing matching module, and the consumer is the scheduled notification module; Retry queue: The producer of the queue is the sending module of the notification sending program, and the consumer is the retry module.
4. According to claim 3, a method for implementing a cloud-native message notification system, Features: It also includes message flow, specifically: a) When the user's program triggers an alarm, the notification management program HTTP API is called to send the notification content; b) After receiving the message, the receiving module of the notification management program directly sends the message to the pre-processing queue of NATS; c) The preprocessing module monitors the preprocessing queue of NATS, performs preprocessing after receiving the message, and then sends the message to the routing matching queue of NATS; d) The route matching module monitors the NATS route matching queue. After receiving the message, it checks the label in the message. If the message type is an immediate notification, it is sent to the corresponding NATS immediate notification queue according to the route matching rules. If the type is a scheduled notification, it is sent to the NATS scheduled notification queue. e) The sending module of the notification sending program monitors the NATS instant notification queue of the notification type, and sends the message after receiving it; if the sending fails, a retry message is generated and sent to the NATS retry queue; f) The retry module monitors the NATS retry queue. After receiving the message, it counts according to the retry rules. After the timing ends, it generates an instant notification message and sends it to the NATS route matching queue, and continues to step d); g) For the timing module, it monitors the NATS timing queue. After receiving the message, it generates an instant notification message according to the timing rules configured by the user and sends it to the NATS routing matching queue, and continues to step d).
5. According to claim 4, a method for implementing a cloud-native message notification system, Features: It also includes data storage, specifically: The receivers, rules, and configuration data created by users are all stored in Kubernetes custom resources. The Kubernetes API server monitors the creation, editing, and deletion of resources and updates the cache in memory in real time. Since the data is stored in Kubernetes, in addition to the front-end page provided by the message notification system, operations can also be performed in the cluster through tools such as kubectl. For log data such as sending records, choose to store them in a relational database such as MySQL, PostgreSQL, or store them in files, and clean them up regularly at a certain period to avoid continuous growth of data.
6. A cloud-native message notification system implementation system according to the cloud-native message notification system implementation method according to any one of claims 1 to 5, Features: The system consists of a message sending and receiving module, a data configuration module, a NATS message queue module and a NATS message queue application module; The message sending and receiving module performs message reception, preprocessing, route matching, timed notification, and retry functions. It has a modular design and supports SMS, email, instant messaging software, and API calls. The data configuration module uses cloud-native features, including Kubernetes' custom resource definition mechanism and ListWatch mechanism, to make the program's rule configuration more flexible and efficient, and to perceive changes in configuration data in real time; NATS message queue module, which uses multiple interrelated NATS message queues to decouple the system modules, allowing each module to perform asynchronous processing and improve the system's high concurrency capability; The NATS message queue application module uses the traffic peak shaving function of the NATS message queue to provide good support for horizontal expansion, giving the system good high concurrency capabilities.
7. A cloud-native based message notification system implementation system according to claim 6, Features: The message sending and receiving module provides HTTP API when receiving messages. It is responsible for receiving notification requests from user programs. In addition to the notification content, the request also includes user-defined tags. According to a series of tag matching rules pre-configured by the user, the template, notification type, and receiver used by the message are determined. The receiver is the specific notification target configured by the user in the message notification system, such as mobile phone number, email recipient, instant messaging software group chat robot, and external API interface. Message preprocessing: preprocessing messages, including template variable replacement, message splitting, and keyword filtering; Route matching: If the message is of the instant notification type, the tag is read and the message is routed to the corresponding receiver program, such as SMS or email, according to the route matching rules configured by the user; The routing matching rules support sending a message to multiple receivers. If the message is of the scheduled notification type, the message is sent to the scheduled notification module; Scheduled notification: Process messages that require scheduled notification, read tags, and generate instant notification messages based on the user-configured timing rules and send them to the routing matching module; Retry: When the notification sending program fails to send, the retry module will temporarily store these messages. After a certain retry waiting time, it will generate an instant notification message and send it to the route matching module. The user needs to set the maximum number of retries.
8. According to claim 6, a cloud-native based message notification system implementation system, Features: NATS message queue module, preprocessing queue: the producer of the queue is the message receiving module, and the consumer is the preprocessing module; Route matching queue: The producers of the queue are the pre-processing module, the timed notification module, and the retry module, and the consumer is the route matching module; Instant notification queue: The producer of the queue is the routing matching module, and the consumer is the sending module of the notification sending program. Each notification method has an instant notification queue, which is monitored by the respective notification sending program. Scheduled notification queue: The producer of the queue is the routing matching module, and the consumer is the scheduled notification module; Retry queue: The producer of the queue is the sending module of the notification sending program, and the consumer is the retry module.
9. A cloud-native based message notification system implementation system according to claim 8, Features: The NATS message queue module also includes: a) When the user's program triggers an alarm, the notification management program HTTP API is called to send the notification content; b) After receiving the message, the receiving module of the notification management program directly sends the message to the pre-processing queue of NATS; c) The preprocessing module monitors the preprocessing queue of NATS, performs preprocessing after receiving the message, and then sends the message to the routing matching queue of NATS; d) The route matching module monitors the NATS route matching queue. After receiving the message, it checks the label in the message. If the message type is an immediate notification, it is sent to the corresponding NATS immediate notification queue according to the route matching rules. If the type is a scheduled notification, it is sent to the NATS scheduled notification queue. e) The sending module of the notification sending program monitors the NATS instant notification queue of the notification type, and sends the message after receiving it; if the sending fails, a retry message is generated and sent to the NATS retry queue; f) The retry module monitors the NATS retry queue. After receiving the message, it counts according to the retry rules. After the timing ends, it generates an instant notification message and sends it to the NATS route matching queue, and continues to step d); g) For the timing module, it monitors the NATS timing queue. After receiving the message, it generates an instant notification message according to the timing rules configured by the user and sends it to the NATS routing matching queue, and continues to step d).
10. A cloud-native based message notification system implementation system according to claim 9, Features: NATS message queue module: The receivers, rules, and configuration data created by users are all stored in Kubernetes custom resources. The Kubernetes API server monitors the creation, editing, and deletion of resources, and updates the cache in memory in real time. Since the data is stored in Kubernetes, in addition to the front-end page provided by the message notification system, operations can also be performed in the cluster through tools such as kubectl. For log data such as sending records, choose to store them in a relational database such as MySQL, PostgreSQL, or store them in files, and clean them up regularly at a certain period to avoid continuous growth of data.
Citation Information
Patent Citations
Workflow processing method and device
CN117742904A
Elastic distributed message queue implementation method based on kubernetes
CN117827485A
Programmatic omnichannel orchestration in large-scale messaging systems
EP4333402A1
System and method for a web scraping tool
US20240007537A1
