Service providing method, service consumption method, device and equipment
Patent Information
- Application Number
- CN201911369184.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-26
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2039-12-26
AI Technical Summary
In distributed systems under large-scale clusters, the status of the service provider is difficult to perceive in real time, causing the service consumer to continue to request unavailable or offline service providers, resulting in reduced service availability.
When the working status of the target application provided by the server changes, at least one service consumer object in communication with the service consumer object is obtained and a notification information is sent to it to identify the working status of the target application, so that the service consumer object can adjust its request in a timely manner Behavior.
It effectively avoids the failure or timeout of data processing requests when the target application is unavailable, ensures the availability and stability of the service, and improves the practicality of the method and the benefits of marketing applications.
Smart Images

Figure CN113055415B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a service providing method, a service consuming method, a device and equipment. Background Art
[0002] During application release and update, it is difficult to ensure the real-time performance of distributed systems in large-scale clusters. For service consumers, the status information of service providers provided by directory services cannot be perceived in real time. This results in some or all service consumers still requesting the service provider that is already offline for update. However, since the provider is already in a service unavailable state, the request will fail or time out, resulting in reduced service availability. Summary of the invention
[0003] The embodiments of the present invention provide a service providing method, a service consuming method, an apparatus and a device to solve the problem in the prior art that a request may fail or time out due to a provider being in a service unavailable state, resulting in reduced service availability.
[0004] In a first aspect, an embodiment of the present invention provides a service providing method, including:
[0005] When the working state of the target application provided by the server changes, obtaining at least one service consumption object communicating with the server;
[0006] Notification information for identifying the working state of the target application is sent to the service consumption object, so that the service consumption object adjusts the target application according to the notification information.
[0007] In a second aspect, an embodiment of the present invention provides a server, including:
[0008] an acquisition module, configured to acquire at least one service consumption object communicating with the server when the working state of the target application provided by the server changes;
[0009] The first processing module is used to send notification information for identifying the working status of the target application to the service consumption object, so that the service consumption object adjusts the target application according to the notification information.
[0010] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement a service providing method in the above-mentioned first aspect.
[0011] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement a service providing method in the first aspect when executed.
[0012] When the working status of the target application provided by the server changes, at least one service consumption object communicating with the server is obtained, and then notification information for identifying the working status of the target application is sent to the service consumption object, so that the service consumption object adjusts the target application according to the notification information, thereby effectively realizing that the service consumption object can perceive the working status of the target application in a timely and rapid manner, and then in the process of updating the target application, the service can be guaranteed to be lossless as much as possible, avoiding the situation where the data processing request will fail or time out when the target application is unavailable, ensuring the availability and stability of the target application, further improving the practicality of the method, and facilitating market promotion and application.
[0013] In a fifth aspect, an embodiment of the present invention provides a service consumption method, including:
[0014] When the working state of the target application provided by the server changes, receiving notification information sent by the server for identifying the working state of the target application;
[0015] The target application is adjusted according to the notification information, so as to perform application based on the adjusted target application.
[0016] In a sixth aspect, an embodiment of the present invention provides a service consumption device, including:
[0017] A receiving module, configured to receive notification information sent by the server for identifying the working state of the target application when the working state of the target application provided by the server changes;
[0018] The second processing module is used to adjust the target application according to the notification information, so as to apply based on the adjusted target application.
[0019] In the seventh aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement a service consumption method in the above-mentioned fifth aspect.
[0020] In an eighth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement a service consumption method in the fifth aspect when executed.
[0021] When the working state of the target application provided by the server changes, by receiving the notification information sent by the server to identify the working state of the target application, and then adjusting the target application according to the notification information, it is effectively achieved that when the working state of the target application is offline, the service consumer object will not send data processing requests to the server based on the target application, thereby effectively avoiding the occurrence of invalid or failed data processing requests; when the working state of the target application is online, the service consumer object can send data processing requests to the service based on the target application, thereby ensuring the quality and efficiency of data processing, further improving the practicality of the method, and facilitating market promotion and application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 A process of providing a service method provided by an embodiment of the present invention Figure 1 ;
[0024] Figure 2 A process of providing a service method provided by an embodiment of the present invention Figure 2 ;
[0025] Figure 3 A process of providing a service method provided by an embodiment of the present invention Figure 3 ;
[0026] Figure 4 Another service consumption method provided by the embodiment of the present invention Figure 1 ;
[0027] Figure 5 Another service consumption method provided by the embodiment of the present invention Figure 2 ;
[0028] Figure 6 A schematic diagram of an interaction between a server and a service consumer object provided by an application embodiment of the present invention Figure 1 ;
[0029] Figure 7 A schematic diagram of an interaction between a server and a service consumer object provided by an application embodiment of the present invention Figure 2 ;
[0030] Figure 8A schematic diagram of the structure of a service providing device provided by an embodiment of the present invention;
[0031] Fig. 9 For Figure 8 A schematic diagram of the structure of an electronic device corresponding to the service providing device provided in the illustrated embodiment;
[0032] Fig.10 A schematic diagram of the structure of a service consumption device provided by an embodiment of the present invention;
[0033] Fig.11 For Fig.10 A schematic diagram of the structure of an electronic device corresponding to the service consumption device provided in the illustrated embodiment. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.
[0036] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0037] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0038] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0039] In order to facilitate understanding of the technical solution of the present application, the prior art is briefly described below:
[0040] Stability is an important indicator for all distributed applications. During application release and update, the real-time performance of distributed systems in large-scale clusters is difficult to guarantee. For service consumers, the status information of service providers obtained by directory services cannot be perceived in real time. This results in some or all service consumers still requesting the service application that is already offline for update. Since the service application is already in a service unavailable state, the request will fail or time out, resulting in reduced service availability. Therefore, how to ensure service integrity as much as possible and reduce the number of request failures caused by release, failures, and other factors is an important issue that all middleware needs to solve.
[0041] For traditional website-based businesses, the release of service applications is usually divided into three steps: extracting traffic, updating applications, and redistributing traffic. In the process of releasing the above applications, in order to ensure lossless service, the requests to the publishing node can be reduced by updating the downstream server list of the gateway. However, this method has three obvious problems: 1. It is strongly dependent on the gateway node, and there are problems of centralization and non-real-time; 2. It requires manual operation, which is risky and has high maintenance costs; 3. When the service stops, the requests that have arrived cannot be processed, resulting in request failure.
[0042] For example, for a service framework based on Remote Procedure Call (RPC), automatic service registration and discovery mechanisms are essential functions, and both the registration and discovery processes require updating the directory service; for an extremely large cluster, it is difficult to synchronize the offline of a service to the clients corresponding to all service subscribers in real time. However, for these subscribers who have not updated the service list, the offline service is still "available". Therefore, requests will still be made to the service provider that is actually unavailable. Although the RPC framework provides a fault-tolerant mechanism, the status of these requests is actually unknowable: Has it reached the service provider? Has the processing flow been completed, but there is no time to return a response in the future? This uncertain state not only affects the stability of the service, but also poses a great risk to the consistency of the service.
[0043] In the following, some embodiments of the present invention are described in detail in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and features in the embodiments can be combined with each other.
[0044] Figure 1 A process of providing a service method provided by an embodiment of the present invention Figure 1 ; Reference Attachment Figure 1 As shown, in order to solve the above problems existing in the prior art, this embodiment provides a service providing method. Specifically, the execution subject of the method may be a server. It can be understood by those skilled in the art that the server can be implemented as software or a combination of software and hardware. Specifically, the method may include:
[0045] S101: When the working state of a target application provided by a server changes, obtaining at least one service consumption object communicating with the server.
[0046] Among them, the server is a device corresponding to the service provider and used to provide service applications to the outside. It can be understood that a server can provide one or more service applications to the outside, and the target application can be any one of the one or more service applications. The service consumption object can refer to a device or equipment used to apply and consume the service application provided by the server. For example, the service consumption object can be an application provided to the user for applying a certain service application, or the service consumption object can be a terminal device provided to the user for applying a certain service application, or the service consumption object can also be a server provided to the user for applying a certain service application.
[0047] When the server provides the target application, the working state of the target application provided can be adjusted or controlled through the server. The working state of the target application can include: normal state, offline / stop working state. When the working state of the target application is adjusted through the server, the working state of the target application can change. For example: when the current working state of the target application provided by the server is normal state, the current working state of the target application can be adjusted to offline / stop working state through the server, so that the working state of the target application changes. The change operation at this time is an offline operation. It should be noted that at this time, only the target application stops working, and the server does not stop working. Similarly, when the current working state of the target application is offline / stop working state, the current working state of the target application can be adjusted to a normal working state through the server, so that the working state of the target application changes. The change operation at this time is an online operation.
[0048] It is understandable that the situations in which the working state of the target application changes are not limited to the above examples. Technical personnel in this field can also make settings according to specific application scenarios and application requirements. For example, the situations in which the working state of the target application changes can also include: the working state of the target application is adjusted from the first normal state to the second normal state, etc., which will not be repeated here.
[0049] Specifically, when it is determined that the working status of the target application provided by the server has changed, in order to enable the server to promptly notify the service consumption objects related to the target application of the working status of the target application, the service consumption objects may be part of the service consumption objects, or may be all of the service consumption objects, then at least one service consumption object that communicates with the server can be obtained, and the service consumption object is the service consumer that calls the target application. Specifically, this embodiment does not limit the specific method for obtaining the service consumption object, and those skilled in the art can set it according to specific application requirements. For example: the service consumption object information that communicates with the server is stored on the server, and at least one service consumption object that communicates with the server can be determined by obtaining the service consumption object information. Of course, those skilled in the art can also use other methods to obtain the service consumption object, as long as the accuracy and reliability of the service consumption object acquisition can be guaranteed, which will not be repeated here.
[0050] S102: Send notification information for identifying the working status of the target application to the service consumer object, so that the service consumer object adjusts the target application according to the notification information.
[0051] After acquiring at least one service consumer object that communicates with the server, in order to enable the service consumer object to be aware of the change in the working state of the target application in a timely manner, specifically, the server can directly / actively send notification information to the service consumer object (the service consumer object can be part of the service consumer objects, or can also be all the service consumer objects), and the notification information is used to identify that the working state of the target application has changed, so that the service consumer object can adjust the target application according to the notification information. For example: when the working change state of the target application is offline, the service consumer object can block the target application according to the notification information, so that the service consumer object will not make a data processing request based on the target application. When the working change state of the target application is online, the service consumer object can lift the blocking operation on the target application according to the notification information, so that the service consumer object can make a data processing request based on the target application.
[0052] Furthermore, in order to improve the accuracy and reliability of the use of this method, after obtaining at least one service consumption object that communicates with the server, the target service consumption object corresponding to the target application can be determined in the at least one service consumption object through the correspondence between the server and the target application. Specifically, when the server and the target application have a one-to-one correspondence, that is, the server only provides one target application to the outside and does not provide other service applications to the outside, at this time, the at least one service consumption object that communicates with the server can be directly determined as the target service consumption object corresponding to the target application. When the server and the target application have a one-to-many correspondence, that is, the server not only provides one target application to the outside, but also provides other service applications to the outside, at this time, the target service consumption object corresponding to the target application is at least a part of the at least one service consumption object that communicates with the server. Specifically, the application identifier of the target application can be obtained, and at least one service consumption object can be screened by the application identifier, and the service consumption object corresponding to the application identifier is determined as the target service consumption object corresponding to the target application. After obtaining the target service consumer object corresponding to the target application, notification information for identifying the working status of the target application can be sent to the target service consumer object, so that the target service consumer object can adjust the target application according to the notification information. This effectively realizes the targeted sending of notification information, which not only saves data transmission resources, but also ensures that the service consumer object can promptly learn about the working status of the target application and can promptly adjust according to the working status of the target application, thereby ensuring the stability and reliability of data processing.
[0053] The service providing method provided in this embodiment obtains at least one service consumption object communicating with the server, and then sends notification information for identifying the working status of the target application to the service consumption object when the working status of the target application provided by the server changes, so that the service consumption object adjusts the target application according to the notification information, thereby effectively realizing that the service consumption object can perceive the working status of the target application in a timely and rapid manner, and further ensuring the service as lossless as possible during the target application update process, avoiding the situation where the data processing request fails or times out when the target application is unavailable, ensuring the availability and stability of the target application, further improving the practicality of the method, and facilitating market promotion and application.
[0054] Figure 2 A process of providing a service method provided by an embodiment of the present invention Figure 2 Based on the above embodiments, continue to refer to the attached Figure 2 As shown, before the working state of the target application provided by the server changes, the method in this embodiment may further include:
[0055] S001: Obtain a state change instruction sent by a service management platform, where the state change instruction includes an application identifier of a target application.
[0056] The state change instruction includes an application offline instruction and an application online instruction, wherein the application offline instruction is used to adjust the working state of the target application from a normal working state to an offline / stopped working state, and the application online instruction is used to adjust the working state of the target application from an offline / stopped working state to a normal working state. Specifically, the user can adjust / change the working state of the target application provided in the server through the service management platform. For example, the user can input an execution operation to the service management platform, and the service management platform generates a state change instruction through the execution operation input by the user. The state change instruction includes the application identifier of the target application. The service management platform can send the state change instruction to the server, so that the server can obtain the state change instruction sent by the service management platform.
[0057] S002: Determine a target application corresponding to the application identifier among multiple applications, and adjust the working state of the target application based on the state change instruction.
[0058] Since the server can provide one or more service applications, after the server obtains the state change instruction, it can determine the target application from multiple applications according to the application identifier included in the state change instruction. After determining the target application, the working state of the target application can be adjusted based on the state change instruction. Specifically, a method for adjusting the working state of the target application based on the state change instruction includes:
[0059] S0021: Adjust the working state of the target application to an offline state based on the application offline instruction.
[0060] Specifically, when the state change instruction includes an application offline instruction, the working state of the target application can be adjusted from a normal working state to an offline state (offline state, stopped working state), etc. based on the application offline instruction, thereby achieving stable and effective adjustment of the working state of the target application, ensuring the flexibility and reliability of the method.
[0061] Alternatively, another method for adjusting the working state of the target application based on the state change instruction includes:
[0062] S0022: Adjust the working state of the target application to an online state based on the application online instruction.
[0063] Specifically, when the state change instruction includes an application online instruction, the working state of the target application can be adjusted from an offline state to an online state (normal working state), etc. based on the application online instruction, thereby achieving stable and effective adjustment of the working state of the target application, ensuring the flexibility and reliability of the method.
[0064] Furthermore, in order to improve the stability and reliability of the method, the method in this embodiment may further include:
[0065] S003: After the working status of the target application changes, the change feedback information of the target application is sent to the service management platform.
[0066] Specifically, after the server adjusts the working state of the target application based on the state change instruction, the working state of the target application may change according to the state change instruction. After determining that the working state of the target application has changed, in order to enable the service management platform to promptly understand the information of the target application in the server, the server may send change feedback information corresponding to the target application to the service management platform. The change feedback information is used to inform the service management platform whether the state change operation of the target application is successful. When the state change operation of the target application is successful, the change feedback information may be information used to identify the success of the change operation; when the state change operation of the target application fails, the change feedback information may be information used to identify the failure of the change operation.
[0067] In this embodiment, by obtaining the status change instruction sent by the service management platform and adjusting the working status of the target application based on the status change instruction, it is convenient to adjust the working status of the target application based on user needs, thereby meeting the user's usage needs, improving the flexibility and reliability of the method, and further ensuring the practicality of the method.
[0068] Furthermore, since the situation where the working state of the target application changes may include the situation where the target application is online and the situation where the target application is offline, and different situations may correspond to different notification information, a method for sending notification information for identifying the working state of the target application to the service consumer object so that the service consumer object adjusts the target application according to the notification information includes:
[0069] S1021: Sending first notification information for identifying that the working state of the target application is offline to the service consumer object, so that the service consumer object blocks the target application according to the first notification information.
[0070] Specifically, when the working status of the target application changes to an offline state, in order to enable the service consumer to promptly learn that the working status of the target application has been adjusted to an offline state, the server can send a first notification message to the service consumer. The first notification message is used to identify that the working status of the target application is an offline state, so that the service consumer can block the target application according to the received first notification message, that is, the service consumer will no longer send data processing requests based on the target application, thereby effectively solving the problem in the prior art that the request fails or times out due to the provider being in a service unavailable state, resulting in reduced service availability, thereby ensuring the availability of the target application.
[0071] Alternatively, another method for sending notification information for identifying the working status of the target application to the service consumer object so that the service consumer object adjusts the target application according to the notification information includes:
[0072] S1022: Sending second notification information for identifying that the working state of the target application is online to the service consumer object, so that the service consumer object cancels blocking of the target application according to the second notification information.
[0073] Specifically, when the working status of the target application changes to an online status, in order to enable the service consumer to promptly learn that the working status of the target application has been adjusted to an online status, the server can send a second notification message to the service consumer. The second notification message is used to identify that the working status of the target application is an online status, so that the service consumer can unblock the target application according to the received second notification message, that is, the service consumer can send a data processing request based on the target application, thereby effectively solving the problem in the prior art that the request fails or times out due to the provider being in a service unavailable state, resulting in reduced service availability, thereby ensuring the availability of the target application.
[0074] Figure 3 A process of providing a service method provided by an embodiment of the present invention Figure 3 Based on any of the above embodiments, continue to refer to the attached Figure 3 As shown, in order to improve the stability and reliability of the method, the method in this embodiment may further include:
[0075] S201: Receive a data processing request sent by a service consumer to a target application.
[0076] S202: Perform a data processing operation based on the target application and the data processing request, and obtain a processing result corresponding to the data processing request.
[0077] S203: Send the processing result to the service consumer object.
[0078] Specifically, before the service consumer object blocks the target application, the service consumer object can send a data processing request to the server for the target application, and when the service consumer object has blocked the target application, the service consumer object will not send a data processing request to the server for the target application. It should be noted that before the service consumer object blocks the target application, the following situations may occur: a. The working status of the target application is online; b. The working status of the target application is changing from online to offline; c. The working status of the target application has changed to offline, but the service consumer object has not blocked the target application.
[0079] When the server receives a data processing request sent by the service consumer to the target application, in order to ensure the availability of the target application and the quality of data processing, the server can perform corresponding data processing operations through the target application and the data processing request, and can obtain the processing results corresponding to the data processing request. After obtaining the processing results, the server can send the processing results to the service consumer, so that the service consumer can obtain the processing results corresponding to the data processing request, thereby effectively improving the quality and reliability of data processing.
[0080] It should be noted that regardless of whether the service consumer object blocks the target application, the server can send information to the service consumer object. However, when the service consumer object blocks the target application, the service consumer object cannot send data processing requests to the server for the target application. When the service consumer object unblocks the target application, the service consumer object can send data processing requests to the server for the target application.
[0081] Figure 4 Another service consumption method provided by the embodiment of the present invention Figure 1 ; Reference Attachment Figure 4 As shown, in order to solve the above problems existing in the prior art, this embodiment provides a service consumption method. Specifically, the execution subject of the method may be a service consumption device. It can be understood by those skilled in the art that the service consumption device can be implemented as software or a combination of software and hardware. Specifically, the method may include:
[0082] S301: When the working state of a target application provided by a server changes, receiving notification information sent by the server for identifying the working state of the target application.
[0083] Wherein, the change of the working state of the target application includes the change of the working state of the target application to an offline state and the change of the working state of the target application to an online state; when the change of the working state of the target application includes the change of the working state of the target application to an offline state, the notification information may include first notification information for identifying that the working state of the target application is an offline state. When the change of the working state of the target application includes the change of the working state of the target application to an online state, the notification information may include second notification information for identifying that the working state of the target application is an online state.
[0084] It is understandable that the situation where the working state of the target application changes is not limited to the above examples, and those skilled in the art can also set it according to specific application scenarios and application requirements. For example, the situation where the working state of the target application changes can also include: the working state of the target application is adjusted from the first normal state to the second normal state, etc., which will not be repeated here. Correspondingly, the notification information is not limited to the first notification information and the second notification information described in the above examples, and can also include a third notification information used to identify that the working state of the target application is adjusted from the first normal state to the second normal state, etc., which will not be repeated here.
[0085] When the working state of the target application provided by the server changes, the server may send notification information for identifying the working state of the target application to the service consuming device, so that the service consuming device can receive the notification information sent by the server.
[0086] S302: adjusting the target application according to the notification information, so as to apply the application based on the adjusted target application.
[0087] After obtaining the notification information, the service consumption device can adjust the target application according to the notification information, so as to avoid the situation where the request fails or times out due to the provider being in a service unavailable state, resulting in reduced service availability. Among them, since the notification information may include the first notification information and the second notification information, and different notification information may perform different adjustment operations on the target application, specifically, when the notification information includes the first notification information for identifying that the working state of the target application is an offline state, adjusting the target application according to the notification information may include:
[0088] S3021: Block the target application according to the first notification information.
[0089] Since the first notification information is used to identify that the working status of the target application is offline, at this time, in order to avoid the situation where the request fails or times out due to the target application being in a service unavailable state, resulting in reduced service availability, the service consumption device can block the target application according to the first notification information, so that the service consumption device will not make a data processing request based on the target application.
[0090] It can be understood that after shielding the target application according to the first notification information, the method in this embodiment may further include:
[0091] S3022: Sending first response information corresponding to the first notification information to the server, where the first response information is used to indicate that the service consumption device has blocked the target application.
[0092] Specifically, after the service consumption device blocks the target application according to the first notification information, the target application has been marked as unavailable for the service consumption device. At this time, in order to enable the server to timely understand the adjustment status information of the service consumption device on the target application, the service consumption device can send a first response information corresponding to the first notification information to the server, and the first response information is used to inform the server and the service consumption device that the target application has been blocked, that is, for the service consumption device, it is not possible to send a data processing request to the server based on the target application, thereby effectively avoiding the occurrence of invalid or failed data processing requests, and enabling the server to timely perceive the status information of the service consumption device on the target application, ensuring the stability and reliability of the use of this method.
[0093] In addition, when the notification information includes second notification information for identifying that the working state of the target application is an online state, adjusting the target application according to the notification information may include:
[0094] S3023: Unblock the target application according to the second notification information.
[0095] Since the second notification information is used to identify that the working status of the target application is online, at this time, in order to ensure the quality and efficiency of data processing for the target application, the service consumption device can unblock the target application according to the second notification information, so that the service consumption device can make a data processing request based on the target application again.
[0096] It can be understood that after unblocking the target application according to the second notification information, the method in this embodiment may further include:
[0097] S3024: Sending second response information corresponding to the second notification information to the server, where the second response information is used to indicate that the service consumption device has unblocked the target application.
[0098] Specifically, after the service consumption device cancels the shielding of the target application according to the second notification information, the target application has been marked as available for the service consumption device. At this time, in order to enable the server to timely understand the adjustment status information of the service consumption device on the target application, the service consumption device can send a second response information corresponding to the second notification information to the server, and the second response information is used to inform the server and the service consumption device that the shielding of the target application has been canceled, that is, for the service consumption device, the service consumption device can send a data processing request to the server again based on the target application, thereby effectively ensuring the quality and efficiency of data processing, and enabling the server to timely perceive the status information of the service consumption device on the target application, ensuring the stability and reliability of the use of this method.
[0099] The service consumption method provided in this embodiment, when the working state of the target application provided by the server changes, receives notification information sent by the server for identifying the working state of the target application, and then adjusts the target application according to the notification information, thereby effectively realizing that when the working state of the target application is offline, the service consumption device will not send a data processing request to the server based on the target application, thereby effectively avoiding the occurrence of invalid or failed data processing requests; when the working state of the target application is online, the service consumption device can send a data processing request to the service based on the target application, thereby ensuring the quality and efficiency of data processing, further improving the practicality of the method, and facilitating market promotion and application.
[0100] Figure 5 Another service consumption method provided by the embodiment of the present invention Figure 2 Based on the above embodiments, continue to refer to the attached Figure 5 As shown, the method in this embodiment may further include:
[0101] S401: before shielding the target application according to the first notification information, sending a data processing request for the target application to a server.
[0102] S402: Receive a processing result corresponding to the data processing request sent by the server.
[0103] Specifically, before the service consumption device blocks the target application, the service consumption device can send a data processing request to the server for the target application, and when the service consumption device blocks the target application, the service consumption device will not send a data processing request to the server for the target application. It should be noted that before the service consumption device blocks the target application, the following situations may be included: a. The working state of the target application is online; b. The working state of the target application is changing from online to offline; c. The working state of the target application has been changed to offline, but the service consumption device has not blocked the target application.
[0104] When the server receives a data processing request sent by a service consumption device for a target application, in order to ensure the availability of the target application and the quality of data processing, the server can perform corresponding data processing operations through the target application and the data processing request, and can obtain a processing result corresponding to the data processing request. After obtaining the processing result, the server can send the processing result to the service consumption device, so that the service consumption device can receive the processing result corresponding to the data processing request sent by the server, thereby effectively improving the quality and reliability of data processing.
[0105] It should be noted that regardless of whether the service consumption device blocks the target application, the service consumption device can receive the information sent by the server. It is just that when the service consumption device blocks the target application, the service consumption device cannot send data processing requests to the server for the target application. When the service consumption device unblocks the target application, the service consumption device can send data processing requests to the server for the target application.
[0106] In specific application, this application embodiment provides a service provision method, the execution subjects of the service provision method include a server and a service consumption device, and when the server and the service consumption device execute the above service provision method, it can be achieved that the application (the service corresponding to the application) is as lossless as possible during the application update or offline process. Specifically, the method includes an elegant online process and an elegant offline process, wherein an elegant online process means that no request exceptions will be generated during the service application online process; an elegant offline process means that no request exceptions will be generated during the service application offline process.
[0107] Reference Figure 6 As shown in the figure, the graceful offline process includes the following steps:
[0108] Step 1: The user performs a service offline operation on the service management platform 601, and the service management platform 601 generates a control instruction to stop the service, and can send the control instruction to the server corresponding to the service provider 602;
[0109] Step 2: After receiving the control instruction, the server corresponding to the service provider 602 can perform an offline operation on the target application corresponding to the server, and actively send an offline notification to the service consumption devices corresponding to all service consumers 603 connected to the target application.
[0110] Step 3: After receiving the offline notification, the service consumption device may block the offline target application according to the offline notification.
[0111] Step 4: After shielding the offline target application according to the offline notification, the service consumption device sends response information of the offline notification to the server, and the response information is used to identify that the service consumption device has shielded the offline target application.
[0112] Step 5: For data processing requests that have reached the server, the server will wait for the data processing requests to be processed, obtain the processing results corresponding to the data processing requests, avoid request failure, and can send the processing results to the service consumption device.
[0113] Step 6: The service consumption device can receive the processing result sent by the server, that is, the service consumption device will wait for the data processing request that has arrived at the server to be processed. The shielding operation of the service consumption device on the target application is only a one-way shielding, which does not affect the response to the data processing request.
[0114] Step 7: After all in-transit data processing requests are processed, the server stops the target application.
[0115] Step 8: The server sends a notification message of successful service stop to the service management platform 601. At this time, the service consumption device will not send a data processing request based on the shielded target application.
[0116] In addition, refer to the attached Figure 7 As shown in the figure, the graceful launch process includes the following steps:
[0117] Step 11: The user performs a service launch operation on the service management platform 701, and the service management platform 701 generates a control instruction for launching the service, and can send the control instruction to the server corresponding to the service provider 702;
[0118] Step 12: After receiving the control instruction, the server can perform an online operation on the target application again, and notify the service consumption devices corresponding to all service consumers 703 to send an online notification, so that the service consumption devices can re-enable the service;
[0119] Step 13: After receiving the online notification, the service consumption device may add the target application to a preset list of available providers.
[0120] Step 14: When a new request arrives, the service consumption device may make a normal data processing request based on the target application, and may forward the data processing request to the target application.
[0121] Step 15: After adding the target application to the preset available provider list, the service consumption device may send an online notification response message to the server so that the server can know that the service consumption device has added the target application to the preset available provider list.
[0122] Step 16: The server sends a notification message of successful service launch to the service management platform 701. At this time, the service consumption device can send a data processing request based on the target application.
[0123] The service provision method provided by the present application embodiment effectively achieves: (1) By proposing a two-way communication method in the RPC framework, and based on this, the server can actively notify the service consumer device to perform a shielding operation; by actively sending a shielding notification, the subsequent data processing request of the service consumer device is prevented from reaching the server, thereby solving the problem in the prior art that when the target application is offline, there will be continuous traffic entering, resulting in the process being stopped when the request cannot be processed. (2) By actively notifying and point-to-point merging notifications, real-time and stability are ensured, thereby avoiding the situation in the prior art that the offline mechanism based on the directory service cannot be notified to the service consumer device in real time. (3) The process is fully automated and decentralized, no manual operation is required, and time and effort are saved. (4) The notification process of graceful online and offline is realized, which ensures the best effort delivery, improves the reliability of distributed services, and reduces the error rate of requests; and the graceful online and offline can be notified in real time, significantly reducing the update speed of the target application. According to existing data, the start and stop speed of the target application can be reduced from 45 seconds to 5 seconds, thereby improving the update quality and efficiency of the target application.
[0124] It should be noted that in this embodiment, the above-mentioned two-way communication mechanism may not be used to complete the service provision or service consumption method, but the service consumption device may continuously short-polling or long-polling the server to determine whether the target application (service) is available, that is, timely detecting whether the target application has been offline. When the target application is not available, the service consumption device may block the target application. When the target application is available, the service consumption device may unblock the target application. Although this method has a large performance loss, the effect is similar to that of the above-mentioned implementation process.
[0125] Figure 8 A schematic diagram of a service providing device according to an embodiment of the present invention; Figure 8As shown, this embodiment provides a service providing device, which can execute the above-mentioned service providing method. Specifically, the service providing device may include:
[0126] The acquisition module 11 is used to acquire at least one service consumption object communicating with the server when the working state of the target application provided by the server changes;
[0127] The first processing module 12 is used to send notification information for identifying the working status of the target application to the service consumer, so that the service consumer adjusts the target application according to the notification information.
[0128] Optionally, before the working state of the target application provided by the server changes, the acquisition module 11 and the first processing module 12 in this embodiment can also be used to perform the following steps:
[0129] An acquisition module 11 is used to acquire a state change instruction sent by the service management platform, where the state change instruction includes an application identifier of a target application;
[0130] The first processing module 12 is used to determine a target application corresponding to the application identifier among multiple applications, and adjust the working state of the target application based on the state change instruction.
[0131] Optionally, the state change instruction includes an application offline instruction; when the first processing module 12 adjusts the working state of the target application based on the state change instruction, the first processing module 12 can be used to execute: adjusting the working state of the target application to an offline state based on the application offline instruction.
[0132] Optionally, when the first processing module 12 sends notification information for identifying the working status of the target application to the service consumption object so that the service consumption object adjusts the target application according to the notification information, the first processing module 12 can be used to execute: sending first notification information for identifying the working status of the target application as an offline state to the service consumption object, so that the service consumption object blocks the target application according to the first notification information.
[0133] Optionally, the state change instruction includes an application online instruction; when the first processing module 12 adjusts the working state of the target application based on the state change instruction, the first processing module 12 can be used to execute: adjusting the working state of the target application to an online state based on the application online instruction.
[0134] Optionally, when the first processing module 12 sends notification information for identifying the working status of the target application to the service consumption object so that the service consumption object adjusts the target application according to the notification information, the first processing module 12 can be used to execute: sending a second notification information for identifying the working status of the target application as an online status to the service consumption object, so that the service consumption object unblocks the target application according to the second notification information.
[0135] Optionally, the first processing module 12 in this embodiment may also be used to execute: after the working state of the target application is changed, sending change feedback information of the target application to the service management platform.
[0136] Optionally, the first processing module 12 in this embodiment can also be used to execute: receiving a data processing request sent by a service consumer object to a target application; performing data processing operations based on the target application and the data processing request to obtain a processing result corresponding to the data processing request; and sending the processing result to the service consumer object.
[0137] Figure 8 The device shown can perform Figure 1-Figure 3 , Figure 6-Figure 7 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 1-Figure 3 , Figure 6-Figure 7 The implementation process and technical effects of this technical solution refer to Figure 1-Figure 3 , Figure 6-Figure 7 The description in the illustrated embodiment will not be repeated here.
[0138] In one possible design, Figure 8 The structure of the service providing device shown in the figure can be implemented as an electronic device, which can be a desktop computer, a server, or other devices. Fig. 9 As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 is used to store the electronic device to perform the above Figure 1-Figure 3 , Figure 6-Figure 7 The program of the service providing method provided in the illustrated embodiment, the first processor 21 is configured to execute the program stored in the first memory 22.
[0139] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the first processor 21, the following steps can be implemented:
[0140] When the working state of the target application provided by the server changes, obtaining at least one service consumption object communicating with the server;
[0141] Notification information for identifying the working state of the target application is sent to the service consumption object, so that the service consumption object adjusts the target application according to the notification information.
[0142] Optionally, the first processor 21 is used to execute the aforementioned Figure 1-Figure 3 , Figure 6-Figure 7 All or part of the steps in the illustrated embodiments.
[0143] The structure of the electronic device may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.
[0144] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 1-Figure 3 , Figure 6-Figure 7 The procedures involved in the service providing method in the method embodiment shown.
[0145] Fig.10 A schematic diagram of a service consumption device provided by an embodiment of the present invention; Fig.10 As shown, this embodiment provides a service consumption device, which can execute the above-mentioned service consumption method. Specifically, the service consumption device may include:
[0146] The receiving module 31 is used to receive notification information sent by the server for identifying the working state of the target application when the working state of the target application provided by the server changes;
[0147] The second processing module 32 is used to adjust the target application according to the notification information, so as to apply the application based on the adjusted target application.
[0148] Optionally, the change in the working state of the target application includes that the working state of the target application is changed to an offline state; and the notification information includes first notification information for identifying that the working state of the target application is an offline state.
[0149] Optionally, when the second processing module 32 adjusts the target application according to the notification information, the second processing module 32 may be configured to execute: shielding the target application according to the first notification information.
[0150] Optionally, after shielding the target application according to the first notification information, the second processing module 32 in this embodiment can also be used to execute: sending first response information corresponding to the first notification information to the server, the first response information is used to identify that the service consumption device has shielded the target application.
[0151] Optionally, the change in the working state of the target application includes that the working state of the target application is changed to an online state; and the notification information includes second notification information for identifying that the working state of the target application is an online state.
[0152] Optionally, when the second processing module 32 adjusts the target application according to the notification information, the second processing module 32 may be configured to execute: unblocking the target application according to the second notification information.
[0153] Optionally, after unblocking the target application according to the second notification information, the second processing module 32 in this embodiment can also be used to execute: sending a second response information corresponding to the second notification information to the server, the second response information is used to identify that the service consumption device has unblocked the target application.
[0154] Optionally, the second processing module 32 in this embodiment can also be used to execute: before shielding the target application according to the first notification information, sending a data processing request for the target application to the server; receiving a processing result corresponding to the data processing request sent by the server.
[0155] Fig.10 The service consumption device shown can execute Figure 4-Figure 7 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 4-Figure 7 The implementation process and technical effects of this technical solution refer to Figure 4-Figure 7 The description in the illustrated embodiment will not be repeated here.
[0156] In one possible design, Fig.10 The structure of the service consumption device shown can be implemented as an electronic device, which can be a mobile phone, a tablet computer, or other devices. Fig.11 As shown, the electronic device may include: a second processor 41 and a second memory 42. The second memory 42 is used to store the information that supports the electronic device to execute the above Figure 4-Figure 7 The program of the service consumption method provided in the illustrated embodiment, the second processor 41 is configured to execute the program stored in the second memory 42 .
[0157] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the second processor 41, the following steps can be implemented:
[0158] When the working state of the target application provided by the server changes, receiving notification information sent by the server for identifying the working state of the target application;
[0159] The target application is adjusted according to the notification information, so as to apply the application based on the adjusted target application.
[0160] Optionally, the second processor 41 is used to execute the aforementioned Figure 4-Figure 7 All or part of the steps in the illustrated embodiments.
[0161] The structure of the electronic device may further include a second communication interface 43 for the electronic device to communicate with other devices or a communication network.
[0162] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 4-Figure 7 The procedures involved in the service consumption method in the method embodiment shown.
[0163] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0164] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0165] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0166] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0167] These computer program instructions may also be loaded onto a computer or other programmable device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0168] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0169] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0170] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media (transitory media), such as modulated data signals and carrier waves.
[0171] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A service providing method, characterized in that: include: When the working state of the target application provided by the server changes, obtaining at least one service consumption object communicating with the server; Sending notification information for identifying the working state of the target application to the service consumption object, so that the service consumption object adjusts the target application according to the notification information; The sending notification information for identifying the working state of the target application to the service consumption object so that the service consumption object adjusts the target application according to the notification information includes: sending first notification information for identifying that the working state of the target application is an offline state to the service consumption object so that the service consumption object shields the target application according to the first notification information; Before shielding the target application according to the first notification information, receiving a data processing request sent by the service consumer object for the target application; performing a data processing operation based on the target application and the data processing request, and obtaining a processing result corresponding to the data processing request; sending the processing result to the service consumer object, wherein, for the data processing request that has reached the server, waiting for the data processing request to be processed to complete, and obtaining the processing result corresponding to the data processing request.
2. The method according to claim 1, characterized in that Before the working state of the target application provided by the server changes, the method further includes: Obtaining a state change instruction sent by a service management platform, wherein the state change instruction includes an application identifier of the target application; A target application corresponding to the application identifier is determined from among multiple applications, and a working state of the target application is adjusted based on the state change instruction.
3. The method according to claim 2, characterized in that The state change instruction includes an application offline instruction; adjusting the working state of the target application based on the state change instruction includes: The working state of the target application is adjusted to an offline state based on the application offline instruction.
4. The method according to claim 2, characterized in that: The state change instruction includes an application online instruction; adjusting the working state of the target application based on the state change instruction includes: The working state of the target application is adjusted to an online state based on the application online instruction.
5. The method according to claim 4, characterized in that Sending notification information for identifying the working state of the target application to the service consumption object so that the service consumption object adjusts the target application according to the notification information includes: Second notification information for identifying that the working state of the target application is an online state is sent to the service consumption object, so that the service consumption object cancels blocking of the target application according to the second notification information.
6. The method according to any one of claims 2 to 5, characterized in that: The method further comprises: After the working state of the target application changes, change feedback information of the target application is sent to the service management platform.
7. A service consumption method, characterized in that: include: When the working state of the target application provided by the server changes, receiving notification information sent by the server for identifying the working state of the target application; Adjusting the target application according to the notification information, so as to apply the application based on the adjusted target application; The change in the working state of the target application includes the change in the working state of the target application to an offline state; the notification information includes first notification information for identifying that the working state of the target application is an offline state; and the adjusting the target application according to the notification information includes: shielding the target application according to the first notification information; Before shielding the target application according to the first notification information, send a data processing request for the target application to the server; receive a processing result corresponding to the data processing request sent by the server, wherein, for the data processing request that has reached the server, wait for the data processing request to be processed and receive the processing result corresponding to the data processing request.
8. The method according to claim 7, characterized in that After shielding the target application according to the first notification information, the method further includes: Sending first response information corresponding to the first notification information to the server, where the first response information is used to identify that the service consumption device has blocked the target application.
9. The method according to claim 7, characterized in that: The change in the working state of the target application includes that the working state of the target application is changed to an online state; and the notification information includes second notification information for identifying that the working state of the target application is an online state.
10. The method according to claim 9, characterized in that Adjusting the target application according to the notification information includes: The target application is unblocked according to the second notification information.
11. The method according to claim 10, characterized in that After unblocking the target application according to the second notification information, the method further includes: Second response information corresponding to the second notification information is sent to the server, where the second response information is used to indicate that the service consumption device has unblocked the target application.
12. A service providing device, characterized in that: include: an acquisition module, configured to acquire at least one service consumption object communicating with the server when the working state of the target application provided by the server changes; a first processing module, configured to send notification information for identifying the working state of the target application to the service consumption object, so that the service consumption object adjusts the target application according to the notification information, and specifically to send first notification information for identifying that the working state of the target application is an offline state to the service consumption object, so that the service consumption object shields the target application according to the first notification information, and before shielding the target application according to the first notification information, receive a data processing request sent by the service consumption object for the target application; Perform data processing operations based on the target application and the data processing request to obtain a processing result corresponding to the data processing request; send the processing result to the service consumer object, wherein, for the data processing request that has reached the server, wait for the data processing request to be processed and obtain the processing result corresponding to the data processing request.
13. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein when the one or more computer instructions are executed by the processor, the service providing method as described in any one of claims 1 to 6 is implemented.
14. A service consumption device, characterized in that: include: A receiving module, used for receiving notification information sent by the server for identifying the working state of the target application when the working state of the target application provided by the server changes; A second processing module is used to adjust the target application according to the notification information, wherein the change in the working state of the target application includes that the working state of the target application is changed to an offline state; the notification information includes first notification information used to identify that the working state of the target application is an offline state; the adjustment of the target application according to the notification information includes: shielding the target application according to the first notification information, and before shielding the target application according to the first notification information, sending a data processing request for the target application to a server; receiving a processing result corresponding to the data processing request sent by the server, wherein, for the data processing request that has arrived at the server, waiting for the data processing request to be processed, and receiving the processing result corresponding to the data processing request.
15. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein when the one or more computer instructions are executed by the processor, the service consumption method as described in any one of claims 7 to 11 is implemented.
