CN111049938B - Message notification method and device, electronic equipment and readable storage medium - Google Patents

Message notification method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN111049938B
CN111049938B CN202010019747.7A CN202010019747A CN111049938B CN 111049938 B CN111049938 B CN 111049938B CN 202010019747 A CN202010019747 A CN 202010019747A CN 111049938 B CN111049938 B CN 111049938B
Authority
CN
China
Prior art keywords
notification
service
message
business
scheduling request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010019747.7A
Other languages
Chinese (zh)
Other versions
CN111049938A (en
Inventor
王兴华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guiyang Huochebang Technology Co ltd
Original Assignee
Guiyang Huochebang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guiyang Huochebang Technology Co ltd filed Critical Guiyang Huochebang Technology Co ltd
Priority to CN202010019747.7A priority Critical patent/CN111049938B/en
Publication of CN111049938A publication Critical patent/CN111049938A/en
Application granted granted Critical
Publication of CN111049938B publication Critical patent/CN111049938B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application provides a message notification method, a message notification device, electronic equipment and a readable storage medium, and relates to the technical field of computers. The method comprises the following steps: a notification service receives a notification scheduling request sent by a first service, wherein the notification scheduling request carries an identifier of a second service and a notification message; and the notification service responds to the notification scheduling request and sends the notification message to the second business service. The scheme sends the notification message to the corresponding business service through the notification service, so that the communication between the business services is managed by the notification service, and the processing burden of the business service can be effectively reduced.

Description

Message notification method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a message notification method and apparatus, an electronic device, and a readable storage medium.
Background
In the prior art, if communication is needed between business services, the business services need to provide communication interfaces for other business services communicating with the business services, and if a payment service needs to communicate with business services such as a transfer service and a short message service, the payment service needs to provide communication interfaces for both the transfer service and the short message service. If the payment service adds a business service communicating with the payment service, the payment service needs to be recoded to provide a communication interface for the payment service, so that the coding needs to be recoded every time a business service communicating with the payment service is added, and the payment service needs to use extra resources to manage the communication interfaces, thereby increasing the burden of the payment service.
Disclosure of Invention
An object of the embodiments of the present application is to provide a message notification method, a message notification apparatus, an electronic device, and a readable storage medium, so as to solve the problem of a heavy burden of a business service in the prior art.
In a first aspect, an embodiment of the present application provides a message notification method, where the method includes: a notification service receives a notification scheduling request sent by a first service, wherein the notification scheduling request carries an identifier of a second service and a notification message; and the notification service responds to the notification scheduling request and sends the notification message to the second business service.
In the implementation process, the notification message is sent to the corresponding business service through the notification service, so that the communication between the business services is managed by the notification service, and the processing burden of the business services can be effectively reduced.
Optionally, the notifying and scheduling request further carries an identifier of the first service, and the notifying service responds to the notifying and scheduling request and sends the notification message to the second service, including:
the notification service responds to the notification scheduling request, and determines the relevant information of the second business service bound with the first business service from a pre-stored binding relation table among all business services on the basis of the identifier of the first business service and the identifier of the second business service;
the notification service sends the notification message to the second business service based on the related information of the second business service.
In the implementation process, the management of the binding relationship of each service by the notification service can be facilitated by configuring the binding relationship table, so that when the binding relationship between the service is increased or deleted, the notification service can be dynamically added or deleted in the binding relationship table without adding or deleting a notification interface locally by the service, that is, without modifying the relevant coding information of the service by the service, thereby reducing the burden of the service.
Optionally, the information related to the second service includes an interface address of the second service, and the sending, by the notification service, the notification message to the second service includes:
and the notification service sends the notification message to the second business service according to the interface address.
In the implementation process, the interface address of each service can be stored in the related information of the service, so that the notification service can send the notification message to the second service corresponding to the interface address, thereby realizing accurate sending of the notification message.
Optionally, the information related to the second service includes a protocol invocation manner when sending a notification message to the second service, where the sending of the notification message by the notification service to the second service includes:
and the notification service sends the notification message to the second service according to the protocol calling mode.
In the implementation process, the notification service can send the notification message to the second service according to the corresponding protocol calling mode, so that the notification service can avoid the problem of message sending congestion when the notification service needs to send more notification messages.
Optionally, before the notification service receives the notification scheduling request sent by the first service, the method further includes:
the notification service receives a binding request for binding the first service with the second service, wherein the binding request carries an identifier of the first service, an identifier of the second service and related information of the second service;
and the notification service responds to the binding request and adds the binding relationship between the first business service and the second business service and the related information of the second business service into the binding relationship table.
Optionally, the sending, by the notification service, the notification message to the second service in response to the notification scheduling request includes:
and the notification service responds to the notification scheduling request and sends the notification message to a message queue component so as to send the notification message to the second business service through the message queue component.
In the implementation process, the notification messages are sent to the second service through the message queue component, so that the notification messages can be sent in sequence, and the problem of message congestion in a network can be effectively avoided.
Optionally, after the sending the notification message to the second service, the method further includes:
the notification service receives parameter information returned by the second service;
and the notification service determines a notification result according to the parameter information.
Optionally, the determining, by the notification service, a notification result according to the parameter information includes:
the notification service acquires a notification result judgment condition corresponding to the second service;
and the notification service determines a notification result according to the parameter information and the notification result judgment condition.
In the implementation process, since the second service may not receive the notification message due to a network problem or other reasons during the message transmission process, the notification service may determine the notification result based on the parameter information and the notification result judgment condition in order to confirm whether the second service receives the notification message.
Optionally, after the notification service determines the notification result according to the parameter information, the method further includes:
the notification service sends the notification result to the first business service.
Optionally, the sending, by the notification service, the notification result to the first business service includes:
the notification service determines whether a callback is required;
and if so, the notification service sends callback information representing the success of the notification to the first service.
In the implementation process, in order to reduce the communication between the notification service and the business service and increase the communication burden of the notification service, the callback message may be sent to the first business service only after it is determined that the callback is required.
Optionally, the sending, by the notification service, the notification result to the first business service includes:
if the notification result is that the notification fails, the notification service determines whether to retry the notification;
if not, the notification service sends callback information representing the failure of the notification to the first service.
Optionally, after the notification service determines the notification result according to the parameter information, the method further includes:
if the notification result is that the notification fails, the notification service determines whether to retry the notification;
if so, the notification service acquires a corresponding retry strategy and performs retry notification processing on the second service according to the retry strategy.
In the implementation process, different retry strategies can be configured for the binding relations among different business services, so that the modification of the retry strategies can be dynamically realized, the condition that all binding records are provided with the same retry strategy is avoided, and the implementation process is more flexible.
In a second aspect, an embodiment of the present application provides a message notification method, where the method includes:
a first service sends a notification scheduling request to a notification service, wherein the notification scheduling request carries an identifier of a second service and a notification message;
the notification service receives the notification scheduling request;
and the notification service responds to the notification scheduling request and sends the notification message to the second business service.
In a third aspect, an embodiment of the present application provides a message notification apparatus, where the apparatus includes:
a request receiving module, configured to receive a notification scheduling request sent by a first service, where the notification scheduling request carries an identifier of a second service and a notification message;
and the message notification module is used for responding to the notification scheduling request and sending the notification message to the second service.
Optionally, the notification scheduling request further carries an identifier of the first service, and the message notification module is configured to respond to the notification scheduling request, and determine, based on the identifier of the first service and the identifier of the second service, relevant information of the second service bound to the first service from a pre-stored binding relationship table between the service services; and sending the notification message to the second business service based on the related information of the second business service.
Optionally, the related information of the second service includes an interface address of the second service, and the message notification module is configured to send the notification message to the second service according to the interface address.
Optionally, the related information of the second service includes a protocol calling manner when sending a notification message to the second service, and the message notification module is configured to send the notification message to the second service according to the protocol calling manner.
Optionally, the apparatus further comprises:
a binding relationship adding module, configured to receive a binding request for binding the first service to the second service, where the binding request carries an identifier of the first service, an identifier of the second service, and related information of the second service; and responding to the binding request, and adding the binding relationship between the first business service and the second business service and the related information of the second business service into the binding relationship table.
Optionally, the message notification module is further configured to send the notification message to a message queue component in response to the notification scheduling request, so as to send the notification message to the second service through the message queue component.
Optionally, the apparatus further comprises:
a notification result acquisition module, configured to receive parameter information returned by the second service; and determining a notification result according to the parameter information.
Optionally, the notification result obtaining module is configured to obtain a notification result judgment condition corresponding to the second service; and determining a notification result according to the parameter information and the notification result judgment condition.
Optionally, the apparatus further comprises:
and the notification result sending module is used for sending the notification result to the first service.
Optionally, the notification result sending module is configured to determine whether a callback is required; and if so, sending callback information representing the success of the notification to the first service.
Optionally, the notification result sending module is configured to determine whether to retry the notification if the notification result is notification failure; and if not, sending callback information representing the notification failure to the first service.
Optionally, the apparatus further comprises:
the retry processing module is used for determining whether to retry the notification if the notification result is that the notification fails; if yes, acquiring a corresponding retry strategy, and performing retry notification processing on the second service according to the retry strategy.
In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the method as provided in the first aspect are executed.
In a fifth aspect, embodiments of the present application provide a readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, performs the steps in the method as provided in the first aspect.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a message notification method according to an embodiment of the present application;
fig. 3 is an interaction flowchart of another message notification method provided in an embodiment of the present application;
fig. 4 is a block diagram of a message notification apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
The embodiment of the application provides a message notification method, which sends a notification message to a corresponding business service through a notification service, so that communication among all business services is managed by the notification service, and the processing burden of the business services can be effectively reduced.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the electronic device may include: at least one processor 110, such as a CPU, at least one communication interface 120, at least one memory 130, and at least one communication bus 140. Wherein the communication bus 140 is used for realizing direct connection communication of these components. The communication interface 120 of the device in the embodiment of the present application is used for performing signaling or data communication with other node devices. The memory 130 may be a high-speed RAM memory or a non-volatile memory (e.g., at least one disk memory). The memory 130 may optionally be at least one memory device located remotely from the aforementioned processor. The memory 130 stores computer readable instructions, which when executed by the processor 110, cause the electronic device to perform the method processes of fig. 2 described below.
The notification service in the embodiment of the present application may refer to a process running in an electronic device, the processor 110 may be configured to execute the processes, the memory 130 may be configured to store an identifier of the notification message and a business service, or log information generated by the execution of the notification service itself, and when the notification service is executed, the notification message may be obtained from the memory 130 and then sent to the corresponding business service.
It will be appreciated that the configuration shown in fig. 1 is merely illustrative and that the electronic device may also include more or fewer components than shown in fig. 1 or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 2, fig. 2 is a flowchart of a message notification method according to an embodiment of the present application, where the method includes the following steps:
step S110: and the notification service receives a notification scheduling request sent by the first service, wherein the notification scheduling request carries the identifier of the second service and a notification message.
The first business service can be understood as a service needing to send a notification message, the second business service is a notification object of the first business service sending the notification message, if in a payment business process, a customer charges on a payment platform, in this case, the first business service is a payment service, the second business service is a bank transfer service, the payment service initiates an application to the bank transfer service, money in a customer account is transferred to a company account, after the money in the bank is received, the payment service sends the notification message to the transfer service, namely the fact that the money is received is confirmed, then the payment service can send the notification message to the short message service, so that the short message service sends a corresponding transfer prompt short message to the user, and in this case, the short message service is the second business service.
Therefore, if there are a plurality of second service services that the first service needs to notify, the first service needs to provide a corresponding notification interface for each second service, which increases the complexity of the first service, and the first service also uses additional resources to maintain the notification interfaces, so that the burden of the first service is large.
The first service, the notification service and the second service may be on the same device or on different devices, and may be flexibly configured according to actual situations in practical applications.
When the first service needs to send a notification message to the second service, the first service sends a notification scheduling request to the notification service, and the notification scheduling request carries an identifier of the second service and the notification message.
The identifier of the second business service is used to indicate to which business service the notification message is sent by the notification service, the notification message may be information specifically needing to be notified, the notification message sent by the payment service to the transfer service may be "money to be confirmed to be paid", the notification message may also be some notification parameters, and the notification parameters may be used to indicate to the notification service to acquire the specific notification message, for example, the notification service may search for and acquire a corresponding message from a database storing a correspondence relationship between the notification parameters and the specific message, for example, the notification parameter sent by the first business service to the notification service is 001, and after the notification service acquires the notification parameters, the notification service searches for and acquires the corresponding message as "money to be confirmed to be paid", so that the notification service may acquire the corresponding notification message and then send the notification message to the second business service, thereby reducing the data sending amount of the first business service, and enabling the message to be transmitted more quickly.
That is, after receiving the notification scheduling request sent by the first service, the notification service may obtain the notification message and the identifier of the second service from the notification scheduling request.
Step S120: and the notification service responds to the notification scheduling request and sends the notification message to the second business service.
After obtaining the identifier of the second service and the notification message, the notification service may determine the second service according to the identifier of the second service, and then send the notification message to the second service. That is, the notification service is used for managing communication between the service services, and the notification service can receive the notification scheduling request of each service, and then send the notification message to the corresponding service according to the identifier of the service and the notification message carried in the notification scheduling request, so that direct communication between the service services is not required, and the burden of the service can be effectively reduced.
In the implementation process, the notification message is sent to the corresponding business service through the notification service, so that the communication between the business services is managed by the notification service, and the processing burden of the business services can be effectively reduced.
In order to facilitate management of communication among the service services, the notification service may bind each service that needs to communicate in advance, in order to facilitate the notification service to find and obtain relevant information of the second service according to the corresponding binding relationship, the notification scheduling request sent by the first service to the notification service also carries an identifier of the first service, the notification service may obtain the identifier of the first service and the identifier of the second service from the notification scheduling request, then the notification service determines relevant information of the second service bound with the first service from a pre-stored binding relationship table among the service services based on the identifier of the first service and the identifier of the second service, and then may send a notification message to the second service based on the relevant information of the second service.
The binding relationship table may store a plurality of binding records, each binding record is a binding relationship between two service services, and each binding relationship may record related information of a second service to be notified in the binding relationship. The related information of the second service may include some information such as a name, an address, a communication mode, and the like of the second service, and the notification service may send a notification message to the second service according to the related information of the second service.
The first service may communicate with other services except the second service, and the first service may communicate with each of the other services in a different manner, so that a binding record is recorded between every two services in the binding relationship table, which may be as shown in table 1 below.
TABLE 1
Figure BDA0002359928020000101
It is understood that, according to the different roles, the first service may also be the notified second service, and the second service may also be the first service sending the notification, as in table 1 above, service 2 is the notified second service in the first binding record, and is the first service sending the notification in the third binding record.
As an embodiment, in order to facilitate management of the binding relationship between the service services by the notification service, the notification service may establish the binding relationship table in advance, for example, if the first service binds to the second service, a binding request is sent to the notification service, where the binding request may carry an identifier of the first service, an identifier of the second service, and related information of the second service, so that after receiving the binding request that the first service binds to the second service, the notification service responds to the binding request and adds the binding relationship between the first service and the second service and the related information of the second service to the binding relationship table.
Therefore, when the binding relationship between the business services is increased or deleted, the notification service can be dynamically added or deleted in the binding relationship table without adding or deleting a notification interface locally by the business service, namely without modifying the relevant coding information of the business service, so that the burden of the business service can be reduced.
In addition, after obtaining the identifier of the first service and the identifier of the second service, the notification service determines the binding record of the notification service in the binding relationship table, and further obtains the related information of the second service, which can be stored in the following manner 2.
TABLE 2
Figure BDA0002359928020000111
Figure BDA0002359928020000121
It is understood that, for the second service in each binding record, one piece of information related to the second service as shown in table 2 may be stored, and then table 2 is stored in association with the corresponding binding record in table 1. The related information of the second service comprises an interface address corresponding to the second service, so that after the notification service obtains the identifier of the second service, the related information corresponding to the second service can be found, the interface address of the second service is obtained from the related information, and then the notification message is sent to the second service according to the interface address.
The notification service needs to manage communication among the business services, so that interface addresses of the business services can be stored in related information of the business services, the notification service can send the notification message to a second business service corresponding to the interface addresses, and accurate sending of the notification message can be achieved.
In addition, as an embodiment, different communication modes can be set for different business services, so the related information of the second business service can also include a protocol calling mode when sending the notification message to the second business service, that is, the notification service can also send the notification message to the second business service according to the protocol calling mode.
The Protocol calling mode refers to calling a corresponding communication Protocol to send a notification message, and it can be understood that the related information of the second service in table 2 may be different for each binding record, for example, for the service 3, the two binding records are respectively bound to the service 1 and the service 2, in this case, the Protocol calling mode in the related information of the service 3 may be different, for example, the Protocol calling mode in the related information of the service 3 corresponding to the binding record of the service 1 and the service 3 may be a hypertext Transfer Protocol (HTTP), when the Protocol calling mode in the related information of the service 3 corresponding to the binding record of the service 2 and the service 3 may be a Simple Object Access Protocol (SOAP), when the service 1 sends the notification message to the service 3, the notification service may call the HTTP Protocol to send the HTTP message to the service 3, and when the service 2 sends the notification message to the service 3, the notification service may send the notification message to the service 3.
It should be understood that the notification service may modify the protocol calling mode in the relevant information of the service when the protocol calling mode is changed, so that different communication modes can be flexibly set for each binding record, and the notification service can avoid the problem of message transmission congestion when there are many notification messages to be transmitted.
In an embodiment, in order to avoid processing burden of the notification service due to excessive notification messages that the notification service needs to process, the notification service may further send the notification message to the message queue component, so as to send the notification message to the second business service through the message queue component.
The message queue component can queue the received notification messages according to the receiving time sequence, for example, the message queue component can be implemented by using a rockmq, and the rockmq supports the notification messages to be sent to each second service in a first-in first-out and strict sequence in the queue, so that each notification message can be sent in sequence, and the problem of message congestion in the network can be effectively avoided.
In addition, each business service may communicate with the notification service through a corresponding interface, for example, when the first business service sends the notification scheduling request to the notification service, the notification scheduling request may be sent by calling the interface of the first business service, and in order to identify the notification scheduling request sent each time, the information sent through the interface may be as shown in table 3 below.
TABLE 3
Figure BDA0002359928020000141
In this way, the notification service may receive the relevant information in table 3 from the interface, and may then obtain the identifier of the first service and the identifier of the second service therefrom, and obtain the corresponding notification message, and then send the notification message to the second service.
As an embodiment, since the second service may not receive the notification message due to a network problem or other reasons during the message transmission process, in order to confirm whether the second service receives the notification message, the notification service may receive parameter information returned by the second service, and then determine the notification result according to the parameter information.
That is, the second service may send, to the notification service, the parameter information of which reception is failed if it is detected that the notification message is not received within a period of time, where the parameter information is 0, and send, to the notification service, the parameter information of which reception is successful if the second service receives the notification message within a preset period of time, where the parameter information is 1, and thus, the notification service may determine the notification result based on the parameter information.
The related information of the second service shown in table 2 includes the notification result judgment, that is, the notification service can obtain the notification result judgment condition in the related information of the second service, and then determine the notification result according to the parameter information and the notification result judgment condition.
For example, if the notification result determination condition is that the parameter information is 0 indicating that the notification has failed and the parameter information is 1 indicating that the notification has succeeded, the notification service can determine the correct notification result by using the notification result determination condition.
In order to make the first business service aware of its notification result, the notification service may also send a corresponding notification result to the first business service, so that the first business service may directly obtain the notification result to determine whether the notification message notifies successfully.
In addition, in order to reduce communication between the notification service and the service and increase a communication burden of the notification service, a callback policy may be configured for each binding record, for example, whether to perform result callback may be further added in table 1, for example, different callback conditions may be set for different binding records, for example, callback is not required or required, before the notification service sends the notification result to the first service, the corresponding binding record may be determined based on the identifier of the first service and the identifier of the second service, and then whether the callback identifier exists is searched in the binding record, that is, whether to perform callback is determined, if yes, the notification service sends a callback message representing that the notification is successful to the first service, for example, a parameter is sent to the first service, and the parameter represents that the notification is successful.
For example, for the binding record of the business service 1 and the business service 2, it may set a callback requirement, and the notification service may find whether a callback is required after determining the notification result, and if so, the notification result needs to be sent to the business service 1 regardless of whether the notification result is failed or successful.
Of course, it may also be set that a callback is required only when the notification fails, if the callback is performed if the notification fails, is set in the related information of the service, the callback is performed when the notification service determines that the callback is required, and if the notification fails, the callback is performed when determining whether the notification fails, if so, the callback information indicating that the notification fails is sent to the first service, and if not, the callback is not performed.
Or, when the notification service obtains the notification result as the notification failure, the notification service may also directly send callback information representing the notification failure to the first service.
In addition, a retry policy may also be set for each binding record, where the retry policy is to determine whether to resend the notification message and how to send the notification message when the notification result is that the notification fails, for example, an identifier of the retry policy is added to each binding record in table 1, identifiers of different retry policies may correspond to different retry policies, different identifiers of the retry policies may be configured for each binding record according to actual requirements, and a correspondence relationship between the identifier of the retry policy and a specific retry policy thereof may be shown in table 4 below.
TABLE 4
Figure BDA0002359928020000161
Therefore, when the notification result is determined to be that the notification fails, the notification service may further search for the content of the corresponding retry policy from the binding record of the first service and the second service, that is, determine whether the retry is required based on the identifier of the retry policy, if so, obtain the corresponding retry policy, and perform retry notification processing on the second service according to the corresponding retry policy, and if so, the notification service may send the notification message to the second service again.
If the content of the retry policy indicates that no retry is required, the notification service may send callback information characterizing the failure of the notification to the first traffic service.
That is, after the notification service determines that a callback is required, it determines whether retry is required, and if not, sends callback information representing that the notification fails to the first service.
Of course, when the notification fails, it may be determined whether to retry, if not, it may be determined whether to call back is needed, and if so, call back information representing that the notification fails is sent to the first service.
Therefore, different retry strategies can be configured for each binding record, the retry strategies can be dynamically modified, the same retry strategy is prevented from being set for all the binding records, and the method is more flexible.
In addition, when the notification service performs callback, a callback address may be obtained first, the callback address may also be configured in the binding relationship table in table 1, and the notification service may perform callback based on the callback address after obtaining the callback address.
The notification service may also send related information to the first business service by calling the corresponding callback interface, and the sent information may be as shown in table 5 below.
TABLE 5
Figure BDA0002359928020000171
In this way, the notification service may send the information to the first business service through the callback interface, so that the first business service may perform the notification result.
Referring to fig. 3, fig. 3 is an interaction flowchart of another message notification method according to an embodiment of the present application, where the method includes the following steps:
step S210: and the first service sends a notification scheduling request to a notification service, wherein the notification scheduling request carries the identifier of the second service and a notification message.
Step S220: the notification service receives the notification scheduling request.
Step S230: and the notification service responds to the notification scheduling request and sends the notification message to the second business service.
The specific implementation process of this embodiment may refer to the specific implementation process of the above method embodiment, and for brevity of description, redundant description is not repeated here.
Referring to fig. 4, fig. 4 is a block diagram of a message notification apparatus 200 according to an embodiment of the present disclosure, where the apparatus 200 may refer to a program segment or code corresponding to a notification service, that is, the apparatus 200 may be a module, a program segment or code on an electronic device. It should be understood that the apparatus 200 corresponds to the above-mentioned embodiment of the method of fig. 2, and can perform various steps related to the embodiment of the method of fig. 2, and the specific functions of the apparatus 200 can be referred to the above description, and the detailed description is appropriately omitted here to avoid redundancy.
Optionally, the apparatus 200 comprises:
a request receiving module 210, configured to receive a notification scheduling request sent by a first service, where the notification scheduling request carries an identifier of a second service and a notification message;
a message notification module 220, configured to respond to the notification scheduling request and send the notification message to the second service.
Optionally, the notification scheduling request further carries an identifier of the first service, and the message notification module 220 is configured to respond to the notification scheduling request, and determine, based on the identifier of the first service and the identifier of the second service, relevant information of the second service bound to the first service from a pre-stored binding relationship table between the service services; and sending the notification message to the second business service based on the related information of the second business service.
Optionally, the information related to the second service includes an interface address of the second service, and the message notification module 220 is configured to send the notification message to the second service according to the interface address.
Optionally, the related information of the second service includes a protocol calling manner when sending a notification message to the second service, and the message notification module 220 is configured to send the notification message to the second service according to the protocol calling manner.
Optionally, the apparatus 200 further comprises:
a binding relationship adding module, configured to receive a binding request for binding the first service to the second service, where the binding request carries an identifier of the first service, an identifier of the second service, and related information of the second service; and responding to the binding request, and adding the binding relationship between the first business service and the second business service and the related information of the second business service into the binding relationship table.
Optionally, the message notification module 220 is further configured to send the notification message to a message queue component in response to the notification scheduling request, so as to send the notification message to the second service through the message queue component.
Optionally, the apparatus 200 further comprises:
the notification result acquisition module is used for receiving the parameter information returned by the second business service; and determining a notification result according to the parameter information.
Optionally, the notification result obtaining module is configured to obtain a notification result judgment condition corresponding to the second service; and determining a notification result according to the parameter information and the notification result judgment condition.
Optionally, the apparatus 200 further comprises:
and the notification result sending module is used for sending the notification result to the first service.
Optionally, the notification result sending module is configured to determine whether a callback is required; and if so, sending callback information representing the success of the notification to the first business service.
Optionally, the notification result sending module is configured to determine whether to retry if the notification result is a notification failure; and if not, sending callback information representing the notification failure to the first service.
Optionally, the apparatus 200 further comprises:
the retry processing module is used for determining whether to retry the notification if the notification result is that the notification fails; if yes, acquiring a corresponding retry strategy, and performing retry notification processing on the second service according to the retry strategy.
The embodiment of the present application provides a readable storage medium, and when being executed by a processor, the computer program performs the method process performed by the electronic device in the method embodiment shown in fig. 2.
The present embodiments disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the above-described method embodiments, for example, comprising: a notification service receives a notification scheduling request sent by a first service, wherein the notification scheduling request carries an identifier of a second service and a notification message; and the notification service responds to the notification scheduling request and sends the notification message to the second business service.
In summary, embodiments of the present application provide a message notification method, a message notification apparatus, an electronic device, and a readable storage medium, where a notification service is used to send a notification message to a corresponding service, so that communication between service services is managed by the notification service, and thus processing load of the service services can be effectively reduced.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (15)

1. A message notification method, the method comprising:
a notification service receives a notification scheduling request sent by a first service, wherein the notification scheduling request carries an identifier of a second service and a notification message, the notification message comprises a notification parameter, the notification parameter is used for indicating the notification service to acquire a specific notification message, and the notification service stores a corresponding relation between the notification parameter and the specific notification message;
the notification service responds to the notification scheduling request and sends the notification message to the second business service;
wherein the notifying and scheduling request further carries an identifier of the first service, and the notifying and scheduling request is responded by the notifying service, and the notifying message is sent to the second service, including:
the notification service responds to the notification scheduling request, and determines relevant information of the second service bound with the first service from a pre-stored binding relation table among the service services on the basis of the identifier of the first service and the identifier of the second service, wherein the relevant information comprises the name, the address and the communication mode of the second service;
the notification service sends the notification message to the second business service based on the related information of the second business service;
and configuring a corresponding callback policy or retry policy for each binding record in the binding relationship table, where the callback policy is used to indicate whether the notification service needs to send a callback message to the first service, and the retry policy is used to indicate whether the notification service needs to resend the notification message and a sending mode when resending when determining that the notification result is a notification failure.
2. The method of claim 1, wherein the information related to the second service comprises an interface address of the second service, and wherein the notification service sends the notification message to the second service, comprising:
and the notification service sends the notification message to the second business service according to the interface address.
3. The method of claim 1, wherein the information related to the second service includes a protocol invocation manner when sending a notification message to the second service, and wherein the sending of the notification message to the second service by the notification service includes:
and the notification service sends the notification message to the second service according to the protocol calling mode.
4. The method of claim 1, wherein before the notification service receives the notification scheduling request sent by the first traffic service, the method further comprises:
the notification service receives a binding request for binding the first service with the second service, wherein the binding request carries an identifier of the first service, an identifier of the second service and related information of the second service;
and the notification service responds to the binding request and adds the binding relationship between the first business service and the second business service and the related information of the second business service into the binding relationship table.
5. The method of claim 1, wherein the notifying service sending the notification message to the second traffic service in response to the notification scheduling request comprises:
and the notification service responds to the notification scheduling request and sends the notification message to a message queue component so as to send the notification message to the second business service through the message queue component.
6. The method of claim 1, wherein after sending the notification message to the second traffic service, further comprising:
the notification service receives parameter information returned by the second service;
and the notification service determines a notification result according to the parameter information.
7. The method of claim 6, wherein the notification service determines the notification result according to the parameter information, and wherein the method comprises:
the notification service acquires a notification result judgment condition corresponding to the second service;
and the notification service determines a notification result according to the parameter information and the notification result judgment condition.
8. The method of claim 6, wherein after the notification service determines the notification result according to the parameter information, the method further comprises:
the notification service sends the notification result to the first business service.
9. The method of claim 8, wherein the notification service sends the notification result to the first business service, and wherein the notification service comprises:
the notification service determines whether a callback is required;
and if so, the notification service sends callback information representing the success of notification to the first service.
10. The method of claim 8, wherein the notification service sends the notification result to the first business service, and wherein the notification service comprises:
if the notification result is that the notification fails, the notification service determines whether to retry the notification;
if not, the notification service sends callback information representing the failure of the notification to the first service.
11. The method of claim 6, wherein after the notification service determines the notification result according to the parameter information, the method further comprises:
if the notification result is that the notification fails, the notification service determines whether to retry the notification;
if yes, the notification service acquires a corresponding retry strategy, and performs retry notification processing on the second service according to the retry strategy.
12. A message notification method, the method comprising:
a first service sends a notification scheduling request to a notification service, wherein the notification scheduling request carries an identifier of a second service and a notification message, the notification message comprises a notification parameter, the notification parameter is used for indicating the notification service to acquire a specific notification message, and the notification service stores a corresponding relationship between the notification parameter and the specific notification message;
the notification service receiving the notification scheduling request;
the notification service responds to the notification scheduling request and sends the notification message to the second business service;
wherein the notifying and scheduling request further carries an identifier of the first service, and the notifying and scheduling request is responded by the notifying service, and the notifying message is sent to the second service, including:
the notification service responds to the notification scheduling request, and determines relevant information of the second service bound with the first service from a pre-stored binding relation table among the service services on the basis of the identifier of the first service and the identifier of the second service, wherein the relevant information comprises the name, the address and the communication mode of the second service;
the notification service sends the notification message to the second business service based on the related information of the second business service;
and configuring a corresponding callback policy or retry policy for each binding record in the binding relationship table, where the callback policy is used to indicate whether the notification service needs to send a callback message to the first service, and the retry policy is used to indicate whether the notification service needs to resend the notification message and a sending mode when resending when determining that the notification result is a notification failure.
13. A message notification apparatus, applied to a notification service, the apparatus comprising:
a request receiving module, configured to receive a notification scheduling request sent by a first service, where the notification scheduling request carries an identifier of a second service and a notification message, where the notification message includes a notification parameter, the notification parameter is used to indicate the notification service to obtain a specific notification message, and a correspondence between the notification parameter and the specific notification message is stored in the notification service;
a message notification module, configured to respond to the notification scheduling request and send the notification message to the second service;
wherein the notification scheduling request further carries an identifier of the first service, and the message notification module is configured to:
responding to the notification scheduling request, and determining related information of the second business service bound with the first business service from a pre-stored binding relation table among all business services based on the identifier of the first business service and the identifier of the second business service, wherein the related information comprises the name, the address and the communication mode of the second business service;
sending the notification message to the second business service based on the related information of the second business service;
and configuring a corresponding callback policy or retry policy for each binding record in the binding relationship table, where the callback policy is used to indicate whether the notification service needs to send a callback message to the first service, and the retry policy is used to indicate whether the notification service needs to resend the notification message and a sending mode when resending when determining that the notification result is a notification failure.
14. An electronic device comprising a processor and a memory, the memory storing computer readable instructions that, when executed by the processor, perform the method of any of claims 1-11.
15. A readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-11.
CN202010019747.7A 2020-01-08 2020-01-08 Message notification method and device, electronic equipment and readable storage medium Active CN111049938B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010019747.7A CN111049938B (en) 2020-01-08 2020-01-08 Message notification method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010019747.7A CN111049938B (en) 2020-01-08 2020-01-08 Message notification method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN111049938A CN111049938A (en) 2020-04-21
CN111049938B true CN111049938B (en) 2022-10-18

Family

ID=70244148

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010019747.7A Active CN111049938B (en) 2020-01-08 2020-01-08 Message notification method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN111049938B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113762652A (en) * 2020-06-01 2021-12-07 北京沃东天骏信息技术有限公司 Business process control method, device, equipment and computer readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109416770A (en) * 2017-01-19 2019-03-01 北京嘀嘀无限科技发展有限公司 A kind of system and method for monitoring demand service
WO2019196244A1 (en) * 2018-04-10 2019-10-17 平安科技(深圳)有限公司 Real-time order callback method and system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101695076A (en) * 2009-09-21 2010-04-14 中兴通讯股份有限公司 Method and device of unified agent adaptation based on Web service and adaptation system
CN103650632B (en) * 2012-05-28 2017-05-31 华为技术有限公司 The methods, devices and systems processed the notice of mobile terminal application
CN103812838A (en) * 2012-11-13 2014-05-21 中国移动通信集团公司 Service calling method and device and system
CN104796314B (en) * 2014-01-20 2018-04-13 腾讯科技(深圳)有限公司 Method and device for business processing
CN104144124B (en) * 2014-07-21 2015-11-18 腾讯科技(深圳)有限公司 Data forwarding method, Apparatus and system
CN106899485B (en) * 2015-12-21 2020-10-30 阿里巴巴集团控股有限公司 Service notification method and device
CN106533914A (en) * 2016-11-23 2017-03-22 成都身边科技有限公司 Message notification method and apparatus
CN110601952B (en) * 2018-06-12 2022-12-27 北京京东尚科信息技术有限公司 Multi-channel message notification sending method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109416770A (en) * 2017-01-19 2019-03-01 北京嘀嘀无限科技发展有限公司 A kind of system and method for monitoring demand service
WO2019196244A1 (en) * 2018-04-10 2019-10-17 平安科技(深圳)有限公司 Real-time order callback method and system

Also Published As

Publication number Publication date
CN111049938A (en) 2020-04-21

Similar Documents

Publication Publication Date Title
CN111091429B (en) Electronic bill identification distribution method and device and electronic bill generation system
CN107426711B (en) Method, device and system for binding or unbinding mobile phone number
CN104219235A (en) Distributed transaction requesting method and device
CN104579905A (en) Message passing method and system, MOM (message oriented middleware) server and receiving terminal
CN111666745B (en) File downloading method, device, server and medium
CN113179301A (en) File downloading method and device, storage medium and electronic device
CN111049938B (en) Message notification method and device, electronic equipment and readable storage medium
CN112437155B (en) Service data processing method and device and server device
CN111159298B (en) Service request processing method and device, electronic equipment and storage medium
CN112632093A (en) Work order processing method, device, system, storage medium and program product
CN110378494B (en) Remote facing slip method, remote facing slip device, storage medium and computer equipment
CN112751743A (en) Message sending exception processing method, message sending device and electronic equipment
CN113535439B (en) Service request processing method, device, equipment and storage medium
CN115514665A (en) Service expansion method and device, electronic equipment and storage medium
CN105338058A (en) Application updating method and device
CN114092211A (en) Processing method of accounting data, electronic device and readable storage medium
CN112231601B (en) Link management method, device, equipment and computer storage medium
CN112860746B (en) Cache reduction-based method, equipment and system
CN104346228A (en) Application program sharing method and terminal
CN111061576B (en) Method and system for creating entity object
CN111614750A (en) Data updating method, system, equipment and storage medium
CN112788074B (en) Data transmitting method, processing method, receiving method, apparatus thereof, and storage medium
CN110764970B (en) Event monitoring information processing method, system and computer readable storage medium
US8924557B2 (en) System and method for supporting session threshold for IMS SCIM/service brokering
CN117762652A (en) Distributed transaction processing method and device based on message middleware

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant