[go: up one dir, main page]

CN113778479A - A service proxy method and device - Google Patents

A service proxy method and device Download PDF

Info

Publication number
CN113778479A
CN113778479A CN202110090297.5A CN202110090297A CN113778479A CN 113778479 A CN113778479 A CN 113778479A CN 202110090297 A CN202110090297 A CN 202110090297A CN 113778479 A CN113778479 A CN 113778479A
Authority
CN
China
Prior art keywords
service
function
agent
target
script
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.)
Pending
Application number
CN202110090297.5A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110090297.5A priority Critical patent/CN113778479A/en
Publication of CN113778479A publication Critical patent/CN113778479A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本发明公开了一种服务代理方法和装置,涉及计算机技术领域。该方法的具体实施方式包括:确定多个服务生产者共有的一个或多个目标功能;确定所述一个或多个目标功能对应的脚本;根据所述脚本生成服务发布代理;利用所述服务发布代理向管理端发送一个或多个目标功能对应的功能请求,以使所述管理端根据所述功能请求,实现所述一个或多个服务生产者对应的所述目标功能。该实施方式能够通过服务发布代理实现多个服务生产者共有的目标功能,从而使得每个服务生产者可以专注于自身独有的功能,无需重复执行相同的目标功能,从而提升系统性能。

Figure 202110090297

The invention discloses a service proxy method and device, and relates to the technical field of computers. The specific implementation of the method includes: determining one or more target functions shared by multiple service producers; determining a script corresponding to the one or more target functions; generating a service publishing agent according to the script; using the service publishing The agent sends a function request corresponding to one or more target functions to the management terminal, so that the management terminal implements the target function corresponding to the one or more service producers according to the function request. This embodiment can realize the target function shared by multiple service producers through the service publishing agent, so that each service producer can focus on its own unique function without repeatedly executing the same target function, thereby improving system performance.

Figure 202110090297

Description

Service agent method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a service broker method and apparatus.
Background
An RPC (remote Procedure Call protocol) framework is a remote calling service mode in microservices, and can improve calling efficiency.
When a service producer (i.e., a service provider) of an existing RPC framework provides a service, different service producers can implement various functions of their own.
However, different service producers may have the same functionality. Each service producer needs to be repeatedly executed for such same function, resulting in poor system performance.
Disclosure of Invention
In view of this, embodiments of the present invention provide a service broker method and apparatus, which can implement a target function common to multiple service producers through a service publishing broker, so that each service producer can concentrate on its own unique function, and the same target function does not need to be repeatedly executed, thereby improving system performance.
Further, when the function shared by a plurality of service producers needs to be updated, the script of the service publishing agent only needs to be updated, and the script of each service producer does not need to be updated, so that the development efficiency is improved.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a service broker method including:
determining one or more target functions common to a plurality of service producers;
determining scripts corresponding to the one or more target functions;
generating a service publishing agent according to the script;
and sending a function request corresponding to one or more target functions to a management end by using the service publishing agent so that the management end realizes the target functions corresponding to one or more service producers according to the function request.
Optionally, the service publishing agent comprises a codec protocol; the generating a service publishing agent according to the script includes:
according to a first coding format in the script and a second coding format required by the service publishing agent, converting the script of the first coding format into the second coding format according to the codec protocol;
and generating the service publishing agent according to the converted script.
Optionally, after the generating a service publishing agent according to the script, the method further includes:
receiving an inquiry request sent by the management terminal through the service publishing agent, wherein the inquiry request comprises an identifier of at least one service producer;
and responding to the query request, and sending the functional state of the at least one service producer to the management terminal through the service publishing agency.
Optionally, generating a mirror image of the service publishing agent;
and sending the functional state of the at least one service producer to the management terminal through the mirror image of the service publishing agent.
Optionally, receiving an update request for the one or more target functions;
and updating the script corresponding to the service publishing agent according to the updating request so as to update the target function shared by the plurality of service producers.
Optionally, the method further comprises:
when a new service producer is added, determining whether the new service producer has the target function, if so, registering the service producer to the service publishing agency so that the service publishing agency realizes the target function of the new service producer.
Optionally, the target function comprises any one or more of: the service registration function, the service quality monitoring function and the service heartbeat sending function.
According to still another aspect of an embodiment of the present invention, there is provided a service agent apparatus including:
an analysis module to determine one or more target functions common to a plurality of service producers;
the data processing module is used for determining scripts corresponding to the one or more target functions;
the generating module is used for generating a service publishing agent according to the script;
the request module is used for sending a function request corresponding to one or more target functions to a management end by using the service publishing agent so that the management end can realize the target functions corresponding to one or more service producers according to the function request.
According to another aspect of an embodiment of the present invention, there is provided a service agent electronic device including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the service broker method provided by the present invention.
According to still another aspect of an embodiment of the present invention, there is provided a computer-readable medium on which a computer program is stored, the program implementing the service broker method provided by the present invention when executed by a processor.
One embodiment of the above invention has the following advantages or benefits: because the technical means of generating the service publishing agent according to the script corresponding to the target function shared by the service producers is adopted, the technical problem that different service producers repeatedly execute the same function to cause poor system performance is solved, and the technical effect that each service producer can concentrate on the unique function of the service producer and does not need to repeatedly execute the same target function to improve the system performance is achieved
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is an exemplary system architecture diagram of a service broker method or service broker apparatus suitable for application to embodiments of the present invention;
FIG. 2 is a schematic diagram of the main flow of a service broker method according to an embodiment of the invention;
FIG. 3(a) is a first schematic diagram illustrating a detailed flow of a service broker method according to an embodiment of the present invention;
FIG. 3(b) is a second schematic diagram illustrating a detailed flow of another service brokering method according to an embodiment of the present invention;
FIG. 3(c) is a third schematic diagram illustrating a detailed flow of another service agent method according to an embodiment of the present invention;
FIG. 3(d) is an exemplary diagram of a codec according to an embodiment of the invention;
FIG. 3(e) is a diagram illustrating a calling process of a service broker method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of a service broker apparatus according to an embodiment of the present invention;
fig. 5 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
RPC: remote Procedure Call Protocol refers to a distributed node requesting a service provided by another distributed node.
Mirroring: is a form of file storage, meaning that the data on one disk has an identical copy on another disk.
Fig. 1 shows an exemplary system architecture diagram of a service broker method or a service broker apparatus suitable for being applied to an embodiment of the present invention, and as shown in fig. 1, the exemplary system architecture of the service broker method or the service broker apparatus of the embodiment of the present invention includes:
as shown in fig. 1, the system architecture 100 may include servers 101, 102, 103, a network 104, and a server 105 having a service broker 400 (not shown). Network 104 is the medium used to provide communication links between servers 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use servers 101, 102, 103 to interact with server 105 over network 104 to receive or send messages, etc. The servers 101, 102, 103 may be servers having a distributed architecture system.
The server 105 may be a server that provides various services, such as a background management server (for example only) that supports user requests for functions issued using the servers 101, 102, 103. The backend management server may analyze and otherwise process data such as the received registration request, and feed back a processing result (e.g., registration success/failure) to the servers 101, 102, and 103.
It should be noted that the service agent method provided by the embodiment of the present invention is generally executed by the server 105, and accordingly, the service agent apparatus is generally disposed in the server 105.
It should be understood that the number of networks and servers in fig. 1 is merely illustrative. There may be any number of networks and servers, as desired for implementation.
Fig. 2 is a schematic diagram of a main flow of a service agent method according to an embodiment of the present invention, and as shown in fig. 2, the service agent method of the present invention includes:
in step S201, one or more target functions common to a plurality of service producers are determined.
Service producers under the micro-service architecture can implement a wide variety of business logic and specific functions, where specific functions in the service producer are implemented by SDKs that are independent of the specific business. The specific functions of different service producers often have commonality, and therefore, the specific functions are often target functions that are common to multiple service producers. In order to improve the running performance of the system, one or more target functions which are common to a plurality of service producers, namely common to the service producers, are analyzed and determined, and are separated from the service producers, so that the target functions which respond can be independent, and the decoupling of business logic and functional logic is realized, thereby improving the system performance.
Step S202, determining a script corresponding to the one or more target functions.
After one or more target functions shared by a plurality of service producers are determined, script contents corresponding to the one or more target functions are determined based on the scripts of the service producers. The target function corresponds to a function for service release in a service producer; the script of the target function corresponds to the script of the function which is realized by the service release. The functions of service publishing may include functions of service registration, service quality monitoring, service heartbeat transmission, and the like. In order to realize the service registration function, the service release needs to send a registration request to a management terminal; in order to realize the service state monitoring and the service heartbeat sending function, service publishing needs to send the service state of a service producer to a management end.
Step S203, generating a service release agent according to the script.
After script contents corresponding to one or more target functions are determined, a service publishing agent is generated based on the script contents corresponding to the one or more target functions, wherein the script corresponding to the target function is a script published by the service, namely the service publishing agent is generated based on the script contents published by the service. The essence is to extract the functions shared by a plurality of service producers and to implement the shared functions through service distribution, i.e. to generate a service distribution agent. After the service publishing agent is generated, one or more target functions shared by a plurality of service producers can be realized by the service publishing agent, so that the code redundancy of the service producers is reduced, the complexity of system codes is reduced, and developers can concentrate on the development of business logic without considering the publishing logic of the service when developing the service.
Step S204, the service publishing agent is used for sending a function request corresponding to one or more target functions to a management end, so that the management end realizes the target functions corresponding to one or more service producers according to the function request.
After the service publishing agent is generated, one or more service producers can send function requests corresponding to one or more target functions to the management terminal through the service publishing agent, and the management terminal processes the function requests after receiving the function requests, so that the target functions corresponding to the function requests, namely the one or more target functions corresponding to the one or more service producers, are realized. The service publishing agents can comprise a plurality of service publishing agents, one or more target functions can correspond to one service publishing agent, and also can correspond to a plurality of service publishing agents; one or more service producers can correspond to one service publishing agent or a plurality of service publishing agents, and the setting can be selected according to the performance and the running condition of the service publishing agents.
Illustratively, the function request may be a registration request, after the service producer communicates with the service publishing agent, the service publishing agent sends the registration request to the management end, the management end returns a result to the service publishing agent after registration, and the service publishing agent returns a result of successful registration to the service producer; the service publishing agent can periodically send heartbeat detection to the management end, so that the management end confirms that the service producer is in a normal service state.
In the embodiment of the invention, one or more target functions shared by a plurality of service producers are determined; determining scripts corresponding to the one or more target functions; generating a service publishing agent according to the script; and sending a function request corresponding to one or more target functions to a management end by using the service release agent, so that the management end realizes the target functions corresponding to one or more service producers according to the function request, and the like.
Fig. 3(a) is a schematic diagram of a detailed flow of a service agent method according to an embodiment of the present invention, fig. 3(b) is a schematic diagram of a detailed flow of another service agent method according to an embodiment of the present invention, fig. 3(c) is a schematic diagram of a detailed flow of another service agent method according to an embodiment of the present invention, fig. 3(d) is an example of a compilation protocol according to an embodiment of the present invention, fig. 3(e) is a schematic diagram of a calling process of a service agent method according to an embodiment of the present invention, as shown in fig. 3(a), the service agent method of the present invention includes:
in step S301, a target function common to service producers is determined.
The RPC framework of the microservice is suitable for a distributed architecture, and can realize remote calling between services, namely remote calling between distributed nodes. A service producer under the existing RPC framework includes the business logic of the service and the publishing logic of the service,
for example, when the service producer implements internal service publishing logic, each service producer may need to repeatedly execute the related function of service publishing, and the related function of service publishing has commonality, so in order to improve system performance, so that the service producer does not need to repeatedly execute the related function of service publishing with commonality, one or more target functions common to a plurality of service producers are determined and extracted from the service producer, thereby the target function related to service publishing can be executed by one agent, and system performance is improved. The target function corresponds to a function issued for a service in the service producer.
Further, service publishing may provide service implementation of related functions in the form of a service interface, enabling service consumers to discover and invoke services from a management side.
Step S302, determining script content of the target function.
After determining one or more target functions common to a plurality of service producers, script content of the one or more target functions is searched and determined based on the codes of the service producers. The script content of the target function is the script content of the function realized by the service release. The functions of service publishing may include functions of service registration, service quality monitoring, service heartbeat transmission, and the like.
Step S303, encoding format processing.
After determining the script content of one or more target functions shared by a plurality of service producers, according to a first encoding format of the script content of one or more target functions and a second encoding format required by the generated service publishing agent, the script content of the first encoding format is converted into the script content of the second encoding format based on a codec protocol.
Illustratively, as shown in fig. 3(b), the service producer, when implementing the system application, includes service logic and an SDK, the SDK includes: compiling a protocol; the functions of service registration, service quality monitoring, service heartbeat sending and the like can be realized. When a service release agent is generated, the SDK of a service producer is modified, the general function service registration, the service quality monitoring, the service heartbeat sending and the like in the SDK are extracted, the compiling and resolving protocol of the SDK is stored, and the service release logic is formed by the SDK and the compiling and resolving protocol; meanwhile, the original service logic of the service producer is kept unchanged, and the SDK only keeps the original compiling and solving protocol, so that one or more common target functions of a plurality of service producers can be realized through the service publishing agent, the code redundancy of the service producer is reduced, and the development efficiency is improved.
Illustratively, as shown in fig. 3(c), the generic function service registration, the service quality monitoring, the service heartbeat sending, and the like of the service producer are extracted, and the codec is saved to generate the service publishing agent. The service publishing agent can realize the functions of service registration, service quality monitoring, service heartbeat sending and the like.
Step S304, a service publishing agent is generated.
After converting script contents of a first encoding format of one or more target functions shared by a plurality of service producers into script contents of a second encoding format, generating a service publishing agent according to the converted script contents of the one or more target functions of the second encoding format. When a service producer under the existing RPC framework realizes service release, the service release is embedded in an application program of a service, correspondingly, a code of the service release is embedded in a code of the service producer, a business logic of the service is coupled with a release logic of the service, and if the business logic or related content of the release logic needs to be developed, a developer needs to modify the code of the service producer integrally. After one or more target functions shared by a plurality of service producers are generated into a service publishing agent, the service producers can realize the shared target functions through the service publishing agent, so that each service producer can concentrate on the unique function of the service producer, and developers can concentrate on the development of the business logic of the service without considering the publishing logic of the service; or, the developer can concentrate on the development of the service release logic without considering the service logic of the service, thereby reducing the workload of the developer and the code complexity of the service producer and reducing the code redundancy of the service producer.
Illustratively, based on the compilation protocol, the service publishing agent may implement the service provider to provide services to data structures in different languages. The codec protocol is a standard for converting to binary codec protocol, and the data consists of two parts including header information and entity data. The header information includes a field Type and a field number Tag, the Type is used to identify the Type of entity part data corresponding to the header information, the length and format of the entity part data of different types are different, for example, Type ═ 0 indicates that the data Type is int1, and the length and format of the corresponding entity part data are integer data following 1 byte; type 1, 2 and 3 indicate that the data types are int2, int4 and int8, and the length and format of the corresponding entity part data are immediately followed by 2, 4 and 8 bytes integer data; the Type is 4 and 5, the data Type is float and double, and the length and format of the corresponding entity part data are floating point Type data which are followed by 4 bytes and 8 bytes; the Type is 6 and 7, the data types are string1 and string4, the length and the format of the corresponding entity part data are 1 byte and 4 bytes, and the data are followed with the content; 8, the data Type is Map, the length and format of the corresponding entity data are the size of Map represented by 1 integer data, and then the list of key value pairs is followed; the Type is 9, the data Type is List, the length and the format of the corresponding entity part data are the size of the List which is represented by following 1 integer data, and then the List is followed by the element List; the Type is 10, the data Type is the start of the self-defined structure, and the length and the format of the corresponding entity part data are the start mark of the self-defined structure; the Type is 11, the data Type is the end of the self-defined structure, the length and the format of the corresponding entity part data are the end mark of the self-defined structure, and Tag is 0; the Type is 12, the data Type is number 0, the length and format of the corresponding entity part data are number 0, and data are not followed; type 13 indicates that the data Type is SimpleList, the length and format of the corresponding entity part data are simple lists (for example, byte arrays), 1 Type field (for example, byte) is followed, 1 integer data indicates the length, and then byte data is followed.
Further, the different languages may be converted into binary through serialization, for example, the language is C + + language, as shown in fig. 3 (d). By establishing a uniform compilation protocol, cross-language development of a service producer can be realized, and development efficiency can be improved.
Furthermore, when the target function shared by a plurality of service producers needs to be updated, only the script content of the service publishing agent needs to be updated, and the code of each service producer does not need to be updated, so that the development efficiency is improved.
Step S305, the service publishing agent encapsulates.
And after the service publishing agent is generated, packaging/packing the service publishing agent to obtain a service publishing agent interface for providing service for a service producer. When a new service producer is added, whether the new service producer has the target function corresponding to the service publishing agent is judged, if yes, the service producer can be accessed into the service publishing agent interface, and the service publishing agent can realize the target function of the new service producer. The service publishing agent interface is deployed in a distributed manner in a service process, and can be exclusively owned by a single machine or shared by a plurality of machines.
Step S306, registering the management terminal.
After the service publishing agent is packaged, a plurality of service producers send service registration requests to the management end through the service publishing agent interface, the management end requests to register the plurality of service producers on the management end, after the management end passes the registration, the registration result is returned to the service publishing agent through TCP calling, and the service publishing agent returns the registration result to the corresponding plurality of service producers. After the service producer is successfully registered, the management terminal can send the list information of the service producer to the service consumer according to the request of the service consumer, so that the service consumer can select the service producer to provide the required service for the service consumer.
For example, after the service producer successfully registers with the management terminal through the service publishing agent, the service publishing agent may send the service state of the service producer to the management terminal, so as to implement functions of service state monitoring, service heartbeat sending, and the like.
Step S307, the service publishing agent mirrors.
After a plurality of service producers successfully register to the management terminal through the service publishing agent, the service producers request the server to distribute the container, and the service publishing agent mirror image is installed on the container, so that the management terminal can selectively operate the deployment condition of the service publishing agent interface according to the requirement through the service publishing agent mirror image. The service publishing agent comprises a service publishing producer and a service publishing consumer, and the management end can selectively check the service publishing producer and the service publishing consumer of the service publishing agent interface according to needs through the service publishing agent mirror image and start and stop or modify the configuration of the service according to needs. The management terminal is based on the service publishing agent mirror image, and the deployment condition of the service publishing agent interface is checked, modified and started and stopped through the visual interface, so that the service state of the system can be monitored while the normal operation of the original system is ensured, the operation of the original system is not interfered, and the operation stability of the original system is ensured.
Illustratively, the service release mirror image is deployed through the container, so that the relevant functions of the service release can be selectively selected and correspondingly operated after the container is applied and distributed, operation and maintenance personnel can uniformly monitor the service release of all machines when maintaining the system, the start and stop of a service release interface and the configuration of relevant information are performed through a visual interface, and the operation and maintenance cost can be greatly reduced. And the operation is carried out through a visual interface of the service release, so that the centralized management and control of the service release are realized.
Further, the management terminal can directly check the service publishing producer and the service publishing consumer of the service publishing agent interface through the service publishing agent, and start and stop or modify the configuration of the service according to the requirement.
Step S308, the service publishing agent runs.
After the service publishing agent mirror image is installed on the container in the server, the management end can select whether to load the service publishing mirror image according to the requirement, if the service publishing mirror image is loaded, the service publishing mirror image is loaded when the server is started, and the management end can check the deployment condition of the service publishing interface and perform corresponding operation.
As shown in fig. 3(e), the calling process of the service broker method of the present invention includes:
and the client applies for a deployment container to the system when the service is started, and encapsulates the service producer and the service publishing agent by using the container after the container is obtained to obtain a service publishing agent interface. The client may be a developer. Initiating a service request to a service release producer through a service release agent interface; after receiving the service request, the service producer initiates a service release request to a service release consumer according to information such as a service interface, an alias and the like in the service request; after receiving the service publishing request, the service publishing consumer sends the request to the service publishing producer through TCP direct connection calling; and after receiving the calling request, the service release producer initiates a function request to the management terminal. The management terminal can be a service registration center, and a service release producer can initiate a request to the service registration center through TCP calling. After the management side processes the function request, a processing result is returned to the service release producer; after receiving the processing result, the service release producer returns the processing result to the service release consumer; after receiving the processing result returned by the service release producer, the service release consumer returns the processing result to the service producer; and after receiving the processing result, the service producer returns the processing result to the service publishing agent interface, so that the client can obtain the result of successful/failed execution.
Illustratively, the main function of the service publishing agent is to obtain the request of the service producer, and return the service result to the client through RPC by a series of service publishing policies, including connecting the registry, configuring the cluster fault tolerance policy, and the load balancing policy of the service producer.
Illustratively, the portion of the service publication may be the envoy of the ServiceMesh service grid; the compiling protocol can be a grpc protocol, a thrift protocol and the like;
in the embodiment of the invention, the target functions shared by the service producers are determined; determining script content of a target function; processing a coding format; generating a service publishing agent; service publishing agent encapsulation; registering to a management terminal; a service publishing agent mirror image; the service release agent runs and other steps, and the common target function of a plurality of service producers can be realized through the service release agent, so that each service producer can concentrate on the unique function of the service producer, the same target function does not need to be repeatedly executed, and the system performance is improved.
Fig. 4 is a schematic diagram of main modules of a service broker apparatus according to an embodiment of the present invention, and as shown in fig. 4, a service broker apparatus 400 of the present invention includes:
an analysis module 401 for determining one or more target functions common to a plurality of service producers.
Illustratively, a service producer under the microservice architecture can implement a wide variety of business logic and specific functions, where specific functions in the service producer are implemented by SDKs that are independent of the specific business. The specific functions of different service producers often have commonality, and therefore, the specific functions are often target functions that are common to multiple service producers. In order to improve the operation performance of the system, the analysis module 401 analyzes and determines one or more target functions of the plurality of service producers, which are common, and separates the one or more target functions from the service producers, so that the target functions of the response can be independent, and the decoupling of the business logic and the functional logic is realized, thereby improving the system performance.
A data processing module 402, configured to determine a script corresponding to the one or more target functions.
Illustratively, after the analysis module 401 determines one or more target functions shared by a plurality of service producers, the data processing module 402 determines script contents corresponding to the one or more target functions based on the scripts of the service producers. The target function corresponds to a function for service release in a service producer; the script of the target function corresponds to the script issued by the service. The functions of service publishing may include functions of service registration, service quality monitoring, service heartbeat transmission, and the like. In order to realize the service registration function, the service release needs to send a registration request to a management terminal; in order to realize the service state monitoring and the service heartbeat sending function, service publishing needs to send the service state of a service producer to a management end.
A generating module 403, configured to generate a service publishing agent according to the script.
Illustratively, after the data processing module 402 determines script contents corresponding to one or more target functions, the generating module 403 generates a service publishing agent based on the script contents corresponding to one or more target functions, where the script corresponding to a target function is a script published by a service, that is, the service publishing agent is generated based on the script contents published by the service. The essence is to extract the functions shared by a plurality of service producers and to implement the shared functions through service distribution, i.e. to generate a service distribution agent. After the generating module 403 generates the service publishing agent, one or more target functions shared by a plurality of service producers can be realized by the service publishing agent, so that the code redundancy of the service producers is reduced, the complexity of system codes is reduced, and developers can concentrate on the development of business logic without considering the publishing logic of the service when developing the service.
A request module 404, configured to send, by using the service publishing agent, a function request corresponding to one or more target functions to a management end, so that the management end implements the target functions corresponding to the one or more service producers according to the function request.
For example, after the generating module 403 generates the service publishing agent, one or more service producers can send a function request corresponding to one or more target functions to the management end by using the requesting module 404 through the service publishing agent, and the management end processes the function request after receiving the function request, so as to implement the target function corresponding to the function request, that is, one or more target functions corresponding to one or more service producers. The service publishing agents can comprise a plurality of service publishing agents, one or more target functions can correspond to one service publishing agent, and also can correspond to a plurality of service publishing agents; one or more service producers can correspond to one service publishing agent or a plurality of service publishing agents, and the setting can be selected according to the performance and the running condition of the service publishing agents.
Further, the function request may be a registration request, after the service producer communicates with the service publishing agent, the service publishing agent sends the registration request to the management end, the management end returns a result to the service publishing agent after registration, and the service publishing agent returns a result of successful registration to the service producer; the service publishing agent can periodically send heartbeat detection to the management end, so that the management end confirms that the service producer is in a normal service state.
In the embodiment of the invention, through the analysis module, the data processing module, the generation module, the request module and other modules, the common target function of a plurality of service producers can be realized through the service publishing agent, so that each service producer can concentrate on the unique function of the service producer and does not need to repeatedly execute the same target function, and the system performance is improved.
Fig. 5 is a schematic structural diagram of a computer system suitable for implementing a terminal device according to an embodiment of the present invention, and as shown in fig. 5, the computer system 500 of the terminal device according to the embodiment of the present invention includes:
a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the system 500 are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 501.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an analysis module, a data processing module, a generation module, and a request module. Where the names of these modules do not in some cases constitute a limitation on the module itself, for example, an analysis module may also be described as a "module that analyzes scripts of multiple service producers to determine a target function common to the multiple service producers".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: determining one or more target functions common to a plurality of service producers; determining scripts corresponding to the one or more target functions; generating a service publishing agent according to the script; and sending a function request corresponding to one or more target functions to a management end by using the service publishing agent so that the management end realizes the target functions corresponding to one or more service producers according to the function request.
According to the technical scheme of the embodiment of the invention, the common target function of a plurality of service producers can be realized through the service publishing agent, so that each service producer can concentrate on the unique function of the service producer, the same target function does not need to be repeatedly executed, and the system performance is improved.
Further, when the function shared by a plurality of service producers needs to be updated, the script of the service publishing agent only needs to be updated, and the script of each service producer does not need to be updated, so that the development efficiency is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1.一种服务代理方法,其特征在于,包括:1. a service proxy method, is characterized in that, comprises: 确定多个服务生产者共有的一个或多个目标功能;Identify one or more target capabilities common to multiple service producers; 确定所述一个或多个目标功能对应的脚本;determining a script corresponding to the one or more target functions; 根据所述脚本生成服务发布代理;Generate a service release agent according to the script; 利用所述服务发布代理向管理端发送一个或多个目标功能对应的功能请求,以使所述管理端根据所述功能请求,实现所述一个或多个服务生产者对应的所述目标功能。The service release agent is used to send function requests corresponding to one or more target functions to the management terminal, so that the management terminal implements the target functions corresponding to the one or more service producers according to the function requests. 2.根据权利要求1所述的方法,其特征在于,所述服务发布代理包括编解协议;所述根据所述脚本生成服务发布代理,包括:2. The method according to claim 1, wherein the service publishing agent comprises an encoding and decoding protocol; and the generating the service publishing agent according to the script comprises: 根据所述脚本中的第一编码格式、以及所述服务发布代理所需的第二编码格式,根据所述编解协议,将所述第一编码格式的脚本转换为所述第二编码格式;Convert the script in the first encoding format to the second encoding format according to the encoding and decoding protocol according to the first encoding format in the script and the second encoding format required by the service publishing agent; 根据转换后的脚本生成所述服务发布代理。The service publishing proxy is generated according to the converted script. 3.根据权利要求1所述的方法,其特征在于,在所述根据所述脚本生成服务发布代理之后,还包括:3. The method according to claim 1, characterized in that, after generating the service release agent according to the script, further comprising: 通过所述服务发布代理接收到所述管理端发送的查询请求,其中,所述查询请求包括至少一个所述服务生产者的标识;The query request sent by the management terminal is received by the service publishing agent, wherein the query request includes at least one identifier of the service producer; 响应于所述查询请求,通过所述服务发布代理向所述管理端发送所述至少一个服务生产者的功能状态。In response to the query request, the function status of the at least one service producer is sent to the management terminal through the service publishing agent. 4.根据权利要求3所述的方法,其特征在于,4. The method of claim 3, wherein 生成所述服务发布代理的镜像;generating a mirror image of the service publishing agent; 通过所述服务发布代理的镜像,向所述管理端发送所述至少一个服务生产者的功能状态。The function status of the at least one service producer is sent to the management end through the mirror image of the service publishing agent. 5.根据权利要求1所述的方法,其特征在于,5. The method of claim 1, wherein 接收针对所述一个或多个目标功能的更新请求;receiving an update request for the one or more target functions; 根据所述更新请求,更新所述服务发布代理对应的脚本,以对所述多个服务生产者共有的所述目标功能进行更新。According to the update request, the script corresponding to the service release agent is updated to update the target function shared by the multiple service producers. 6.根据权利要求1所述的方法,其特征在于,还包括:6. The method of claim 1, further comprising: 当新增服务生产者时,确定新增的服务生产者是否具有所述目标功能,如果是,将所述服务生产者注册至所述服务发布代理,以使所述服务发布代理实现所述新增的服务生产者的目标功能。When adding a service producer, determine whether the new service producer has the target function, and if so, register the service producer with the service publishing agent, so that the service publishing agent can realize the new Increase the target functionality of the service producer. 7.根据权利要求1所述的方法,其特征在于,所述目标功能包括以下任意一个或多个:服务注册功能、服务质量监控功能和服务心跳发送功能服务。7. The method according to claim 1, wherein the target function comprises any one or more of the following: a service registration function, a service quality monitoring function, and a service heartbeat sending function service. 8.一种服务代理装置,其特征在于,包括:8. A service proxy device, comprising: 分析模块,用于确定多个服务生产者共有的一个或多个目标功能;An analysis module for determining one or more target functions common to multiple service producers; 数据处理模块,用于确定所述一个或多个目标功能对应的脚本;a data processing module for determining the script corresponding to the one or more target functions; 生成模块,用于根据所述脚本生成服务发布代理;a generating module, for generating a service release agent according to the script; 请求模块,用于利用所述服务发布代理向管理端发送一个或多个目标功能对应的功能请求,以使所述管理端根据所述功能请求,实现所述一个或多个服务生产者对应的所述目标功能。The request module is used to send the function request corresponding to one or more target functions to the management terminal by using the service release agent, so that the management terminal realizes the corresponding function request of the one or more service producers according to the function request. the target function. 9.一种服务代理电子设备,其特征在于,包括:9. A service agent electronic device, characterized in that, comprising: 一个或多个处理器;one or more processors; 存储装置,用于存储一个或多个程序,storage means for storing one or more programs, 当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-7中任一所述的方法。The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-7. 10.一种计算机可读介质,其上存储有计算机程序,其特征在于,所述程序被处理器执行时实现如权利要求1-7中任一所述的方法。10. A computer-readable medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the method according to any one of claims 1-7 is implemented.
CN202110090297.5A 2021-01-22 2021-01-22 A service proxy method and device Pending CN113778479A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110090297.5A CN113778479A (en) 2021-01-22 2021-01-22 A service proxy method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110090297.5A CN113778479A (en) 2021-01-22 2021-01-22 A service proxy method and device

Publications (1)

Publication Number Publication Date
CN113778479A true CN113778479A (en) 2021-12-10

Family

ID=78835484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110090297.5A Pending CN113778479A (en) 2021-01-22 2021-01-22 A service proxy method and device

Country Status (1)

Country Link
CN (1) CN113778479A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101048732A (en) * 2004-08-31 2007-10-03 国际商业机器公司 Object oriented architecture for data integration service
US20090133113A1 (en) * 2007-11-15 2009-05-21 Schneider James P Adding client authentication to networked communications
CN101686173A (en) * 2008-09-27 2010-03-31 华为技术有限公司 Method, system and apparatus of service negotiation
CN110032392A (en) * 2019-04-15 2019-07-19 杭州朗和科技有限公司 Service administering method and device, storage medium and electronic equipment
WO2020048391A1 (en) * 2018-09-04 2020-03-12 京东数字科技控股有限公司 Methods and apparatuses for deploying and invoking web services based on multi-tenancy technology
CN111654386A (en) * 2020-01-15 2020-09-11 许继集团有限公司 A method and system for establishing a business function chain

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101048732A (en) * 2004-08-31 2007-10-03 国际商业机器公司 Object oriented architecture for data integration service
US20090133113A1 (en) * 2007-11-15 2009-05-21 Schneider James P Adding client authentication to networked communications
CN101686173A (en) * 2008-09-27 2010-03-31 华为技术有限公司 Method, system and apparatus of service negotiation
WO2020048391A1 (en) * 2018-09-04 2020-03-12 京东数字科技控股有限公司 Methods and apparatuses for deploying and invoking web services based on multi-tenancy technology
CN110032392A (en) * 2019-04-15 2019-07-19 杭州朗和科技有限公司 Service administering method and device, storage medium and electronic equipment
CN111654386A (en) * 2020-01-15 2020-09-11 许继集团有限公司 A method and system for establishing a business function chain

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
刘婧;李宥谋;黄建军;周欢;: "基于无线Mesh网络仪器代理的设计与实现", 现代电子技术, no. 02, 15 January 2017 (2017-01-15) *
王汝传, 邓玉龙, 王颖: "移动代理技术模型的研究和实现", 计算机工程与应用, no. 03, 9 March 2000 (2000-03-09) *
郑世明;高歆;付雪梅;钱一虹;王智新;: "基于Web服务的作战仿真模型一体化建模与验证", 指挥控制与仿真, no. 05, 15 October 2012 (2012-10-15) *
阳王东;吴宏斌;祝青;: "一种基于服务空间的服务提供模型", 小型微型计算机系统, no. 11, 15 November 2008 (2008-11-15) *

Similar Documents

Publication Publication Date Title
US12381943B2 (en) Web service system and method
US6757899B2 (en) Dynamic CORBA gateway for CORBA and non-CORBA clients and services
US7664844B2 (en) Managing network errors communicated in a message transaction with error information using a troubleshooting agent
EP2948865B1 (en) Instance host configuration
US20150215163A1 (en) Instance host configuration
CN109815025B (en) A business model calling method, device and storage medium
CN110647332A (en) Software deployment method and device based on container cloud
CN113821352A (en) Remote service calling method and device
CN112988385B (en) Request processing method, device, system, storage medium and electronic device
CN112306984A (en) Data source routing method and device
CN113779004A (en) Data verification method and device
CN109104368B (en) A method, device, server and computer-readable storage medium for requesting connection
CN113973139A (en) Message processing method and device
CN114285859B (en) Data processing method, device, equipment and storage medium for middle layer block chain service
CN111353880A (en) Transaction service encapsulation method, device and system
US8990286B2 (en) Integration of web services with a clustered actor based model
CN113992641B (en) Data processing method, device, equipment and storage medium
EP3398304A1 (en) Network service requests
CN119105887B (en) Message processing method, device, electronic device and storage medium
Indrasiri Introduction to WSO2 ESB
CN110780915B (en) Data processing method, device and storage medium
CN113778479A (en) A service proxy method and device
US12120205B2 (en) Communication protocol for a distributed event streaming platform
CN118796504A (en) A middleware communication system, method, vehicle-mounted terminal and storage medium
CN109660573B (en) Data transmission method and device

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20211210