Service subscription method and device, medium and program product

By introducing an active subscription mechanism into the microservice architecture, generating a service list and obtaining configuration information when actively subscribing to the interface, the problem of non-core but inappropriate subscription timing in the existing technology is solved, and the system's response speed and resource utilization are improved.

CN120455525APending Publication Date: 2025-08-08INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510802372.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the existing microservice architecture, the service subscription method is mainly static subscription, and it is difficult to achieve appropriate subscription opportunities on non-core but more important services, resulting in a degradation of application performance.

Method used

It provides a service active subscription solution, generates a service list through the microservice framework, and obtains subscription configuration information based on the service list when the application's active subscription interface is called, realizing active subscription to non-core but important services, and is compatible with the existing subscription mode at startup and first call.

Benefits of technology

It improves the flexibility of service subscription in the microservice architecture, reduces the latency of service calls, improves system response speed and resource utilization, and reduces unnecessary network communication and computing overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120455525A_ABST
    Figure CN120455525A_ABST
Patent Text Reader

Abstract

The invention discloses a service subscription method and device, a medium and a program product. The method relates to the field of distributed technologies, and comprises the following steps: when an application is started, generating a service list of the application through a micro-service framework; after an active subscription interface of the application is called to trigger subscription of the first service, obtaining subscription configuration information of the first service through the active subscription interface according to the service list; and subscribing the first service according to the subscription configuration information of the first service through the micro-service framework. By adopting the technical scheme, an active service subscription scheme is provided, and an active subscription interface can be provided for relatively important services in the application, so that the master control end can actively call the services as required, and the flexibility of service subscription in the micro-service architecture is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed technology, and in particular to a service subscription method, device, medium and program product. Background Art

[0002] Service subscription refers to the process in which a service consumer expresses interest in a service to a service provider or service registry and receives relevant information about the service. After the subscription is completed, the service consumer can establish a connection with the service provider and communicate.

[0003] Currently, the existing service subscription methods in the microservice architecture are: automatic subscription for core services when the application starts, and automatic subscription for edge services when the service is called for the first time.

[0004] Whether it is automatic subscription when the application starts or automatic subscription when the service is first called, both are static subscription methods pre-set in the configuration file, which has certain limitations. Using the existing subscription method, it is difficult to allocate appropriate subscription timing for those non-core but more important services. Summary of the Invention

[0005] The present invention provides a service subscription method, device, medium and program product, and provides an active service subscription solution, which can provide an active subscription interface for more important services in an application, so that the main control end can actively call the service as needed, thereby improving the flexibility of service subscription in the microservice architecture.

[0006] According to one aspect of the present invention, a service subscription method is provided, comprising:

[0007] When the application starts, the microservice framework generates a service list for the application;

[0008] After the active subscription interface of the application is called to trigger subscription to the first service, obtaining subscription configuration information of the first service according to the service list through the active subscription interface;

[0009] Through the microservice framework, subscribe to the first service according to the subscription configuration information of the first service.

[0010] Optionally, use the microservices framework to generate a service list for the application, including:

[0011] Through the microservice framework, scan the application configuration file, identify the services that need to be subscribed, and obtain key information about each service;

[0012] Through the microservice framework, a service list is established in the global cache, and key information of each service is stored in the service list.

[0013] The advantage of this setting is that the microservice framework can automatically discover available service instances and store the service list in the global cache, avoiding querying the registration center for each call, which can achieve fast access and significantly reduce the latency of service calls.

[0014] Optionally, the service list includes subscription modes for various services that need to be subscribed to in the application;

[0015] Among them, the subscription mode includes subscription at startup, subscription when the service is first called, and active trigger subscription. The subscription mode of the first service is active trigger subscription.

[0016] The advantage of this setting is that the active subscription mechanism can be used as a third subscription mode, coexisting with the traditional subscription at startup and subscription when the service is first called, providing developers with more options to control the timing of subscriptions. In addition, developers can flexibly modify the calling mode of each service in the configuration file according to business needs, thereby improving system flexibility and responsiveness.

[0017] Optionally, the service subscription method also includes:

[0018] Through the microservice framework, every time a service subscription is completed, the subscription status of the service is updated in the service list and a subscription log is generated.

[0019] The advantage of this setting is that the generated subscription logs can be returned to the developer, so that the developer can track and debug the application based on the subscription logs, help the developer monitor the subscription status, and be able to promptly discover and resolve subscription problems.

[0020] Optionally, after generating the application service list through the microservice framework, the following is also included:

[0021] Using the microservice framework, determine the second service in the service list and obtain subscription configuration information for the second service; wherein the subscription mode of the second service is subscription at startup;

[0022] Through the microservice framework, subscribe to the second service according to the subscription configuration information of the second service.

[0023] The advantage of this setting is that it can automatically subscribe to the core service when it starts through the microservice framework, avoid failures caused by missing dependencies at runtime and dynamic subscription delays when the core service is first called, and improve the reliability, observability and operation and maintenance efficiency of the system.

[0024] Optionally, after subscribing to the second service according to the subscription configuration information of the second service through the microservice framework, the method further includes:

[0025] Through the active subscription interface, when it is determined according to the service list that the second service has completed subscription, the main control end is notified that the active subscription conditions are met, so that the main control end can call the active subscription interface to subscribe to the first service when it determines that the active subscription conditions are met.

[0026] The advantage of this setting is that after the subscription of each service subscribed at startup is completed, the main control end can actively initiate the subscription of the first service in the idle time before the subscription of each service subscribed at the first call of the service, which can make effective use of the idle time and can pre-subscribe to non-core but more important services before the first call, so that when the first service is called, it can respond quickly and improve the service response efficiency.

[0027] Optionally, after the active subscription interface of the application is called to trigger subscription to the first service, obtaining subscription configuration information of the first service according to the service list through the active subscription interface includes:

[0028] After the active subscription interface of the application is called to trigger the subscription of the first service, the service subscription status of the third service is obtained in the service list through the active subscription interface; wherein the subscription mode of the third service is subscription when the service is first called;

[0029] Through the active subscription interface, when it is determined that the microservice framework is currently in an idle period according to the service subscription status of the third service, the subscription configuration information of the first service is obtained in the service list according to the identifier of the first service.

[0030] The advantage of this setting is that it can ensure that the subscription to the first service does not affect the subscription of other services in the application. In the idle period between the completion of the subscription of the second service and the start of the subscription of the third service, the first service is actively subscribed, which effectively improves the system's response speed and resource utilization, while reducing unnecessary network communication and computing overhead.

[0031] According to another aspect of the present invention, an electronic device is provided, comprising:

[0032] at least one processor; and

[0033] a memory communicatively connected to the at least one processor; wherein,

[0034] The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can execute the service subscription method described in any embodiment of the present invention.

[0035] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the service subscription method described in any embodiment of the present invention when executed.

[0036] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the service subscription method according to any embodiment of the present invention is implemented.

[0037] The technical solution of the embodiment of the present invention can avoid querying the registration center for each call by generating a service list of the application through the microservice framework when the application is started, and can achieve fast access and significantly reduce the delay of service calls. After the active subscription interface of the application is called to trigger the subscription of the first service, the subscription configuration information of the first service is obtained according to the service list through the active subscription interface, and the first service is subscribed to according to the subscription configuration information of the first service through the microservice framework. This can effectively utilize idle time and pre-subscribe to non-core but more important services before the first call, so that when the first service is called, it can respond quickly, effectively improving the response speed and resource utilization of the system, while reducing unnecessary network communication and computing overhead.

[0038] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0040] Figure 1 This is a flowchart of a service subscription method provided according to the first embodiment of the present invention;

[0041] Figure 2 is a flowchart of another service subscription method provided according to the second embodiment of the present invention;

[0042] Figure 3 This is a structural diagram of a service subscription device provided according to Embodiment 3 of the present invention;

[0043] Figure 4It is a structural diagram of an electronic device for implementing the service subscription method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions 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 embodiments described are only 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 making creative efforts should fall within the scope of protection of the present invention.

[0045] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0046] Example 1

[0047] Figure 1 This is a flow chart of a service subscription method provided in the first embodiment of the present invention. This embodiment is applicable to the case of actively subscribing to some services in an application. The method can be executed by a service subscription device, which can be implemented in the form of hardware and / or software and can generally be configured in a computer or processor with data processing capabilities. Figure 1 As shown, the method includes:

[0048] S110. When the application starts, a service list of the application is generated through the microservice framework.

[0049] The service list generated by the microservice framework can include:

[0050] Through the microservice framework, scan the application configuration file, identify the services that need to be subscribed, and obtain key information about each service;

[0051] Through the microservice framework, a service list is established in the global cache, and key information of each service is stored in the service list.

[0052] Alternatively, a microservices architecture is a method of designing a single application as a set of small services. Each service runs in its own independent process and communicates with other services through lightweight communication mechanisms. Each service is built around a specific business function and can be independently deployed, expanded, and maintained. The microservices framework is the infrastructure for building and managing the microservices architecture, which can provide service registration and discovery, load balancing, configuration management and other functions.

[0053] Optionally, the service list may include key information of each microservice that needs to be subscribed, including but not limited to metadata such as service name, version number, access address, subscription parameters, etc. The service list may be stored in a global cache, which may refer to a globally accessible data structure.

[0054] Optionally, a configuration file may refer to a file containing microservice dependencies and configuration information, and the configuration file may be proactively configured by the application developer.

[0055] Optionally, use the microservices framework to scan the application configuration file, identify the services that need to be subscribed, and obtain key information about each service, which can include:

[0056] Through the microservice framework, the subscription parameters of each service are obtained in the configuration file, the services that need to be subscribed are determined based on the subscription parameters, and the key information of each service is obtained.

[0057] Optionally, a service list is created in a global cache through a microservice framework, and key information of each service is stored in the service list, which may include:

[0058] The service name and version number are combined as the service identifier, and each key information of the service and the service identifier are stored in the service list in correspondence.

[0059] Optionally, it may also include: monitoring the configuration file change events in real time through the microservice framework, and updating the service list according to the change information after determining that the configuration file has been changed.

[0060] The advantage of this setting is that the microservice framework can automatically discover available service instances and store the service list in the global cache, avoiding querying the registration center for each call, which can achieve fast access and significantly reduce the latency of service calls.

[0061] The service list includes subscription modes for various services that need to be subscribed in the application;

[0062] Among them, the subscription mode includes subscription at startup, subscription when the service is first called, and active trigger subscription. The subscription mode of the first service is active trigger subscription.

[0063] Optionally, the subscription mode of the service can be pre-specified in the subscription parameter in the configuration file, and the microservice architecture can maintain a service list based on the subscription mode of each service in the configuration file.

[0064] Optionally, if the subscription mode of the service is Subscribe at startup, the microservice framework automatically subscribes to the service when the application starts successfully; if the subscription mode of the service is Subscribe at first call, the microservice framework automatically subscribes to the service when a transaction for the service arrives.

[0065] It is understandable that subscription at startup and subscription when the service is first called are both pre-specified subscription modes and are static subscriptions. These two subscription modes can only be subscribed when the specified conditions are met, and the subscription time cannot be flexibly configured.

[0066] The inventors of this application took into consideration that for those non-core but more important services, if they are subscribed to at startup, it will consume a lot of startup time and reduce application performance. Moreover, these services are different from edge services, which may not be subscribed from the beginning to the end. However, non-core but more important services have a high probability of initiating subscription. If they are all subscribed to when the service is called for the first time, the application performance will also be reduced. Therefore, the inventors of this application creatively proposed an active subscription solution. By providing an active subscription interface, non-core but more important services can be actively called according to demand, and subscription is completed in advance before these services are called for the first time, thereby improving application performance.

[0067] The advantage of this setting is that it is compatible with the existing technology of automatically subscribing to core services when the application starts, and automatically subscribing to edge services when the service is first called, ensuring that core services are at the top of the subscription list. It can also provide active triggering of subscription functions for non-core but more important services, so that non-core but more important services can be pre-subscribed before the first call, while ensuring application performance.

[0068] After generating the application service list through the microservice framework, it can also include:

[0069] Using the microservice framework, determine the second service in the service list and obtain subscription configuration information for the second service; wherein the subscription mode of the second service is subscription at startup;

[0070] Through the microservice framework, subscribe to the second service according to the subscription configuration information of the second service.

[0071] Optionally, the subscription configuration information can be used to indicate how the service is called, and may include but is not limited to timeout period, retry policy, circuit breaker threshold, authentication method, access credentials, encryption requirements and other information. This is only an example and does not limit the specific content of the subscription configuration information.

[0072] Optionally, the microservice framework can determine the second service by accessing the subscription mode of each service in the service list. The service list can also include the subscription status of each service. After the service completes the subscription, the subscription status of the service can be updated through the microservice framework.

[0073] The advantage of this setting is that it can automatically subscribe to the core service when it starts through the microservice framework, avoid failures caused by missing dependencies at runtime and dynamic subscription delays when the core service is first called, and improve the reliability, observability and operation and maintenance efficiency of the system.

[0074] After subscribing to the second service according to the subscription configuration information of the second service through the microservice framework, the following steps may also be included:

[0075] Through the active subscription interface, when it is determined according to the service list that the second service has completed subscription, the main control end is notified that the active subscription conditions are met, so that the main control end can call the active subscription interface to subscribe to the first service when it determines that the active subscription conditions are met.

[0076] Optionally, the service list can be accessed through the active subscription interface. When the subscription mode is determined according to the service list and all second services subscribed to at startup are completed, the main control end can be notified that the active subscription conditions are met so that the main control end can call the active subscription interface to initiate a subscription for the first service.

[0077] Optionally, the control end may refer to an application developer, and the application developer may initiate a subscription to the first service by actively calling an active subscription interface.

[0078] The advantage of this setting is that after the subscription of each service subscribed at startup is completed, the main control end can actively initiate the subscription of the first service in the idle time before the subscription of each service subscribed at the first call of the service, which can make effective use of the idle time and can pre-subscribe to non-core but more important services before the first call, so that when the first service is called, it can respond quickly and improve the service response efficiency.

[0079] S120: After the active subscription interface of the application is called to trigger subscription to the first service, obtain subscription configuration information of the first service according to the service list through the active subscription interface.

[0080] Optionally, the active subscription interface may be an application program interface pre-designed by an application developer for an application. The active subscription interface may respond to a call from the master control end, ie, the developer.

[0081] After the active subscription interface of the application is called to trigger subscription to the first service, obtaining subscription configuration information of the first service according to the service list through the active subscription interface may include:

[0082] After the active subscription interface of the application is called to trigger the subscription of the first service, the service subscription status of the third service is obtained in the service list through the active subscription interface; wherein the subscription mode of the third service is subscription when the service is first called;

[0083] Through the active subscription interface, when it is determined that the microservice framework is currently in an idle period according to the service subscription status of the third service, the subscription configuration information of the first service is obtained in the service list according to the identifier of the first service.

[0084] Optionally, in order to ensure that the subscription to the first service does not affect the subscription to other services in the application, it is necessary to check the subscription status of the third service after the subscription to the second service is completed. When it is determined that the subscription to the second service is completed and the subscription to the third service has not started, and it is determined that the microservice framework is currently in an idle period, the subscription configuration information of the first service is obtained in the service list based on the identifier of the first service.

[0085] Optionally, when the control end calls the active subscription interface to trigger subscription of the first service, the identifier of the first service to be subscribed is sent to the active subscription interface as an interface parameter. The identifier of the first service can be generated by combining the name and version number of the first service.

[0086] The advantage of this setting is that it can ensure that the subscription to the first service does not affect the subscription of other services in the application. In the idle period between the completion of the subscription of the second service and the start of the subscription of the third service, the first service is actively subscribed, which effectively improves the system's response speed and resource utilization, while reducing unnecessary network communication and computing overhead.

[0087] Optionally, acquiring the subscription configuration information of the first service in the service list according to the identifier of the first service may include: if the identifier of the first service is recognized in the service list, acquiring the subscription configuration information of the first service in the service list.

[0088] Optionally, the active subscription interface and the microservice framework are both software infrastructure in the microservice architecture. Therefore, after the active subscription interface obtains the subscription configuration information of the first service, the microservice framework in the system can directly obtain the subscription configuration information of the first service.

[0089] S130. Subscribe to the first service according to the subscription configuration information of the first service through the microservice framework.

[0090] Optionally, subscribing to the first service according to the subscription configuration information of the first service through the microservice framework may include: parsing the subscription configuration information of the first service through the microservice framework, obtaining information such as service identification, connection parameters, authentication credentials, quality assurance parameters and monitoring indicators, and verifying the integrity and validity of the subscription configuration information; obtaining a list of available instances of the first service from the service registration center, evaluating the health status of the instances and filtering out unhealthy instances; creating a connection pool based on the configuration, configuring the load balancing strategy and security context, and establishing a communication channel with the first service.

[0091] Optionally, the microservice framework can support concurrent subscriptions to improve subscription efficiency.

[0092] The service subscription method may further include:

[0093] Through the microservice framework, every time a service subscription is completed, the subscription status of the service is updated in the service list and a subscription log is generated.

[0094] Optionally, the subscription log may include but is not limited to the receipt time, processing time, and subscription result of the subscription request. After being generated, the subscription log may be returned to the master control end, that is, to the application developer, so that the developer can track and debug the application.

[0095] The advantage of this setting is that the generated subscription logs can be returned to the developer, so that the developer can track and debug the application based on the subscription logs, help the developer monitor the subscription status, and be able to promptly discover and resolve subscription problems.

[0096] The technical solution of the embodiment of the present invention can avoid querying the registration center for each call by generating a service list of the application through the microservice framework when the application is started, and can achieve fast access and significantly reduce the delay of service calls. After the active subscription interface of the application is called to trigger the subscription of the first service, the subscription configuration information of the first service is obtained according to the service list through the active subscription interface, and the first service is subscribed to according to the subscription configuration information of the first service through the microservice framework. This can effectively utilize idle time and pre-subscribe to non-core but more important services before the first call, so that when the first service is called, it can respond quickly, effectively improving the response speed and resource utilization of the system, while reducing unnecessary network communication and computing overhead.

[0097] Example 2

[0098] Figure 2This is a flow chart of a service subscription method provided by the second embodiment of the present invention. This embodiment specifically illustrates the service subscription method based on the above embodiment. Figure 2 As shown, the method includes:

[0099] S210. When the application starts, the microservice framework scans the application configuration file, identifies the services that need to be subscribed, and obtains key information of each service.

[0100] Optionally, application developers can flexibly modify the calling mode of each service in the configuration file according to business needs.

[0101] S220. Through the microservice framework, a service list is established in the global cache, and key information of each service is stored in the service list.

[0102] S230. Determine the second service in the service list through the microservice framework, and obtain subscription configuration information of the second service.

[0103] The subscription mode of the second service is subscription at startup.

[0104] S240. Subscribe to the second service through the microservice framework according to the subscription configuration information of the second service.

[0105] S250. When it is determined according to the service list that the subscription to the second service is completed, the control terminal is notified that the active subscription condition is met through the active subscription interface, so that the control terminal can call the active subscription interface to subscribe to the first service when it determines that the active subscription condition is met.

[0106] S260: After the active subscription interface of the application is called to trigger the subscription of the first service, obtain the service subscription status of the third service in the service list through the active subscription interface.

[0107] Among them, the subscription mode of the third service is subscription when the service is called for the first time.

[0108] S270. When it is determined that the microservice framework is currently in an idle period based on the service subscription status of the third service through the active subscription interface, the subscription configuration information of the first service is obtained from the service list based on the identifier of the first service.

[0109] S280. Subscribe to the first service through the microservice framework according to the subscription configuration information of the first service.

[0110] The technical solution of the embodiment of the present invention can avoid querying the registration center for each call by generating a service list of the application through the microservice framework when the application is started, and can achieve fast access and significantly reduce the delay of service calls. After the active subscription interface of the application is called to trigger the subscription of the first service, the subscription configuration information of the first service is obtained according to the service list through the active subscription interface, and the first service is subscribed to according to the subscription configuration information of the first service through the microservice framework. This can effectively utilize idle time and pre-subscribe to non-core but more important services before the first call, so that when the first service is called, it can respond quickly, effectively improving the response speed and resource utilization of the system, while reducing unnecessary network communication and computing overhead.

[0111] Example 3

[0112] Figure 3 This is a structural diagram of a service subscription device provided by the third embodiment of the present invention. Figure 3 As shown, the apparatus includes: a service list generating module 310 , a first service subscription triggering module 320 and a first service subscription module 330 .

[0113] The service list generation module 310 is used to generate a service list of the application through the microservice framework when the application is started.

[0114] The first service subscription triggering module 320 is configured to obtain subscription configuration information of the first service according to the service list through the active subscription interface after the active subscription interface of the application is called to trigger subscription of the first service.

[0115] The first service subscription module 330 is used to subscribe to the first service according to the subscription configuration information of the first service through the microservice framework.

[0116] The technical solution of the embodiment of the present invention can avoid querying the registration center for each call by generating a service list of the application through the microservice framework when the application is started, and can achieve fast access and significantly reduce the delay of service calls. After the active subscription interface of the application is called to trigger the subscription of the first service, the subscription configuration information of the first service is obtained according to the service list through the active subscription interface, and the first service is subscribed to according to the subscription configuration information of the first service through the microservice framework. This can effectively utilize idle time and pre-subscribe to non-core but more important services before the first call, so that when the first service is called, it can respond quickly, effectively improving the response speed and resource utilization of the system, while reducing unnecessary network communication and computing overhead.

[0117] Based on the above embodiments, the service list generation module 310 can be specifically used to:

[0118] Through the microservice framework, scan the application configuration file, identify the services that need to be subscribed, and obtain key information about each service;

[0119] Through the microservice framework, a service list is established in the global cache, and key information of each service is stored in the service list.

[0120] On the basis of the above embodiments, the service list includes subscription modes of various services that need to be subscribed in the application;

[0121] Among them, the subscription mode includes subscription at startup, subscription when the service is first called, and active trigger subscription. The subscription mode of the first service is active trigger subscription.

[0122] Based on the above embodiments, a subscription status update module may be further included, which is used to:

[0123] Through the microservice framework, every time a service subscription is completed, the subscription status of the service is updated in the service list and a subscription log is generated.

[0124] Based on the above embodiments, a second service subscription module may be further included, which is used to:

[0125] Using the microservice framework, determine the second service in the service list and obtain subscription configuration information for the second service; wherein the subscription mode of the second service is subscription at startup;

[0126] Through the microservice framework, subscribe to the second service according to the subscription configuration information of the second service.

[0127] Based on the above embodiments, an active subscription notification module may be further included to:

[0128] Through the active subscription interface, when it is determined according to the service list that the second service has completed subscription, the main control end is notified that the active subscription conditions are met, so that the main control end can call the active subscription interface to subscribe to the first service when it determines that the active subscription conditions are met.

[0129] Based on the above embodiments, the first service subscription triggering module 320 may be specifically configured to:

[0130] After the active subscription interface of the application is called to trigger the subscription of the first service, the service subscription status of the third service is obtained in the service list through the active subscription interface; wherein the subscription mode of the third service is subscription when the service is first called;

[0131] Through the active subscription interface, when it is determined that the microservice framework is currently in an idle period according to the service subscription status of the third service, the subscription configuration information of the first service is obtained in the service list according to the identifier of the first service.

[0132] The service subscription device provided in the embodiment of the present invention can execute the service subscription method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0133] Example 4

[0134] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0135] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0136] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0137] The processor 11 may be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the service subscription method described in an embodiment of the present invention. That is:

[0138] When the application starts, the microservice framework generates a service list for the application;

[0139] After the active subscription interface of the application is called to trigger subscription to the first service, obtaining subscription configuration information of the first service according to the service list through the active subscription interface;

[0140] Through the microservice framework, subscribe to the first service according to the subscription configuration information of the first service.

[0141] In some embodiments, the service subscription method may be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the service subscription method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the service subscription method in any other appropriate manner (e.g., by means of firmware).

[0142] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0143] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0144] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0146] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0147] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0148] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0149] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A service subscription method, characterized in that: include: When the application starts, the microservice framework generates a service list for the application; After the active subscription interface of the application is called to trigger subscription to the first service, obtaining subscription configuration information of the first service according to the service list through the active subscription interface; Through the microservice framework, subscribe to the first service according to the subscription configuration information of the first service.

2. The method according to claim 1, characterized in that Generate a service list for the application through the microservice framework, including: Through the microservice framework, scan the application configuration file, identify the services that need to be subscribed, and obtain key information about each service; Through the microservice framework, a service list is established in the global cache, and key information of each service is stored in the service list.

3. The method according to claim 1, characterized in that The service list includes the subscription mode of each service that needs to be subscribed in the application; Among them, the subscription mode includes subscription at startup, subscription when the service is first called, and active trigger subscription. The subscription mode of the first service is active trigger subscription.

4. The method according to claim 1, wherein Also includes: Through the microservice framework, every time a service subscription is completed, the subscription status of the service is updated in the service list and a subscription log is generated.

5. The method according to claim 3, characterized in that After generating the application service list through the microservice framework, it also includes: Using the microservice framework, determine the second service in the service list and obtain subscription configuration information for the second service; wherein the subscription mode of the second service is subscription at startup; Through the microservice framework, subscribe to the second service according to the subscription configuration information of the second service.

6. The method according to claim 5, characterized in that After subscribing to the second service according to the subscription configuration information of the second service through the microservice framework, the following steps are also included: Through the active subscription interface, when it is determined according to the service list that the second service has completed subscription, the main control end is notified that the active subscription conditions are met, so that the main control end can call the active subscription interface to subscribe to the first service when it determines that the active subscription conditions are met.

7. The method according to claim 3, characterized in that After the active subscription interface of the application is called to trigger subscription of the first service, the subscription configuration information of the first service is obtained according to the service list through the active subscription interface, including: After the active subscription interface of the application is called to trigger the subscription of the first service, the service subscription status of the third service is obtained in the service list through the active subscription interface; wherein the subscription mode of the third service is subscription when the service is first called; Through the active subscription interface, when it is determined that the microservice framework is currently in an idle period according to the service subscription status of the third service, the subscription configuration information of the first service is obtained in the service list according to the identifier of the first service.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to perform the service subscription method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the service subscription method according to any one of claims 1 to 7 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the service subscription method according to any one of claims 1 to 7.