CN113590341B - Service component calling method and device, computer equipment and storage medium - Google Patents

Service component calling method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN113590341B
CN113590341B CN202111133373.2A CN202111133373A CN113590341B CN 113590341 B CN113590341 B CN 113590341B CN 202111133373 A CN202111133373 A CN 202111133373A CN 113590341 B CN113590341 B CN 113590341B
Authority
CN
China
Prior art keywords
application
target
public service
service
component
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111133373.2A
Other languages
Chinese (zh)
Other versions
CN113590341A (en
Inventor
金刚
陈鸣
张巨广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111133373.2A priority Critical patent/CN113590341B/en
Publication of CN113590341A publication Critical patent/CN113590341A/en
Application granted granted Critical
Publication of CN113590341B publication Critical patent/CN113590341B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources

Abstract

The application relates to a service component calling method, a service component calling device, a computer device, a storage medium and a computer program product. The method comprises the following steps: when a first application which is locally started needs to use a target service, sending a calling request to a first public service component which is used for providing the target service in the first application through a service interface component which corresponds to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components; determining a routing policy preset for the first application; if the first public service component is not the target public service component indicated by the routing policy, routing the calling request to a target public service component in a second application for providing the target service based on the routing policy; providing, by the target public service component, the target service to the first application. The method can save the performance resources of the terminal.

Description

Service component calling method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service component calling method, an apparatus, a computer device, a storage medium, and a computer program product.
Background
With the development of computer technology, more and more people install a wide variety of applications on computer devices to fulfill various needs, such as installing music-like applications, navigation-like applications. Different applications often need to use the same capabilities, which are referred to as common capabilities, which include, for example, account number, location, etc.
In the conventional technology, each application is completely independent, each application contains one share for the same common capacity, and the common capacity of each application is executed independently, which results in the waste of performance resources (including CPU and memory) of the computer equipment.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a service component calling method, an apparatus, a computer device, a storage medium, and a computer program product, which can save performance resources of the computer device.
A service component invocation method, the method comprising: when a first application which is locally started needs to use a target service, sending a calling request to a first public service component which is used for providing the target service in the first application through a service interface component which corresponds to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components; determining a routing policy preset for the first application; if the first public service component is not the target public service component indicated by the routing policy, routing the call request to the target public service component in a second application for providing the target service based on the routing policy; providing, by the target public service component, the target service to the first application.
A service component invocation apparatus, said apparatus comprising: a calling request sending module, configured to send a calling request to a first public service component for providing a target service in a first application through a service interface component corresponding to the target service in the first application when the first application started locally needs to use the target service; different applications installed locally are provided with respective service interface components and corresponding common service components; a routing policy determination module, configured to determine a routing policy preset for the first application; a call request routing module, configured to route, based on the routing policy, the call request to a target public service component in a second application, where the target public service component is used to provide the target service, if the first public service component is not a target public service component indicated by the routing policy; a service providing module for providing the target service to the first application through the target public service component.
In one embodiment, the invoking request routing module is further configured to determine, based on the routing policy, a public service component that provides a latest version of the target service as the target public service component; routing the invocation request to the target public service component in the second application.
In one embodiment, the call request routing module is further configured to obtain a software development kit version number corresponding to each public service component providing the target service; sequencing all public service components providing the target service based on the version number of the software development kit, and selecting the public service component with the largest version number of the software development kit as the public service component with the latest version based on the sequencing result; and determining the public service component of the latest version as a target public service component.
In an embodiment, the call request routing module is further configured to determine, based on the routing policy, a master application to which the first application belongs from among locally installed applications, and obtain a second application; the update frequency of the primary application is greater than the first application; routing the invocation request to the target public service component of the second application for providing the target service.
In an embodiment, the invoking request routing module is further configured to, if the first public service component is not the target public service component indicated by the routing policy and a second application corresponding to the target public service component is in a start state, start, by the second application, the target public service component in the second application for providing the target service; routing the invocation request to the target public service component in a second application for providing the target service.
In one embodiment, the call request routing module is further configured to start the first public service component through the first application if the first public service component is not the target public service component indicated by the routing policy and a second application corresponding to the target public service component is not started; responding to the calling request through the first public service component to provide the target service for the first application, and monitoring the second application; after monitoring that the target second application is started, stopping providing the target service for the first application through the first public service component, and starting the target public service component for providing the target service in the second application through the second application; routing the invocation request to the target public service component in a second application for providing the target service.
In an embodiment, the invoking request routing module is further configured to trigger, by the first application, a target public service component for providing the target service in a second application if the first public service component is not a target public service component indicated by the routing policy and a second application corresponding to the target public service component is not started, so that the target public service component is in a started state; and after the target public service component is in a starting state, routing the calling request to the target public service component which is used for providing the target service in a second application.
In one embodiment, the first application is obtained by locally installing a corresponding installation package; the device also comprises an installation package generating module, which is used for leading in a preset public service framework: the public service framework has a public service component for providing public services; configuring a service interface component corresponding to the public service component and corresponding to the first application in a preset public service framework to obtain a target public service framework corresponding to the first application; and generating an installation package corresponding to the first application according to the target public service framework.
In an embodiment, the installation package generating module is further configured to, when a new public service needs to be accessed in the first application and the target public service framework has a new public service component for providing the new public service, configure, in the target public service framework, a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
In an embodiment, the installation package generating module is further configured to, when a new public service needs to be accessed in the first application and the target public service framework does not have a new public service component for providing the new public service, obtain a target software development kit corresponding to the new public service; in the target public service framework, configuring a new public service component for providing the new public service based on the target software development kit, and configuring a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
In one embodiment, invoking a request routing module further for determining a second application for providing the target service based on the routing policy; calling a service communication component in the first application through a remote interface in the first application, and sending the calling request to a service management component in the second application through the service communication component; and sending the calling request to the target public service component through the service management component.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program: when a first application which is locally started needs to use a target service, sending a calling request to a first public service component which is used for providing the target service in the first application through a service interface component which corresponds to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components; determining a routing policy preset for the first application; if the first public service component is not the target public service component indicated by the routing policy, routing the call request to the target public service component in a second application for providing the target service based on the routing policy; providing, by the target public service component, the target service to the first application.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of: when a first application which is locally started needs to use a target service, sending a calling request to a first public service component which is used for providing the target service in the first application through a service interface component which corresponds to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components; determining a routing policy preset for the first application; if the first public service component is not the target public service component indicated by the routing policy, routing the call request to the target public service component in a second application for providing the target service based on the routing policy; providing, by the target public service component, the target service to the first application.
A computer program product comprising a computer program, characterized in that the computer program realizes the following steps when executed by a processor: when a first application which is locally started needs to use a target service, sending a calling request to a first public service component which is used for providing the target service in the first application through a service interface component which corresponds to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components; determining a routing policy preset for the first application; if the first public service component is not the target public service component indicated by the routing policy, routing the call request to the target public service component in a second application for providing the target service based on the routing policy; providing, by the target public service component, the target service to the first application.
When a first locally started application needs to use a target service, a calling request is sent to a first public service component used for providing the target service in the first application through a service interface component corresponding to the target service in the first application, the calling request is routed to a target public service component used for providing the target service in a second application based on a routing policy by determining the routing policy preset for the first application if the first public service component is not the target public service component indicated by the routing policy, and since different locally installed applications have respective service interface components and corresponding public service components, the serving of the public capacity can be realized through the mutual cooperation of the service interface components and the corresponding public service components, and then, the public capacity can be obtained by sending a calling request to the public service component, and the calling request can be routed to the target public service component based on the routing strategy, so that a plurality of applications share one public capacity, and the performance resource of the terminal is saved.
Drawings
FIG. 1 is a diagram of an application environment in which service components invoke methods in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for invoking a service component in one embodiment;
FIG. 3 is a schematic diagram of a presentation interface of a terminal in one embodiment;
FIG. 4 is a diagram of a target public service framework in one embodiment;
FIG. 5 is a diagram illustrating a process by which a first application interacts with a second application, in one embodiment;
FIG. 6 is a flowchart illustrating a service component invocation method in accordance with another embodiment;
FIG. 7 is a timing diagram that illustrates a service component invocation method in one embodiment;
FIG. 8 is a timing diagram of a service component invocation method in another embodiment;
FIG. 9 is a block diagram of a service component invocation means in one embodiment;
FIG. 10 is a diagram showing an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The service component calling method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 may communicate with the server 104 through a wired or wireless network. The terminal 102 includes, but is not limited to, a mobile phone, a computer, an intelligent voice interaction device, an intelligent appliance, a vehicle-mounted terminal, and the like, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers. The terminal 102 is installed with a plurality of applications, each application includes one or more service interface components and one or more common service components, the service interface components and the common service components are in one-to-one correspondence and are used for matching with common capabilities required by the applications, the one or more service interface components form a service interface component pool, and the one or more common service components form a common service component pool. Plural means at least two. Each application also comprises a service interface management component for managing the service interface component and a service management component for managing the common service component, and a routing policy is configured in advance for each application, so that when a plurality of applications are started through routing, only one common capability needs to be executed.
Referring to fig. 1, icons of applications may be displayed on an interface of a terminal, and a user may start an application locally on the terminal by clicking an icon, for example, when the user clicks the application icon 4, and needs to use a certain service after the application icon 4 is locally started, a call request may be sent to a first common service component for providing the service in the application through a service interface component corresponding to the service in the application, a routing policy for the application is determined, and if the first common service component is not a target common service component indicated by the routing policy, the call request is routed to a target common service component for providing a target service in another application based on the routing policy, and the desired service is provided to the application corresponding to the application icon 4 through the target common service component.
In an embodiment, as shown in fig. 2, a service component calling method is provided, which is described by taking the application of the method to the terminal in fig. 1 as an example, and includes the following steps:
step 202, when a first application started locally needs to use a target service, sending a call request to a first public service component for providing the target service in the first application through a service interface component corresponding to the target service in the first application; different applications installed locally have respective service interface components and corresponding common service components.
An Application (Application) refers to an Application program that can directly run on an operating system. The applications may include at least one of a social application, a file management application, a mail application, a shopping application, a payment application, an entertainment application, and a navigation application, among others. The Social application includes at least one of an instant messaging application, an SNS (Social Network Service) application, and a live application. Entertainment applications include music applications, video applications, and the like. A plurality of applications, a plurality meaning at least two, may be installed on the terminal. Different applications have respective service interface components and corresponding common service components, wherein the service interface components refer to components for realizing service interfaces. The common service component refers to a service component for providing a common service. The common service component can be regarded as a server side, the service interface component can be regarded as a client side, and the common service component and the service interface component are matched to realize the service of common capacity. The service of the public capability refers to that the public capability is provided in a service form, and after the public capability is serviced, the service can be called through an interface provided by the service to acquire the corresponding public capability, so that the multiplexing of the public capability is realized. For example, the common capability for positioning required by an application is provided in the form of a positioning service that can be invoked by a plurality of different applications, so that a common capability can be shared by a plurality of applications.
The public service refers to a service corresponding to a public capability after being served, the public capability refers to a capability commonly required by a plurality of applications on the terminal, and the public capability may include at least one of account, location and long connection with a server, for example. The public services are in one-to-one correspondence with the public capabilities, i.e. each public service implements one public capability. The first application may be any application that has been launched locally by the terminal. The target service refers to a common service that the first application needs to use.
It is understood that the state of the common service component includes an activated state or an inactivated state, and the common service component in the activated state can respond to the call request to provide the target service corresponding to the call request.
Specifically, for a first application that has been locally started by a terminal, a required common capability is determined according to a service requirement, and a target service required by the application may be configured according to the common capability corresponding to the service requirement in a development process of the application, so that after the first application is started, the terminal may determine the target service required by the first application according to a configuration file of the first application. It is to be understood that the target service that the first application needs to use may be one or more. Plural means at least two.
For each target service required to be used by the first application, the terminal sends a call request to a first public service component used for providing the target service in the first application through a service interface component corresponding to the target service in the first application, and the call request can carry a callback function corresponding to the target service as a request parameter. For example, assuming that the target service is a positioning service and the first application is a navigation application, the terminal may send a call request to a public service component for providing the navigation service in the first application through a service interface component corresponding to the positioning service in the navigation application, where the call request may carry a callback function corresponding to positioning as a request reference, and the first application may receive location information provided by the service interface component through the callback function.
It can be understood that, when a plurality of target services that the first application needs to use are available, the terminal sends a call request to the respective common service component of each target service in the first application through the service interface component corresponding to each target service. The call requests corresponding to different target services are different. For example, assuming that a target service that a first application needs to use includes a target service a, a target service B, and a target service C, the terminal sends a first call request to a public service component corresponding to the target service a in the first application through a service interface component a corresponding to the target service a, sends a second call request to a public service component corresponding to the target service B in the first application through a service interface component B corresponding to the target service B, and sends a third call request to a public service component corresponding to the target service C in the first application through a service interface component C corresponding to the target service C, where the first call request, the second call request, and the third call request are different call requests and carry different parameters.
Step 204, determining a preset routing policy for the first application.
The routing policy refers to a preconfigured routing rule. The routing policy may be configured according to specific service requirements. The routing policies may or may not be the same for each different application.
In one embodiment, the invocation request may be routed to the latest version of the common services component by configuring a routing policy. In another embodiment, the routing policy may be configured to route the invocation request to a specific application, where the specific application may be different from the first application, and then the first application is subordinate to the specific application, that is, the specific application is a master application of the first application, and the first application is a slave application of the specific application, and the specific application may also be the same as the first application, and then the first application only provides the target service through its own common service component. In another embodiment, the invocation request may be routed to the most recent version of the common service component in the plurality of primary applications by configuring a routing policy to specify the plurality of primary applications.
Specifically, for a first application, the terminal may query a routing policy preconfigured for the first application from a configuration file of the first application, so that routing of the call request may be implemented according to the routing policy.
And step 206, if the first public service component is not the target public service component indicated by the routing policy, routing the invocation request to the target public service component for providing the target service in the second application based on the routing policy.
Wherein the second application refers to an application where the target common service component is located. The second application is a different application than the first application. The target common service component refers to a common service component for providing a target service required by the first application as indicated by the routing policy.
Specifically, after determining a routing policy preconfigured for the first application, the terminal may determine a target public service component indicated by the routing policy, so as to determine whether the first public service component is the target public service component indicated by the routing policy, and if the first public service component is not the target public service component indicated by the routing policy, route the invocation request to the target public service component in the second application, which is used for providing the target service, based on the routing policy. It can be understood that, if the first common service component is the target common service component indicated by the routing policy, the terminal provides the target service required by the first application through the first common service component.
In one embodiment, the configured routing policy is used for routing the invocation request to the public service component of the latest version, then the target public service component is the public service component of the latest version providing the target service, and then the terminal may determine, by comparing update information of each public service component providing the target service in each application installed locally at the terminal, whether the first public service component in the first application is the latest updated public service component according to the update information, and if not, determine that the first public service component is not the target public service component indicated by the routing policy. The update information refers to information used for representing the update precedence relationship of the software development kit corresponding to the common service component, and the update information may be, for example, specific update time and version number.
In one embodiment, the configured routing policy is used for routing the invocation request to the master application, and then the terminal determines whether the first application is the master application, and if not, routes the invocation request to a target public service component for providing a target service in the master application. In other embodiments, when the terminal determines that the first application is not the primary application, the terminal may further compare update information of a common service component providing the target service in the primary application with update information of the first common service component, route the invocation request to the target common service component providing the target service in the primary application if the update information of the common service component providing the target service in the primary application indicates that the common service component is updated after the first common service component, and provide the target service to the first application through the first common service component if the update information of the common service component providing the target service in the primary application indicates that the common service component is updated before the first common service component.
In an embodiment, considering that the target public service component needs to be in a starting state when providing the target service, when the terminal performs routing, it may detect whether a second application where the target public service component is located is in the starting state, and if the second application is in the starting state, the target public service component is started through the second application, and the invocation request is routed to the target public service component in the second application for providing the target service. If the second application is in an un-started state and the configuration file of the second application indicates that the service component in the second application can be started only when the second application is started, the terminal may temporarily start the first public service component by the first application, provide the target service to the first application through the first public service component, stop providing the target service to the first application through the first public service component after the target public service component is in a started state, and route the invocation request to the target public service component. In other embodiments, when the second application is not started and the configuration file of the second application indicates that the service component in the second application can be started without starting the second application, the terminal may trigger the target public service component in the second application through the first application, and route the invocation request to the target public service component after the target public service component is in a starting state.
At step 208, a target service is provided to the first application through the target public service component.
Specifically, the terminal responds to the calling request through the target public service component and provides the target service for the first application. For example, assuming that the target service is a positioning service, the terminal provides real-time location information to the first application through the target public service component; assuming that the target service is a long connection service, the terminal can perform data transmission with the server through the long connection established by the target public service component; assuming that the target service is an account service, the terminal may obtain account information of the user in the second application as account information of the first application through the target public service component.
In the service component calling method, when a first locally started application needs to use a target service, a calling request is sent to a first public service component used for providing the target service in the first application through a service interface component corresponding to the target service in the first application, the calling request is routed to a target public service component used for providing the target service in a second application based on a routing policy by determining the routing policy preset for the first application if the first public service component is not the target public service component indicated by the routing policy, because different locally installed applications are provided with respective service interface components and corresponding public service components, the service interface components and the corresponding public service components are matched with each other to realize the service of the public capability, and further the public capability can be obtained by sending the calling request to the public service component, the call request can be routed to the target public service component based on the routing strategy, so that a plurality of applications share one public capability, and the performance resource of the terminal is saved.
It can be understood that, when the terminal provides the target service to the first application through the target public service component in the second application, the second application may be in a start state, at this time, a plurality of applications on the terminal run simultaneously, in the conventional technology, when the plurality of applications run simultaneously, the public capability of each application needs to be executed, and in the present application, when the plurality of applications run simultaneously, one public capability can be shared, and the performance resource of the terminal is saved.
In one embodiment, if the first common service component is not the target common service component indicated by the routing policy, routing the invocation request to the target common service component for providing the target service in the second application based on the routing policy includes: determining a public service component providing the latest version of the target service as a target public service component based on the routing strategy; the invocation request is routed to a target public service component in the second application.
Wherein the version of the common service component refers to a version of a Software Development Kit (SDK) for updating the common service component. The latest version of the common service component means that the software development kit used to update the common service component is the latest update. A software development kit is a collection of development tools used by software engineers to create application software for a particular software package, software framework, hardware platform, operating system, etc., and may simply be some files that provide application program interfaces for a certain programming language, but may also include complex hardware that can communicate with a certain embedded system, and often includes example code, supporting technical notes, or other supporting documents that clarify doubt for basic reference data.
Specifically, in this embodiment, the configured routing policy is used to route the invocation request to the public service component of the latest version, that is, the target public service component is the public service component of the latest version providing the target service, and when the terminal determines that the first public service component is not the public service component of the latest version, the public service component of the latest version providing the target service is determined as the target public service component, and the invocation request is sent to the target public service component in the second application.
In one embodiment, for each common service component providing the target service, the terminal may determine the common service component with the latest update time as the latest version of the common service component by comparing the update times of the common service components.
In the embodiment, the public service component of the latest version providing the target service is determined as the target public service component, and the call request is routed to the target public service component in the second application, so that only one application needs to be upgraded through a routing strategy, the public capacity of other applications is also upgraded, the flow is saved, and great convenience is brought to code maintenance.
In one embodiment, determining the most recent version of the common service component that provides the target service as the target common service component based on the routing policy comprises: acquiring the version number of a software development kit corresponding to each public service component providing target service; sequencing all public service components providing target services based on the version numbers of the software development kits, and selecting the public service component with the largest version number of the software development kits as the public service component with the latest version based on the sequencing result; and determining the public service component of the latest version as the target public service component.
The software development kit version number refers to a version number generated when the software development kit is subjected to iterative update release, and is an identification number of the software development tool and used for uniquely identifying the software development kit. In one embodiment, the software development kit version number may be divided into 3 segments, such as A, B, C, where a represents a large version number, and when the software development kit is rewritten or a backward incompatible change occurs, a is increased, and when a is zero, it represents that the software is still in the development phase; b represents updating of the function, B is added when a new function appears, C represents small modification, such as bug repair, and C is added as long as modification exists. For example, the software development kit version number may be 2.4.41, for example.
In one embodiment, the terminal performs descending arrangement on each public service component providing the target service based on the version number of the software development kit, that is, the public service component with the larger version number of the corresponding software development kit is arranged in front, after the arrangement is completed, the public service component arranged at the first position is the public service component with the largest version number of the software development kit, and the public service component is taken as the public service component with the latest version. When the version numbers are compared, when the version numbers are divided into a plurality of sections, the comparison is started from the first section on the left side, the larger the number of the first section on the left side is, the larger the version number is, when the number of the first section on the left side is the same, the numbers of the second section are compared, and the like. For example, assuming that three public service components are ordered, the software development kit version number of the public service component 1 is 2.2.41, the software development kit version number of the public service component 2 is 2.2.51, and the software development kit version number of the public service component 3 is 3.2.51, the public service components 3, 2, and 1 are ordered, that is, the public service component 3 is the public service component with the largest software development kit version number.
In the embodiment, by comparing the version numbers of the software development kits, the public service component providing the latest version of the target service can be accurately and quickly determined, so that the routing efficiency is improved.
In one embodiment, based on the routing policy, if the first common service component is not the target common service component indicated by the routing policy, routing the invocation request to the target common service component for providing the target service in the second application based on the routing policy includes: determining a main application to which the first application belongs from each locally-installed application based on a routing policy to obtain a second application; the update frequency of the primary application is greater than that of the first application; the invocation request is routed to a target common services component in the second application for providing the target service.
In this embodiment, a routing policy is configured to specify a master application to which a first application belongs, where the master application is an application whose update frequency is greater than that of the first application, and since the update frequency of the master application is greater than that of the first application, a version of a common service component in the master application is greater than that of the first application, a terminal may determine, based on the routing policy, the master application to which the first application belongs from each locally installed application, obtain a second application, and send a call request to a target common service component in the second application, where the target common service component is used to provide a target service.
In one embodiment, a plurality of primary applications may be configured for the first application through the routing policy, and after determining the primary applications based on the routing policy, the terminal may compare version numbers of common service components used for providing the target service in the respective primary applications, and select an application where the common service component with the latest version is located to determine as the second application. By configuring a plurality of main applications, the common service components for providing the target service in the second application can be ensured to be the latest version to the maximum extent.
In another embodiment, after the terminal determines the second application, the terminal may further compare the version number of the first common service component with the version number of the common service component for providing the target service in the second application, and route the invocation request to the target common service component in the second application only when the version number of the common service component for providing the target service in the second application is greater than the version number of the first common service component, thereby avoiding a situation that the upgrade of the main application fails and ensuring that the latest version of the common service component can be used each time.
In the embodiment, the main application is configured through the routing strategy, the call request can be directly routed to the main application, the version comparison of a plurality of common service components is avoided, and the routing efficiency is improved.
In one embodiment, if the first common service component is not the target common service component indicated by the routing policy, routing the invocation request to the target common service component for providing the target service in the second application based on the routing policy includes: if the first public service component is not the target public service component indicated by the routing policy and the second application corresponding to the target public service component is in the starting state, starting the target public service component for providing the target service in the second application through the second application; the invocation request is routed to a target common services component in the second application for providing the target service.
Specifically, when the second application is in the start state, the common service component in the second application may be started by the second application, and the process of starting the common service component is a process of initializing the common service component. Therefore, when the terminal determines that the first public service component is not the target public service component indicated by the routing policy and detects that the second application is in the starting state, the terminal can initialize the target public service component in the second application through the second application, so that the target public service component is in the starting state, and establish the connection between the target public service component and the first application, so that the call request can be sent to the target public service component through the connection.
In one embodiment, the first common service component may not be started in this embodiment because the first common service component is not the target common service component indicated by the routing policy.
In one embodiment, the second application may be launched in the foreground of the terminal after the second application is triggered by the user. In other embodiments, the second application may be in the starting state that the second application runs in the background of the terminal, for example, some applications may be automatically started after the terminal is powered on and run in the background, at this time, the second application may be considered to be in the background starting state, and for example, after the user triggers the second application to display and run for a period of time on the terminal interface, the user triggers the running of other applications again under the condition that the running process of the application is not finished, and at this time, the second application may be considered to be in the background starting state.
In the above embodiment, when the second application is in the starting state, the target public service component is started by the second application, and the call request is sent to the target public service component, so that the target public service component can be ensured to be started smoothly, and the call request can be responded by the target public service component quickly.
In one embodiment, if the first common service component is not the target common service component indicated by the routing policy, routing the invocation request to the target common service component for providing the target service in the second application based on the routing policy includes: if the first public service component is not the target public service component indicated by the routing strategy and the second application corresponding to the target public service component is not started, starting the first public service component through the first application; responding to the calling request through the first public service component to provide target service for the first application, and monitoring the second application; after monitoring that the second application is started, stopping providing the target service for the first application through the first public service component, and starting a target public service component for providing the target service in the second application through the second application; the invocation request is routed to a target common services component in the second application for providing the target service.
It is to be understood that the terminal is not capable of launching any common service component in the second application through the second application when the second application is not launched. In this embodiment, to ensure the security of the application, the second application may be configured, and when the second application is not started, the common service component in the second application may not be started by other applications, that is, only when the second application is started, the common service component in the second application may provide the corresponding service. Therefore, when the server determines that the first public service component is not the target public service component indicated by the routing policy and detects that the second application corresponding to the target public service component is not started, the server may respond to the call request through the first public service component in the first application to provide the target service to the first application, and the terminal may monitor the second application, and after it is monitored that the second application is started, may stop providing the target service to the first application through the first public service component, and initialize the target public service component through the second application, so that the target public service component is in an available state, and establish a connection between the target public service component and the first application, so that the call request may be sent to the target public service component.
In one embodiment, when the terminal detects that the second application is not started, a prompt message can be displayed on the terminal interface to prompt the user that the service provided by the common service component in the second application is to be started. For example, as shown in fig. 3, the terminal interface may display a prompt information box 302, and display a prompt information in the prompt information box 302, where the prompt information may be, for example, "detect that the XX application can provide the latest version of the location service, and whether to start the location service
Figure 275158DEST_PATH_IMAGE002
", the terminal also simultaneouslyA yes selection button 304 and a no selection button 306 may be presented, and when the user clicks the selection button 304, the terminal starts a location service component in the second application, through which location service is provided, and when the user clicks the selection button 306, continues to provide the target service to the first application through the first common service component, and listens for the start of the second application.
In the above embodiment, when the second application is not started, the first public service component responds to the call request to provide the target service to the first application, and monitors the second application, and the routing step is executed only after it is monitored that the second application is started, so that not only can the security of the application be ensured, but also the terminal can normally provide the service on the premise that the user does not trigger the start of the second application.
In one embodiment, if the first common service component is not the target common service component indicated by the routing policy, routing the invocation request to the target common service component for providing the target service in the second application based on the routing policy includes: if the first public service component is not the target public service component indicated by the routing policy and the second application corresponding to the target public service component is not started, triggering the target public service component for providing the target service in the second application through the first application; and after the target public service component is in the starting state, routing the calling request to the target public service component which is used for providing the target service in the second application.
In this embodiment, in order to ensure that the target common service component indicated by the always-routed policy for providing the service is provided, the second application may be configured, and when the second application is not started, the common service component in the second application may be passively started, that is, when the second application is not started, the terminal may trigger the common service component in the second application through another application, and initialize the common service component so that the common service component is in an available state. Therefore, when the terminal determines that the first public service component is not the target public service component indicated by the routing policy and detects that the second application corresponding to the target public service component is not started, the terminal can trigger the target public service component in the second application through the first application to initialize the target public service component, and after the target public service component is initialized successfully, the target public service component is in a starting state and can provide the target service in response to the calling request, and at the moment, the terminal can establish connection between the target public service component and the first application so as to send the calling request to the target public service component.
In the above embodiment, when it is detected that the second application corresponding to the target public service component is not started, the target public service component indicated by the routing policy is initialized, so that the target public service component is in a start state, and it can be ensured that the public service component providing the service always is the target public service component indicated by the routing policy.
In one embodiment, the first application is obtained by locally installing a corresponding installation package; the generation step of the installation package comprises the following steps: importing a preset public service framework: the public service framework has a public service component for providing public services; configuring a service interface component corresponding to the public service component and corresponding to the first application in a preset public service frame to obtain a target public service frame corresponding to the first application; and generating an installation package corresponding to the first application according to the target public service framework.
Wherein, a common service framework refers to a framework that can provide common services. The preset public service framework has a public service component for providing public services. The common service component is generated based on a preset SDK configuration. The preset SDK may be an SDK corresponding to all public services, that is, codes corresponding to all public services are packaged into one SDK. The preset SDK may also include a plurality of SDKs, that is, each public service corresponds to one SDK, and the SDK includes only a code corresponding to the public service.
The number of common service components may be one or more, and different common service components are used to provide different common services. In one embodiment, the preset public service framework may have a public service component for providing location services, a public service component for providing account services, a public service component for providing voice services, and a public service component for providing long connection services.
It is understood that, in this embodiment, the generating step of the installation package is performed in the development stage of the first application, and the generating step of the installation package may be performed by a computer device, where the computer device may be the terminal in fig. 1, or another computer device that may be used for software development.
Specifically, after the computer device imports a preset public service framework, according to the public capability required by the first application, a public service component corresponding to the required public capability can be selected, and according to callback parameter information required by the first application for the public service, a service interface component corresponding to the public service component and corresponding to the first application is configured, so that a target public service framework corresponding to the first application is obtained, and an executable file is compiled according to the target public service framework to generate and embedded into a software development package corresponding to the first application, so that an installation package corresponding to the first application is obtained.
In one embodiment, as shown in FIG. 4, the target common services framework includes three layers: the first layer is Application Shell project (Application Shell project), the second layer is Core frame layer (Core Framework), and the third layer is component Pool (Client/Service Module Pool).
Wherein, shell engineering mainly includes: application launch control (Application), UI Framework (UI Framework) and Configuration management (Configuration). The application start control is used for controlling the start of the application; the UI framework is used for developing an application UI interface; the configuration management is used for configuring each item of application and storing configuration files.
The core frame layer is divided into two parts: a service interface component management component and a service component management component. The service interface component management component comprises: service interface management (CM), inter-component communication (Event Bus) and Local interface (Local API). The service interface management is used for managing the whole life cycle of the service interface component, and comprises registering data needing monitoring to the public service component, performing anti-registration, disconnecting service and the like. The inter-component communication is a communication mode for associating a home page with a trigger source, for example, when an application is switched from a background to a foreground, the home page sends an Event (Event), and a module which is concerned to be applied to the background is registered, so that corresponding logic can be processed. The local interface is used for connecting the page module local to the application and the service interface component.
The service component management component comprises: a Remote interface (Remote API), a Service communication component (SM) and a Service management component. Wherein the remote interface is used for realizing the connection between the service interface component and the public service component. The service management component is used for managing the common service component, such as the creation, initialization and the like of the common service component. The service communication component is used for managing services, including connecting services, disconnecting services, and the like.
The component pool is divided into two types: a service interface component and a common service component. The service interface component realizes a service interface and serves as a client of the public service component. The public service component provides services and serves as a service end of the service interface component.
It can be understood that, when selecting the common service component configuration service interface component corresponding to the required common capability, the corresponding service interface component may be configured for all the common service components, or the corresponding service interface component may be configured for part of the common service components, which is specifically determined according to the service requirement.
It will also be appreciated that since the callback information expected by different applications when calling the same common service component is not necessarily the same, the service interface components corresponding to the same common service component are not necessarily the same for different applications. For example, both application a and application B need to call a location service component, but application a desires to obtain GPS (Global Positioning System) status, address information, etc. from the location service, but application B may only need current location information, so the incoming request parameters are different when application a and application B call the location service component, and the service interface component of application a corresponding to the location service is obviously more complex than that of application B.
In the above embodiment, by importing the preset public service framework, since the preset public service framework has the public service component for providing the public service, only the service interface component corresponding to the public service component and corresponding to the first application needs to be configured to obtain the target public service framework corresponding to the first application, and the installation package corresponding to the first application is generated according to the target public service framework, so that the public service of the public service framework can be accessed quickly.
In one embodiment, after generating an installation package corresponding to the first application according to the target public service framework, the method further includes: when a new public service needs to be accessed in the first application and a target public service framework has a new public service component for providing the new public service, configuring a service interface component corresponding to the new public service component in the target public service framework to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
Wherein, the new public service refers to a public service which is not accessed by the first application in the development process. The new common service component refers to a common service component for providing a new common service.
In this embodiment, the first application does not access all public services in the development process, and a new public service can be accessed by upgrading the installation package. Specifically, in the target public service framework, a service interface component corresponding to the new public service component is configured to obtain an updated target public service framework, the installation package is updated according to the updated target public service framework, so that the new public service is accessed, and the first application can use the new public service by installing the updated installation package.
In the embodiment, the service interface component corresponding to the new public service component is configured in the target public service framework to obtain the updated target public service framework, and the installation package is updated according to the updated target public service framework, so that the new public service can be accessed quickly, and the public service can be customized and expanded flexibly according to different service requirements.
In one embodiment, after generating an installation package corresponding to the first application according to the target public service framework, the method further includes: when a new public service needs to be accessed in the first application and a target public service framework does not have a new public service component for providing the new public service, acquiring a target software development kit corresponding to the new public service; in the target public service framework, configuring a new public service component for providing new public service based on a target software development kit, and configuring a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
In this embodiment, in the upgrade process, the first application expects to access the new public service, and the target public service framework does not have a new public service component for providing the new public service, so the new public service cannot be accessed through the current target public service framework, and then a target software development kit corresponding to the new public service can be obtained.
In the embodiment, the target software development kit corresponding to the new public service is obtained, the new public service component and the service interface component can be conveniently and quickly configured in the target public service framework through the target software development kit, the installation package is updated according to the updated target public service framework, and the new public service can be quickly accessed, so that the public service can be flexibly customized and expanded according to different service requirements.
In one embodiment, routing the invocation request to a target common services component in the second application for providing the target service based on the routing policy includes: determining a second application for providing the target service based on the routing policy; calling a service communication component in the first application through a remote interface in the first application, and sending a calling request to a service management component in the second application through the service communication component; the invocation request is sent to the target public service component by the service management component.
The service communication component is used for managing services, including connecting services, disconnecting services and the like. Specifically, in the process of connecting the service, the service communication component may manage the call request, and determine the service management component to be sent by the call request. The service management component is used for managing the public service components in the public service component pool, determining a target public service component corresponding to the calling request and sending the calling request to the target public service component.
In one embodiment, the terminal may determine, based on the routing policy, an application in which the latest version of the common service component is located as a second application, call a service communication component in the first application through a remote interface in the first application, send a call request to a service management component in the second application through the service communication component, and send the call request to a target common service component through the service management component, so that the call request is successfully routed to the target common service component.
In another embodiment, the terminal may determine, based on the routing policy, a primary application of the first application configured in the routing policy as a second application, call a service communication component in the first application through a remote interface in the first application, send a call request to a service management component in the second application through the service communication component, and send the call request to the target public service component through the service management component, thereby successfully routing the call request to the target public service component.
Fig. 5 is a schematic diagram illustrating a process of a first application interacting with a second application in one embodiment. Referring to fig. 5, a dotted line in fig. 5 shows an interaction process, after determining a second application for providing a target service based on a routing policy, the terminal invokes a service communication component in the first application through a remote interface in the first application, sends an invocation request to a service management component in the second application through the service communication component, determines a target common service component from a common service component pool through the service management component, and finally sends the invocation request to the target common service component.
In the above embodiment, the interaction between the applications is realized by setting the remote interface, the service communication component and the service management component, so that the call request can be accurately routed.
In one embodiment, as shown in FIG. 6, there is provided a service component invocation method, comprising the steps of:
step 602, when the first application started locally needs to use the target service, a call request is sent to a first public service component for providing the target service in the first application through a service interface component corresponding to the target service in the first application.
Different applications installed locally have respective service interface components and corresponding common service components.
Step 604, a routing policy preset for the first application is determined.
Step 606, based on the preset routing policy, obtaining the version number of the software development kit corresponding to each public service component providing the target service.
And 608, sequencing all the public service components providing the target service based on the version number of the software development kit, and selecting the public service component with the maximum version number of the software development kit as the public service component with the latest version based on the sequencing result.
Step 610, determining the public service component of the latest version as the target public service component.
Step 612, judging whether the first public service component is a target public service component, if not, executing step 614; if yes, go to step 618.
And step 614, calling the service communication component in the first application through the remote interface in the first application, and sending the calling request to the service management component in the second application through the service communication component.
Step 616, the call request is sent to the target public service component in the second application through the service management component in the second application.
Step 618, the service communication component in the first application is called through the remote interface in the first application, and the calling request is sent to the service management component in the first application through the service communication component.
Step 620, sending the call request to the first common service component through the service management component in the first application.
In the embodiment, the calling request is routed to the public service component of the latest version, so that the common service component is shared when a plurality of applications are all in the starting state, the terminal only needs to execute one public capability, the performance resources of the terminal are greatly saved, meanwhile, as the service is provided by the public service component of the latest version, only one application needs to be upgraded, the public capabilities of other applications are also upgraded, the flow is saved, and great convenience is brought to code maintenance.
The application also provides an application scene, and the application scene applies the service component calling method. In the application scenario, the terminal is a vehicle-mounted terminal. Under the concept of the internet of things, the internet of vehicles gradually appears in the visual field of people, and the vehicle-mounted application also obtains explosive growth, but because of the requirement of reliability, the performance of the vehicle-mounted terminal is generally far lower than that of a mobile phone in the same period, and how to save vehicle performance resources and flow has important practical significance. By multiplexing the common modules and the capabilities among the applications, the method and the device can greatly save the performance resources of the vehicle with captured elbows. Specifically, the service component calling method is applied to the application scenario as follows:
the method includes the steps that a plurality of applications are installed on the vehicle-mounted terminal, wherein the applications comprise an application A and an application B, the application B is a master application of the application A, and the application A is a slave application of the application B. The update frequency of application B is much greater than application a. Application A is obtained by locally installing an installation package of application A, application B is obtained by locally installing an installation package of application B, and application B is configured to: in the case where application B is not started, the common service component in application B cannot be started by other applications. The installation package of the application A is generated through the following steps:
1. importing a preset public service framework: the public service framework has a public service component for providing public services;
2. configuring a service interface component corresponding to the public service component and corresponding to the application A in a preset public service framework to obtain a target public service framework corresponding to the application A;
3. and generating an installation package of the application A according to the target public service framework.
It is to be understood that, the step of generating the installation package of the application B may refer to the application a, which is not described herein in detail.
Taking the target service required to be used by the application a as the positioning service as an example, the specific implementation steps of the service component calling method under two different conditions are respectively described.
The first condition is as follows: the application B is started before the application a, the version of the location service component in the application B is higher, and the application B is closed first, referring to fig. 7, specifically including the following steps:
in step 702, application B starts.
Step 704, the application B inquires that there is no location service, and starts the location service component in the application B.
Step 706, the location service component in application B provides a location callback.
At step 708, application B continues to receive the location of the location service component callback.
At step 710, application A starts.
At step 712, application A detects that there is already a location services component started locally.
Step 714, obtain the version number corresponding to the location service component of application B.
In step 716, application B returns the version number corresponding to the location service component to application a.
In step 718, after the application a compares the version number of the location service component of the application a with the version number of the location service component of the application a, it determines that the version number of the location service component in the application B is higher.
The version number of the positioning service component refers to the version number of the software development kit corresponding to the positioning service component.
Step 720, application a connects to the location services component in application B.
In step 722, the location service component in application a and application B are successfully connected.
In step 724, the location service component in application B updates the callback list and provides location callbacks to application a and application B.
At step 726, application a and application B continue to receive location callbacks.
At step 728, the application B closes,
at step 730, application B disconnects from the location services component.
In step 732, the location service component in application B updates the callback list and continues to provide location callbacks to application a.
At step 734, application A continues to receive location callbacks.
Case two: the application B is started before the application a, the version of the location service component in the application B is higher, and the application B is closed first, referring to fig. 8, specifically including the following steps:
at step 802, application A starts.
And step 804, detecting that no other positioning service component exists in the application A, and starting the positioning service component in the application A.
At step 806, the location service component in application a provides a location callback to application a.
At step 808, application A continues to receive location callbacks.
At step 810, application B starts.
At step 812, application B starts the location services component in application B.
In step 814, the application B detects that there are other location service components started, and notifies the location service component in the application a.
At step 816, the location service component of application B provides a location callback to application B.
At step 818, application B continues to receive location callbacks.
Step 820, the application a obtains a version number corresponding to the location service component in the application B.
Step 822, the application B returns the version number corresponding to the location service component to the application a.
Step 824, after the application a compares the version number of the location service component of the application a with the version number of the location service component of the application a, it determines that the version number corresponding to the location service component of the application B is higher.
The version number of the positioning service component refers to the version number of the software development kit corresponding to the positioning service component.
At step 826, application A closes the location services component.
At step 828, application a connects to the location services component in application B.
In step 830, the location service components in application a and application B are successfully connected.
At step 832, the location services component in application B updates the callback list while providing location callbacks to application a and application B.
At step 834, application a and application B continue to receive location callbacks.
At step 836, application B closes.
At step 838, application B disconnects from the location services component.
In step 840, the location service component in application B updates the callback list and continues to provide location callbacks to application a.
At step 842, application A continues to receive location callbacks.
In the above embodiment, by configuring the master application and the slave application, when the master application is started first, the slave application compares the version numbers, and then can connect the location service of the master application, and the location service of the master application provides location callback to the master application and the slave application at the same time; when the slave application is started first, the slave application provides position callback through own positioning service, after the master application is started, the version number is compared, the positioning service of the master application is connected, the positioning service of the master application provides position callback to the master application and the slave application at the same time, the multiple applications share one service, the performance resource of the vehicle-mounted terminal is saved, and meanwhile, as the component providing the service is the latest version service, the services of other applications are upgraded as long as one application is upgraded, and the flow is saved.
The application also provides an application scene, and the application scene applies the service component calling method. In the application scenario, the terminal is an intelligent television. The intelligent television is provided with a plurality of applications, and each application on the intelligent television is configured as: in the case of non-launch, the common service component in the application may be launched by other applications. Specifically, taking a target service as an account service as an example, for each application on the smart television, when the application needs to use the account service as an example, the smart television sends a call request to a common service component for providing the account service in the application through a service interface component corresponding to the account service in the application, after a routing policy preset for the application is determined, the smart television determines that a target common service component indicated by the routing policy is a public service component for providing the latest version of the account service, and finally the smart television can send the call request to a common service component for providing the latest version of the account service, and the public service component of the latest version recalls account information for the application. For a specific implementation process, reference may be made to the description in the above embodiments, which is not described herein again.
By applying the service component calling method, the calling request of each application on the smart television is routed to the public service component of the latest version providing the service corresponding to the calling request, and for the smart television, only one public capability needs to be executed, and as long as the public capability of one application is upgraded, the public capabilities of all applications are upgraded.
It should be understood that although the various steps in the flowcharts of fig. 2-8 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-8 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps or stages.
In one embodiment, as shown in fig. 9, there is provided a service component invoking apparatus 900, which may be a part of a computer device using a software module or a hardware module, or a combination of the two, specifically comprising:
a calling request sending module 902, configured to send, when a locally started first application needs to use a target service, a calling request to a first public service component for providing the target service in the first application through a service interface component corresponding to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components;
a routing policy determination module 904, configured to determine a routing policy preset for the first application;
a call request routing module 906, configured to route, based on the routing policy, the call request to a target public service component in the second application for providing the target service if the first public service component is not the target public service component indicated by the routing policy;
a service provisioning module 908 for provisioning the target service to the first application through the target common services component.
When a first locally started application needs to use a target service, the service component calling device sends a calling request to a first public service component used for providing the target service in the first application through a service interface component corresponding to the target service in the first application, and routes the calling request to a target public service component used for providing the target service in a second application based on a routing policy by determining the routing policy preset for the first application if the first public service component is not the target public service component indicated by the routing policy, because different locally installed applications are provided with respective service interface components and corresponding public service components, the service interface components and the corresponding public service components are matched with each other to realize the service of the public capability, and further, the public capability can be obtained by sending the calling request to the public service component, the call request can be routed to the target public service component based on the routing strategy, so that a plurality of applications share one public capability, and the performance resource of the terminal is saved.
In one embodiment, the call request routing module is further configured to determine, based on the routing policy, a public service component that provides a latest version of the target service as the target public service component; the invocation request is routed to a target public service component in the second application.
In one embodiment, the call request routing module is further configured to obtain a software development kit version number corresponding to each public service component providing the target service; sequencing all public service components providing target services based on the version numbers of the software development kits, and selecting the public service component with the largest version number of the software development kits as the public service component with the latest version based on the sequencing result; and determining the public service component of the latest version as the target public service component.
In one embodiment, the call request routing module is further configured to determine, based on a routing policy, a master application to which the first application belongs from among locally installed applications, and obtain a second application; the update frequency of the primary application is greater than that of the first application; the invocation request is routed to a target common services component in the second application for providing the target service.
In one embodiment, the call request routing module is further configured to start, by the second application, a target public service component for providing the target service in the second application if the first public service component is not the target public service component indicated by the routing policy and the second application corresponding to the target public service component is in a start state; the invocation request is routed to a target common services component in the second application for providing the target service.
In one embodiment, the call request routing module is further configured to start the first public service component through the first application if the first public service component is not the target public service component indicated by the routing policy and the second application corresponding to the target public service component is not started; responding to the calling request through the first public service component to provide target service for the first application, and monitoring the second application; after monitoring that the second application is started, stopping providing the target service for the first application through the first public service component, and starting a target public service component for providing the target service in the second application through the second application; the invocation request is routed to a target common services component in the second application for providing the target service.
In one embodiment, the call request routing module is further configured to trigger, by the first application, a target public service component for providing the target service in the second application if the first public service component is not the target public service component indicated by the routing policy and a second application corresponding to the target public service component is not started; and after the target public service component is in the starting state, routing the calling request to the target public service component which is used for providing the target service in the second application.
In one embodiment, the first application is obtained by locally installing a corresponding installation package; the device also comprises an installation package generating module, which is used for leading in a preset public service framework: the public service framework has a public service component for providing public services; configuring a service interface component corresponding to the public service component and corresponding to the first application in a preset public service frame to obtain a target public service frame corresponding to the first application; and generating an installation package corresponding to the first application according to the target public service framework.
In one embodiment, the installation package generating module is further configured to, when a new public service needs to be accessed in the first application and the target public service framework has a new public service component for providing the new public service, configure, in the target public service framework, a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
In one embodiment, the installation package generating module is further configured to, when a new public service needs to be accessed in the first application and the target public service framework does not have a new public service component for providing the new public service, obtain a target software development kit corresponding to the new public service; in the target public service framework, configuring a new public service component for providing new public service based on a target software development kit, and configuring a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
In one embodiment, the invoking request routing module is further configured to determine a second application for providing the target service based on the routing policy; calling a service communication component in the first application through a remote interface in the first application, and sending a calling request to a service management component in the second application through the service communication component; the invocation request is sent to the target public service component by the service management component.
For specific limitations of the service component invoking device, reference may be made to the above limitations of the service component invoking method, which is not described herein again. The modules in the service component calling device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a service component invocation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (20)

1. A service component invocation method, characterized in that said method comprises:
when a first application which is locally started needs to use a target service, sending a calling request to a first public service component which is used for providing the target service in the first application through a service interface component which corresponds to the target service in the first application; different applications installed locally are provided with respective service interface components and corresponding common service components; the first application is obtained by locally installing a corresponding installation package; the installation package is generated according to a target public service framework; the target public service framework corresponds to the first application and is obtained by configuring a service interface component which corresponds to the public service component and corresponds to the first application in a preset public service framework; the public service framework has a public service component for providing public services;
determining a routing policy preset for the first application; the routing strategy is used for routing the call request to the latest version of the public service component or routing the call request to a specified application;
if the first public service component is not the target public service component indicated by the routing policy and a second application corresponding to the target public service component is not started, starting the first public service component through the first application, responding to the calling request through the first public service component to provide the target service for the first application, monitoring the second application, stopping providing the target service for the first application through the first public service component after monitoring that the second application is started, starting the target public service component used for providing the target service in the second application through the second application, and routing the calling request to the target public service component used for providing the target service in the second application; the target public service component is one of a first target public service component and a second target public service component, the first target public service component is a public service component with the largest software development kit version number in all public service components providing the target service, and the second target public service component is a public service component which is subordinate to the first application and installed in a local main application for providing the target service;
or
If the first public service component is not the target public service component indicated by the routing policy and the second application corresponding to the target public service component is not started, triggering the target public service component for providing the target service in the second application through the first application to enable the target public service component to be in a starting state, and routing the calling request to the target public service component for providing the target service in the second application after the target public service component is in the starting state; the target public service component is one of a first target public service component and a second target public service component, the first target public service component is a public service component with the largest software development kit version number in all public service components providing the target service, and the second target public service component is a public service component which is subordinate to the first application and installed in a local main application for providing the target service;
providing, by the target public service component, the target service to the first application.
2. The method of claim 1, wherein routing the invocation request to the target common services component of a second application for providing the target service comprises:
determining a common service component providing a latest version of the target service as the target common service component based on the routing policy;
routing the invocation request to the target public service component in the second application.
3. The method of claim 2, wherein determining the most recent version of the common service component that provided the target service as the target common service component comprises:
acquiring the version number of a software development kit corresponding to each public service component providing the target service;
sequencing all public service components providing the target service based on the version number of the software development kit, and selecting the public service component with the largest version number of the software development kit as the public service component with the latest version based on the sequencing result;
and determining the public service component of the latest version as a target public service component.
4. The method of claim 1, wherein routing the invocation request to the target common services component of a second application for providing the target service comprises:
determining a main application to which the first application belongs from each locally-installed application based on the routing policy to obtain a second application; the update frequency of the primary application is greater than the first application;
routing the invocation request to the target public service component of the second application for providing the target service.
5. The method of claim 1, further comprising:
if the first public service component is not the target public service component indicated by the routing policy and the second application corresponding to the target public service component is in a starting state, the first public service component and the second public service component are in a starting state
Starting the target public service component for providing the target service in the second application through the second application;
routing the invocation request to the target public service component in a second application for providing the target service.
6. The method of claim 1, wherein the first application is obtained by locally installing a corresponding installation package; the generating step of the installation package comprises the following steps:
importing a preset public service framework: the public service framework has a public service component for providing public services;
configuring a service interface component corresponding to the public service component and corresponding to the first application in a preset public service framework to obtain a target public service framework corresponding to the first application;
and generating an installation package corresponding to the first application according to the target public service framework.
7. The method of claim 6, wherein after the generating the installation package corresponding to the first application according to the target public service framework, the method further comprises:
when a new public service needs to be accessed in the first application and the target public service framework has a new public service component for providing the new public service, then
In the target public service framework, configuring a service interface component corresponding to the new public service component to obtain an updated target public service framework;
and updating the installation package according to the updated target public service framework.
8. The method of claim 6, wherein after the generating the installation package corresponding to the first application according to the target public service framework, the method further comprises:
when a new public service needs to be accessed in the first application and the target public service framework does not have a new public service component for providing the new public service, the first application is executed in a mode of executing the first application
Acquiring a target software development kit corresponding to the new public service;
in the target public service framework, configuring a new public service component for providing the new public service based on the target software development kit, and configuring a service interface component corresponding to the new public service component to obtain an updated target public service framework;
and updating the installation package according to the updated target public service framework.
9. The method of any of claims 1-8, wherein routing the invocation request to the target common services component in a second application for providing the target service comprises:
determining a second application for providing the target service based on the routing policy;
calling a service communication component in the first application through a remote interface in the first application, and sending the calling request to a service management component in the second application through the service communication component;
and sending the calling request to the target public service component through the service management component.
10. An apparatus for invoking a service component, the apparatus comprising:
a calling request sending module, configured to send a calling request to a first public service component for providing a target service in a first application through a service interface component corresponding to the target service in the first application when the first application started locally needs to use the target service; different applications installed locally are provided with respective service interface components and corresponding common service components; the first application is obtained by locally installing a corresponding installation package; the installation package is generated according to a target public service framework; the target public service framework corresponds to the first application and is obtained by configuring a service interface component which corresponds to the public service component and corresponds to the first application in a preset public service framework; the public service framework has a public service component for providing public services;
a routing policy determination module, configured to determine a routing policy preset for the first application; the routing strategy is used for routing the call request to the latest version of the public service component or routing the call request to a specified application;
a call request routing module, configured to, if the first public service component is not the target public service component indicated by the routing policy and a second application corresponding to the target public service component is not started, starting the first common service component through the first application, responding to the calling request through the first common service component to provide the target service for the first application, and monitoring the second application, stopping providing the target service to the first application through the first common service component after monitoring that the second application is started, starting the target public service component for providing the target service in the second application through the second application, and routing the calling request to the target public service component for providing the target service in the second application; the target public service component is one of a first target public service component and a second target public service component, the first target public service component is a public service component with the largest software development kit version number in all public service components providing the target service, and the second target public service component is a public service component which is subordinate to the first application and installed in a local main application for providing the target service;
or
A call request routing module, configured to trigger, by using the first application, a target public service component for providing the target service in a second application if the first public service component is not a target public service component indicated by the routing policy and a second application corresponding to the target public service component is not started, so that the target public service component is in a start state, and route the call request to the target public service component for providing the target service in the second application after the target public service component is in the start state; the target public service component is one of a first target public service component and a second target public service component, the first target public service component is a public service component with the largest software development kit version number in all public service components providing the target service, and the second target public service component is a public service component which is subordinate to the first application and installed in a local main application for providing the target service;
a service providing module for providing the target service to the first application through the target public service component.
11. The apparatus of claim 10, wherein the invoke request routing module is further configured to determine a most recent version of the common service component that provides the target service as the target common service component based on the routing policy; routing the invocation request to the target public service component in the second application.
12. The apparatus according to claim 11, wherein the call request routing module is further configured to obtain a software development kit version number corresponding to each common service component providing the target service; sequencing all public service components providing the target service based on the version number of the software development kit, and selecting the public service component with the largest version number of the software development kit as the public service component with the latest version based on the sequencing result; and determining the public service component of the latest version as a target public service component.
13. The apparatus according to claim 10, wherein the invocation request routing module is further configured to determine, based on the routing policy, a primary application to which the first application belongs from among locally installed applications, and obtain a second application; the update frequency of the primary application is greater than the first application; routing the invocation request to the target public service component of the second application for providing the target service.
14. The apparatus of claim 10, wherein the invocation request routing module is further configured to, if the first public service component is not a target public service component indicated by the routing policy and a second application corresponding to the target public service component is in a startup state, start, by the second application, the target public service component for providing the target service in the second application; routing the invocation request to the target public service component in a second application for providing the target service.
15. The apparatus of claim 10, wherein the first application is obtained by locally installing a corresponding installation package; the device also comprises an installation package generating module, which is used for leading in a preset public service framework: the public service framework has a public service component for providing public services; configuring a service interface component corresponding to the public service component and corresponding to the first application in a preset public service framework to obtain a target public service framework corresponding to the first application; and generating an installation package corresponding to the first application according to the target public service framework.
16. The apparatus according to claim 15, wherein the installation package generating module is further configured to, when a new public service needs to be accessed in the first application and the target public service framework has a new public service component for providing the new public service, configure, in the target public service framework, a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
17. The apparatus of claim 15, wherein the installation package generation module is further configured to, when a new public service needs to be accessed in the first application and the target public service framework does not have a new public service component for providing the new public service, obtain a target software development kit corresponding to the new public service; in the target public service framework, configuring a new public service component for providing the new public service based on the target software development kit, and configuring a service interface component corresponding to the new public service component to obtain an updated target public service framework; and updating the installation package according to the updated target public service framework.
18. The apparatus of any of claims 10 to 17, wherein the invoke request routing module is further configured to determine a second application for providing the target service based on the routing policy; calling a service communication component in the first application through a remote interface in the first application, and sending the calling request to a service management component in the second application through the service communication component; and sending the calling request to the target public service component through the service management component.
19. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 9 when executing the computer program.
20. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 9.
CN202111133373.2A 2021-09-27 2021-09-27 Service component calling method and device, computer equipment and storage medium Active CN113590341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111133373.2A CN113590341B (en) 2021-09-27 2021-09-27 Service component calling method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111133373.2A CN113590341B (en) 2021-09-27 2021-09-27 Service component calling method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113590341A CN113590341A (en) 2021-11-02
CN113590341B true CN113590341B (en) 2022-02-22

Family

ID=78242227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111133373.2A Active CN113590341B (en) 2021-09-27 2021-09-27 Service component calling method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113590341B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340734A (en) * 2010-07-16 2012-02-01 中国电信股份有限公司 Positioning application management method and device
CN106375458A (en) * 2016-09-08 2017-02-01 上海银天下科技有限公司 Service call system, method and device
CN109561226A (en) * 2017-09-26 2019-04-02 华为技术有限公司 A kind of API mixing multi-tenant method for routing, system and API gateway
CN110377438A (en) * 2019-07-22 2019-10-25 广州小鹏汽车科技有限公司 The method for routing of striding course communication interface, device and system
CN110944286A (en) * 2019-11-28 2020-03-31 出门问问信息科技有限公司 Method, apparatus, system and storage medium for providing positioning information
CN112965700A (en) * 2021-05-17 2021-06-15 太平金融科技服务(上海)有限公司 Routing-based micro-service processing method and device, computer equipment and medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8286186B2 (en) * 2008-04-14 2012-10-09 International Business Machines Corporation System and method for extensible data interface for shared service module
CN103428357B (en) * 2012-05-25 2016-12-21 上海盛付通电子支付服务有限公司 Realize the method and device that the local service on mobile terminal operating system is shared
EP3888322A1 (en) * 2018-11-30 2021-10-06 JPMorgan Chase Bank, N.A. Systems and methods for securely calling apis on an api gateway from applications needing first party authentication

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102340734A (en) * 2010-07-16 2012-02-01 中国电信股份有限公司 Positioning application management method and device
CN106375458A (en) * 2016-09-08 2017-02-01 上海银天下科技有限公司 Service call system, method and device
CN109561226A (en) * 2017-09-26 2019-04-02 华为技术有限公司 A kind of API mixing multi-tenant method for routing, system and API gateway
CN110377438A (en) * 2019-07-22 2019-10-25 广州小鹏汽车科技有限公司 The method for routing of striding course communication interface, device and system
CN110944286A (en) * 2019-11-28 2020-03-31 出门问问信息科技有限公司 Method, apparatus, system and storage medium for providing positioning information
CN112965700A (en) * 2021-05-17 2021-06-15 太平金融科技服务(上海)有限公司 Routing-based micro-service processing method and device, computer equipment and medium

Also Published As

Publication number Publication date
CN113590341A (en) 2021-11-02

Similar Documents

Publication Publication Date Title
CN107911421B (en) Method, apparatus, and computer storage medium for configuring cross-network communications in a blockchain
EP3403178B1 (en) Identifiers across application instances
EP3170071B1 (en) Self-extending cloud
US10346481B2 (en) Customizing operating system based on detected carrier
CN112000348A (en) Control method and device for service gray release and computer equipment
US7831734B2 (en) Method and system for remote configuration of network devices
WO2016037479A1 (en) Method, device and system for optimizing virtualized network function (vnf)
CN111221451B (en) Cloud mobile phone shortcut creation method and system
CN115061717B (en) Application management method, application subscription method and related equipment
WO2010000142A1 (en) Distributed network management system and maintenance management method thereof
CN114125028A (en) Running method, device, equipment, storage medium and program product of micro application
CN110968331A (en) Method and device for running application program
CN113645262A (en) Cloud computing service system and method
CN114168179A (en) Micro-service management method, device, computer equipment and storage medium
CN110489305B (en) Server management method and device
CN113590169B (en) Application deployment method, application deployment system, and computer-readable storage medium
US11900089B2 (en) Automatically configuring and deploying a software operator in a distributed computing environment from a package
CN112256351B (en) Method for realizing Feign component, method and device for calling micro-service
CN111008023B (en) Instance deployment method and system
CN113590341B (en) Service component calling method and device, computer equipment and storage medium
CN109495298B (en) Method and device for managing nodes in OpenStack system
CN109491762B (en) Container state control method and device, storage medium and electronic equipment
CN110730197A (en) Service discovery method and system
CN110198225A (en) A kind of management method and management server of more clusters
US11425203B2 (en) Commissioning a virtualized network function

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40055781

Country of ref document: HK