A Multi-Channel Message Push Method and System Based on Microservices

Through multi-channel message push methods and systems based on microservices, multiple message push channels are aggregated and consistent interfaces are provided, which solves the problem of repeated development when connecting information systems, and achieves a simplified message push process and a more convenient calling method.

CN116527751BActive Publication Date: 2024-09-13北京网梯科技发展有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310300382.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-24
Publication Date
2024-09-13
Estimated Expiration
2043-03-24

AI Technical Summary

Technical Problem

In the existing technology, message push channels are diversified, not centralized, and not unified, which leads to the problem of repeated development when different information systems are connected to the same message push channel.

Method used

Adopt a multi-channel message push method and system based on microservices, aggregate multiple message push channels into one service through a unified scheduling and configuration center, provide consistent interfaces, avoid repeated development, and realize message delivery through message queues and security services Verify, generate and send.

Benefits of technology

It enables different information systems to have the ability to push multiple message push channels through separate docking with the message push service. It simplifies the docking method, avoids repeated development problems, and provides a consistent interface and a more convenient calling method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116527751B
    Figure CN116527751B
Patent Text Reader

Abstract

The present invention provides a multi-channel message push method and system based on microservices, which are applied to the field of message push technology. The system includes a unified scheduling and configuration center, and business services and security services are registered to the unified scheduling and configuration center. The business services at least include a message push service, and the message push service is a service that aggregates multiple message push channels. The method includes: after calling the message push service, verifying whether the message parameters uploaded by the caller are correct; if the verification passes, generating a target message according to the message parameters, and pushing the target message to the message queue, and determining the target message push channel according to the message parameters; sending the target message to the target message push channel, and using the target message push channel to send the target message. Different information systems can be connected to the message push service, and each information system that achieves the connection can have the push capability of multiple message push channels.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of message push, and in particular to a multi-channel message push method and system based on microservices. Background Art

[0002] As educational enterprises undergo digital transformation and upgrade and accelerate their development, various information systems are also being enhanced and expanded, and the demand for the types and quality of services is also increasing. Message push is a relatively important function required in various businesses, which can be applied to scenarios such as sending course marketing, message reminders, and security verification to students.

[0003] Message push channels are diverse, non-centralized, and non-unified. Different information systems also need to be independently developed when they are connected to the same message push channel, which leads to the problem of repeated development. For example, training system A independently connects to the SMS sending of message push channel a, and training system B independently connects to the SMS sending of message push channel b. If training system A wants to add a SMS sending channel for message push channel b, and training system B wants to add a SMS sending channel for message push channel a, training system A needs to be connected to message push channel b once, and training system B needs to be connected to message push channel a once, that is, as long as the information system needs to add a new message push channel, it needs to be connected once. In this case, there is a problem of repeated development when expanding message push channels. Summary of the invention

[0004] The present invention provides a multi-channel message push method and system based on microservices, which is used to solve the problem of diversified, non-centralized and non-unified message push channels in the prior art, and the repeated development problem when different information systems are connected to the same message push channel. The technical solution is as follows:

[0005] In a first aspect, an embodiment of the present invention provides a microservice-based multi-channel message push method, which is applied to a microservice-based multi-channel message push system, wherein the microservice-based multi-channel message push system includes a unified scheduling and configuration center, business services and security services are registered with the unified scheduling and configuration center, and the business service includes at least a message push service, which is a service aggregated from multiple message push channels; the microservice-based multi-channel message push method includes:

[0006] After calling the message push service, verify whether the message parameters uploaded by the caller are correct;

[0007] If the verification is passed, a target message is generated according to the message parameters, the target message is pushed to a message queue, and a target message push channel is determined according to the message parameters;

[0008] The target message is sent to the target message push channel, and the target message is sent by using the target message push channel.

[0009] Optionally, before calling the message push service, the microservice-based multi-channel message push method further includes:

[0010] The information system calls the interface from the front-end platform to send the microservice request to the server;

[0011] The server forwards the microservice request to the gateway;

[0012] The gateway forwards the microservice request to the security service;

[0013] The security service authenticates and authorizes the caller that sends the microservice request according to the microservice request.

[0014] Optionally, the microservice-based multi-channel message push system further includes a customer management module, and the microservice-based multi-channel message push method further includes:

[0015] Enter the message push channel configuration function through the customer management module;

[0016] Complete the configuration of the message push channel according to the message push channel configuration information uploaded by the user;

[0017] Save the configuration information.

[0018] Optionally, the unified scheduling and configuration center is a dynamic naming and configuration service nacos platform.

[0019] Optionally, the multiple message push channels include at least two of the following:

[0020] APP push, email, public account push, and SMS.

[0021] Optionally, the server is an Nginx server.

[0022] Optionally, the microservice-based multi-channel message push method further includes:

[0023] The result of the target message push channel sending the target message is obtained, and all sending behavior information is recorded, wherein the sending behavior information at least includes: sending time, message parameters, sending content, sending result, and failure reason.

[0024] In a second aspect, an embodiment of the present invention provides a multi-channel message push system based on microservices, including a unified scheduling and configuration center, business services and security services are registered to the unified scheduling and configuration center, the business service includes at least a message push service, and the message push service is a service aggregated by multiple message push channels; the multi-channel message push system based on microservices also includes:

[0025] A verification module, used to verify whether the message parameters uploaded by the caller are correct after calling the message push service;

[0026] A processing module, configured to generate a target message according to the message parameters after verification, push the target message to a message queue, and determine a target message push channel according to the message parameters;

[0027] The calling module is used to call the target message push channel to send the target message.

[0028] Optionally, the microservice-based multi-channel message push system further includes a customer management module;

[0029] The customer management module is used to enter the message push channel configuration function through the customer management module, complete the configuration of the message push channel according to the message push channel configuration information uploaded by the user, and save the configuration information.

[0030] Optionally, the unified scheduling and configuration center is a dynamic naming and configuration service nacos platform.

[0031] The beneficial effects of the above technical solution of the present invention are:

[0032] In the multi-channel message push method and system based on microservices provided in the embodiment of the present invention, the multi-channel message push system based on microservices includes a unified scheduling and configuration center, business services and security services have been registered to the unified scheduling and configuration center, the business services at least include a message push service, and the message push service is a service aggregated by multiple message push channels. In actual application, after calling the message push service, first check whether the message parameters uploaded by the caller are correct; if the check passes, generate the target message according to the message parameters, and push the target message to the message queue, and determine the target message push channel according to the message parameters; finally, send the target message to the target message push channel, and use the target message push channel to realize the sending of the target message. In the present invention, different information systems can be connected with the message push service respectively, because the message push service is a service aggregated by multiple message push channels, so each information system connected with the message push service can have the push capability of multiple message push channels, avoiding the problem of non-centralization and non-unification of the traditional message push channel development model, and repeated development. Furthermore, the present invention provides a consistent interface for different information systems. Compared with the prior art which requires separate connection with different message push channels, the connection method of the present invention is simpler and more convenient to call. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A flowchart of a multi-channel message push method based on microservices disclosed in an embodiment of the present invention;

[0034] Figure 2 A flowchart of another multi-channel message push method based on microservices disclosed in an embodiment of the present invention;

[0035] Figure 3 The present invention discloses a multi-channel message push system based on microservices. DETAILED DESCRIPTION

[0036] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help fully understand the embodiments of the present invention. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. In addition, for clarity and brevity, the description of known functions and structures is omitted.

[0037] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0038] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0039] The present invention adopts microservice technology to split various services (such as face recognition service, Aurora authentication service, aggregated payment service, message push service, etc.) into multiple independent projects. Each project completes a part of the business function, and then develops and deploys independently. These independent projects become a microservice, and then constitute a service cluster. Message push service is one of the microservices. The present invention is based on the background of microservices, combined with message queues, access to third-party message push channels such as Alibaba Cloud, Tencent Cloud, Ucloud, and Aurora Push, and integrates multiple channels such as SMS sending, public account messages, emails, APP push, and unified message push solutions. The interfaces provided by the present invention to different information systems are consistent, and multiple message push channels are aggregated into a message push service.

[0040] Before implementing the multi-channel message push method based on microservices provided in the embodiment of the present invention, the present invention first needs to build a basic microservice framework: define the message push service and register it to the unified scheduling and configuration center of the microservice framework. The unified scheduling and configuration center in the embodiment of the present invention is a registration center and configuration center for unified scheduling of services, and is the infrastructure for building a modern application microservice architecture centered on "services". Optionally, the unified scheduling and configuration center in the embodiment of the present invention is a nacos (Dynamic Naming and Configuration Service) platform, which is a dynamic service discovery, configuration management and service management platform that is easy to build cloud-native applications. The business services and security services in the embodiment of the present invention have been registered with the unified scheduling and configuration center.

[0041] The business service at least includes a message push service, which is a service that aggregates multiple message push channels.

[0042] Further, the embodiment of the present invention defines a message push channel of a message push service. A message push channel refers to a communication medium between a client application and a queue manager for sending and / or receiving messages. The message push channels supported by the embodiment of the present invention include at least two of the following: APP push, email, public account (such as WeChat public account) push, and SMS. The embodiment of the present invention aggregates multiple message push channels into a message push service in advance, and the message push service can be connected to different information systems.

[0043] like Figure 1 As shown, an embodiment of the present invention provides a multi-channel message push method based on microservices, which is applied to a multi-channel message push system based on microservices. The method includes:

[0044] Step 101, after calling the message push service, check whether the message parameters uploaded by the caller are correct. If correct, execute step 102, if not correct, execute step 104.

[0045] Message parameters refer to the necessary parameters for sending a message, including the designated recipient, message content, etc. For example, when sending SMS, message parameters may include template number, signature, recipient's mobile phone number, etc.; when sending email, message parameters may include recipient's email address, email title, attachment content, etc.; when pushing WeChat public accounts, message parameters may include recipient's openid, dataMap in template, template id, account code, etc.; when pushing APP, message parameters may include sending platform, sending target, sending content, etc. Message parameters are used to ensure that the message is successfully sent.

[0046] As an optional implementation scheme of the embodiment of the present invention, the calling method of calling the message push service in the sending phase of the embodiment of the present invention may include:

[0047] (1) SMS sending: Use the NotificationFactory.Sms() method. The caller needs to provide the template number, signature, and recipient's mobile phone number.

[0048] (2) Email sending: Use the NotificationFactory.Email() method. The caller needs to provide the recipient's email address, email title, and attachment content.

[0049] (3) WeChat official account push: Use the NotificationFactory.WxOfficial() method. The caller needs to provide the recipient’s open ID, dataMap in the template, template ID, and account code.

[0050] (4) APP push: Use the NotificationFactory.app() method, and the caller needs to provide the sending platform, sending target, and sending content;

[0051] The message parameters provided by the caller are used to specify the content and object of the message sent.

[0052] The embodiment of the present invention first checks whether the message parameters uploaded by the caller are correct. If not, an error message is returned to indicate that the message sending failed. If correct, step 102 is continued.

[0053] Step 102: Generate a target message according to the message parameters, push the target message to a message queue, and determine a target message pushing channel according to the message parameters.

[0054] Step 103: Send the target message to the target message push channel, and use the target message push channel to send the target message.

[0055] If the message parameters uploaded by the caller are verified, the target message is generated according to the message parameters and pushed to the message queue. Next, the system will process the business logic and determine which message push channel the message belongs to based on the message parameters uploaded by the caller. For example, if the message parameters uploaded by the caller are: SMS template number: SMS_15090987dgfddddd3783, SMS signature: XX company, recipient mobile number 186XXXX3654, it can be determined that the message belongs to the Alibaba Cloud SMS channel. Then the target message is sent to the target message push channel, and the target message push channel is used to complete the sending of this message.

[0056] Step 104, an error message is returned, indicating that the message sending fails.

[0057] The multi-channel message push method based on microservices provided in the embodiment of the present invention is applied to a multi-channel message push system based on microservices (referred to as system). The system includes a unified scheduling and configuration center, business services and security services have been registered to the unified scheduling and configuration center, and the business services at least include a message push service, which is a service aggregated by multiple message push channels. In actual applications, after calling the message push service, first check whether the message parameters uploaded by the caller are correct; if the check passes, generate a target message according to the message parameters, and push the target message to the message queue, and determine the target message push channel according to the message parameters; finally, send the target message to the target message push channel, and use the target message push channel to realize the sending of the target message. In the present invention, different information systems can be connected to the message push service respectively, because the message push service is a service aggregated by multiple message push channels, so each information system connected to the message push service can have the push capability of multiple message push channels, avoiding the problem of non-centralization and non-unification of the traditional message push channel development model, and repeated development. Furthermore, the present invention provides a consistent interface for different information systems. Compared with the prior art which requires separate connection with different message push channels, the connection method of the present invention is simpler and more convenient to call.

[0058] like Figure 2 As shown, in Figure 1 Before step 101 “calling the message push service” of the method shown, the multi-channel message push method based on microservices provided by the embodiment of the present invention further includes:

[0059] Step 201: The information system calls an interface from the front-end platform to send a microservice request to the server.

[0060] In actual applications, after the information system is connected to the message push service, when the user of the information system initiates a microservice request on the information system or the information system automatically triggers a microservice request based on the business, the information system calls the interface from the front-end platform to send the microservice request to the server.

[0061] Step 202: The server forwards the microservice request to the gateway.

[0062] As an optional implementation scheme of the embodiment of the present invention, the server in the embodiment of the present invention is an Nginx server. The Nginx server is used for reverse proxy to achieve load balancing. In practical applications, when the number of visits to a website reaches a certain level, a single server cannot meet the user's request, and a cluster of multiple servers is needed to use Nginx as a reverse proxy. In addition, multiple servers can share the load evenly, and there will be no situation where a server is idle due to a high load downtime of a server.

[0063] Step 203: The gateway forwards the microservice request to the security service.

[0064] Step 204: The security service authenticates and authorizes the caller that sends the microservice request according to the microservice request.

[0065] The security service is a security verification when calling a microservice. The microservice request contains basic user information. In the embodiment of the present invention, the user who sends the microservice request is the information system, and the security service authenticates and authorizes the identity of the information system based on the basic information of the information system. Among them, the basic information of the information system may include the number, secret key, private key, public key, etc. of the information system.

[0066] After the security service completes the authentication and authorization of the information system identity, the information system can call the message push service.

[0067] Further, as an optional implementation of the embodiment of the present invention, the microservice-based multi-channel message push system also includes a customer management module, and the microservice-based multi-channel message push method provided by the embodiment of the present invention may also include:

[0068] Enter the message push channel configuration function through the customer management module;

[0069] Complete the configuration of the message push channel according to the message push channel configuration information uploaded by the user;

[0070] Save the configuration information.

[0071] Among them, the message push channel configuration information uploaded by the user can be the sending email address, official account, SMS service provider and account, Jiguang push account, etc. After completing the configuration of the message push channel and saving the configuration information, the message push channel configuration takes effect.

[0072] Furthermore, as an optional implementation method of an embodiment of the present invention, the microservice-based multi-channel message push method provided by an embodiment of the present invention may also include: obtaining the result of the target message push channel sending the target message, and recording all sending behavior information, wherein the sending behavior information includes at least: sending time, message parameters, sending content, sending results, and failure reasons.

[0073] The embodiment of the present invention provides the ability to save and query message push records. The system tracks the effects of different services and scenarios, obtains the results of sending messages through different message push channels, and records all sending behavior information in the task records and sending records on the management side, including sending time, message parameters, sending content, sending results, failure reasons, etc., which can be tracked and queried by users.

[0074] Based on the multi-channel message push method based on microservices provided in the embodiment of the present invention, the embodiment of the present invention further provides a multi-channel message push system based on microservices, including a unified scheduling and configuration center, business services and security services are registered to the unified scheduling and configuration center, the business service at least includes a message push service, and the message push service is a service aggregated by multiple message push channels; the multi-channel message push system based on microservices also includes, Figure 3 As shown:

[0075] The verification module 100 is used to verify whether the message parameters uploaded by the caller are correct after calling the message push service;

[0076] The processing module 200 is used to generate a target message according to the message parameters after the verification is passed, push the target message to the message queue, and determine the target message push channel according to the message parameters;

[0077] The calling module 300 is used to call the target message push channel to send the target message.

[0078] As an optional implementation of the embodiment of the present invention, the microservice-based multi-channel message push system provided by the embodiment of the present invention further includes a customer management module;

[0079] The customer management module is used to enter the message push channel configuration function through the customer management module, complete the configuration of the message push channel according to the message push channel configuration information uploaded by the user, and save the configuration information.

[0080] As an optional implementation method of an embodiment of the present invention, the microservice-based multi-channel message push system provided by the embodiment of the present invention also includes a record saving module, which is used to obtain the result of the target message push channel sending the target message, and record all sending behavior information, and the sending behavior information includes at least: sending time, message parameters, sending content, sending results, and failure reasons.

[0081] Optionally, the unified scheduling and configuration center in the embodiment of the present invention is a nacos platform.

[0082] Optionally, the multiple message push channels in the embodiment of the present invention include at least two of the following: APP push, email, public account push, and text message.

[0083] Optionally, the server in the embodiment of the present invention is an Nginx server.

[0084] It should be noted that the microservice-based multi-channel message push system provided in the embodiment of the present invention is a system corresponding to the microservice-based multi-channel message push method in the aforementioned embodiment. All implementation means in the aforementioned microservice-based multi-channel message push method embodiment are applicable to the embodiment of the microservice-based multi-channel message push system, and can also achieve the same technical effect.

[0085] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A multi-channel message push method based on microservices, characterized in that: Applied to a multi-channel message push system based on microservices, the multi-channel message push system based on microservices includes a unified scheduling and configuration center, business services and security services are registered to the unified scheduling and configuration center, the business services at least include a message push service, and the message push service is a service aggregated from multiple message push channels; The multi-channel message push method based on microservices includes: After calling the message push service, verify whether the message parameters uploaded by the caller are correct; the message parameters provided by the caller are used to specify the content and object of the message to be sent; If the verification is passed, a target message is generated according to the message parameters, the target message is pushed to a message queue, and a target message push channel is determined according to the message parameters; Sending the target message to the target message push channel, and using the target message push channel to send the target message; Before calling the message push service, the microservice-based multi-channel message push method further includes: The information system calls the interface from the front-end platform to send the microservice request to the server; The server forwards the microservice request to the gateway; The gateway forwards the microservice request to the security service; The security service authenticates and authorizes the caller that sends the microservice request according to the microservice request; The server is an Nginx server; the Nginx server is used for reverse proxy to achieve load balancing. When a single server cannot meet the user's request, a cluster of multiple servers uses the Nginx server as a reverse proxy, and the multiple servers evenly share the load.

2. The multi-channel message push method based on microservices according to claim 1 is characterized in that: The multi-channel message push system based on microservices also includes a customer management module, and the multi-channel message push method based on microservices also includes: Enter the message push channel configuration function through the customer management module; Complete the configuration of the message push channel according to the message push channel configuration information uploaded by the user; Save the configuration information.

3. The multi-channel message push method based on microservices according to claim 1 is characterized in that: The unified scheduling and configuration center is a dynamic naming and configuration service nacos platform.

4. The multi-channel message push method based on microservices according to claim 1 is characterized in that: The multiple message push channels include at least two of the following: APP push, email, public account push, and SMS.

5. The multi-channel message push method based on microservices according to claim 1 is characterized in that: The multi-channel message push method based on microservices also includes: The result of the target message push channel sending the target message is obtained, and all sending behavior information is recorded, wherein the sending behavior information at least includes: sending time, message parameters, sending content, sending result, and failure reason.

6. A multi-channel message push system based on microservices, characterized in that: It includes a unified scheduling and configuration center, business services and security services are registered with the unified scheduling and configuration center, the business services at least include a message push service, and the message push service is a service aggregated from multiple message push channels; The microservice-based multi-channel message push system also includes: A verification module, used to verify whether the message parameters uploaded by the caller are correct after calling the message push service; the message parameters provided by the caller are used to specify the content and object of the sent information; A processing module, configured to generate a target message according to the message parameters after verification, push the target message to a message queue, and determine a target message push channel according to the message parameters; A calling module, used for calling the target message push channel to send the target message; Before calling the message push service, it also includes: The information system calls the interface from the front-end platform to send the microservice request to the server; The server forwards the microservice request to the gateway; The gateway forwards the microservice request to the security service; The security service authenticates and authorizes the caller that sends the microservice request according to the microservice request; The server is an Nginx server; the Nginx server is used for reverse proxy to achieve load balancing. When a single server cannot meet the user's request, a cluster of multiple servers uses the Nginx server as a reverse proxy, and the multiple servers evenly share the load.

7. The multi-channel message push system based on microservices according to claim 6, characterized in that: The microservice-based multi-channel message push system also includes a customer management module; The customer management module is used to enter the message push channel configuration function, complete the configuration of the message push channel according to the message push channel configuration information uploaded by the user, and save the configuration information.

8. The multi-channel message push system based on microservices according to claim 6, characterized in that: The unified scheduling and configuration center is a dynamic naming and configuration service nacos platform.

Citation Information

Patent Citations

  • Micro-service-based reliable short message sending method

    CN111787494A

  • Shared service pushing method and system based on micro-service architecture

    CN113794755A

  • Message pushing method and device, computer equipment and storage medium

    CN113839977A

  • Message pushing method and device, server and computer scale storage medium

    CN114301977A

  • Message pushing method and device, electronic equipment and readable storage medium

    CN114338793A