CN111970338A - Request processing method and device based on cloud function and computer readable medium - Google Patents

Request processing method and device based on cloud function and computer readable medium Download PDF

Info

Publication number
CN111970338A
CN111970338A CN202010751036.9A CN202010751036A CN111970338A CN 111970338 A CN111970338 A CN 111970338A CN 202010751036 A CN202010751036 A CN 202010751036A CN 111970338 A CN111970338 A CN 111970338A
Authority
CN
China
Prior art keywords
function
action
cloud
request message
calling
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
CN202010751036.9A
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.)
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 CN202010751036.9A priority Critical patent/CN111970338A/en
Publication of CN111970338A publication Critical patent/CN111970338A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The embodiment of the application provides a request processing method and device based on a cloud function and a computer readable medium. The request processing method based on the cloud function comprises the following steps: receiving a request message sent by a calling terminal by calling a specified cloud function, wherein the request message comprises an action parameter; determining a target action function from a plurality of action functions contained in the specified cloud function according to the action parameters contained in the request message; routing the request message to the target action function, and receiving a processing result returned by the target action function aiming at the request message; and sending the processing result to the specified cloud function so that the specified cloud function forwards the processing result to the calling terminal. According to the technical scheme, the compiling of the cloud function can be standardized and normalized, so that the cloud function is high in maintainability, and the cloud function granularity can be reduced.

Description

Request processing method and device based on cloud function and computer readable medium
Technical Field
The present application relates to the field of computer and communication technologies, and in particular, to a request processing method and apparatus based on a cloud function, and a computer readable medium.
Background
At present, a server-free cloud architecture exists in the technical field of cloud computing, and the architecture enables a user to call a function in a cloud, namely a cloud function, wherein the cloud function is a code running on a cloud end (namely a cloud server), a management server is not needed, the function is compiled in a developer tool, and the function can run on a cloud server end after being uploaded and deployed to the cloud end.
The traditional calling method generally corresponds to a cloud function for a request of a user, however, the request processing method has many defects.
Disclosure of Invention
Embodiments of the present application provide a request processing method and apparatus based on a cloud function, and a computer readable medium, so that writing of the cloud function can be standardized and normalized at least to a certain extent, and thus, maintainability is stronger, and cloud function granularity can be reduced.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of the embodiments of the present application, a request processing method based on a cloud function is provided, where the cloud function includes a plurality of action functions, and the action functions are respectively used for processing different action parameters, and the method includes: receiving a request message sent by a calling terminal by calling a specified cloud function, wherein the request message comprises an action parameter; determining a target action function from a plurality of action functions contained in the specified cloud function according to the action parameters contained in the request message; routing the request message to the target action function, and receiving a processing result returned by the target action function aiming at the request message; and sending the processing result to the specified cloud function so that the specified cloud function forwards the processing result to the calling terminal.
According to an aspect of the embodiments of the present application, a request processing method based on a cloud function is provided, where the cloud function includes a plurality of action functions, and the action functions are respectively used for processing different action parameters, and the method includes: receiving a call of a call terminal, and sending a request message of the call terminal to a cloud controller, wherein the request message is used for enabling the cloud controller to determine a target action function according to an action parameter contained in the request message, and the target action function is used for processing the request message; and receiving a processing result returned by the target action function sent by the cloud controller, and sending the processing result to the calling terminal.
According to an aspect of the embodiments of the present application, there is provided a request processing apparatus based on a cloud function, where the cloud function includes a plurality of action functions, and the action functions are respectively used for processing different action parameters, the apparatus including: the cloud function scheduling device comprises a first receiving unit, a second receiving unit and a processing unit, wherein the first receiving unit is configured to receive a request message sent by a calling terminal through calling a specified cloud function, and the request message comprises an action parameter; a determining unit configured to determine a target action function from a plurality of action functions included in the specified cloud function according to the action parameter included in the request message; the routing unit is configured to route the request message to the target action function and receive a processing result returned by the target action function for the request message; the first sending unit is configured to send the processing result to the specified cloud function, so that the specified cloud function forwards the processing result to the calling terminal.
In some embodiments of the present application, based on the foregoing scheme, the determining unit is further configured to: acquiring an action function matched with the action function identifier from a plurality of action functions contained in the specified cloud function according to the action function identifier contained in the action parameter; and if the obtained action function is a function which can be called by the calling terminal, taking the obtained action function as the target action function.
In some embodiments of the present application, based on the foregoing scheme, the determining unit is further configured to: detecting the obtained identification information of the action function; and determining the calling authority of the action function according to whether the identification information contains the designated characters or not, wherein the calling authority is used for indicating the type of a calling terminal capable of calling the action function.
In some embodiments of the present application, based on the foregoing scheme, the determining unit is further configured to: and if the obtained action function is a function which cannot be called by the calling terminal, returning a message which cannot be called to the calling terminal through the specified cloud function.
In some embodiments of the present application, based on the foregoing scheme, the number of the plurality of action functions included in the specified cloud function does not exceed a preset threshold.
According to an aspect of the embodiments of the present application, there is provided a request processing apparatus based on a cloud function, where the cloud function includes a plurality of action functions, and the action functions are respectively used for processing different action parameters, the apparatus including: a second receiving unit, configured to receive a call of a call end, and send a request message of the call end to a cloud controller, where the request message is used to enable the cloud controller to determine a target action function according to an action parameter included in the request message, and the target action function is used to process the request message; and the second sending unit is configured to receive a processing result returned by the target action function sent by the cloud controller and send the processing result to the calling end.
In some embodiments of the present application, based on the foregoing solution, the second receiving unit is further configured to receive a call of the calling end, and send a request message that the calling end includes a back-reference format to the cloud controller; the second sending unit is further configured to receive a processing result, sent by the cloud controller, returned by the target action function according to the back-reference format.
According to an aspect of embodiments of the present application, there is provided a computer-readable medium on which a computer program is stored, the computer program, when executed by a processor, implementing a cloud function-based request processing method as described in the above embodiments.
In the technical solutions provided in some embodiments of the present application, after a request message sent by a call terminal by calling a specified cloud function is received, a target action function is determined from a plurality of action functions included in the specified cloud function according to an action parameter included in the request message, the request message is routed to the target action function, a processing result returned by the target action function for the request message is received, and the processing result is sent to the specified cloud function, so that the specified cloud function forwards the processing result to the call terminal. The cloud function in the embodiment of the application comprises a plurality of action functions which are respectively used for processing different action parameters, so that the problem of irregular writing method in the cloud function can be avoided by standardizing the writing method of the cloud function through the action functions, the style of the cloud function is more uniform, the maintainability is stronger, different requests can be responded by the action functions, the similar requests can be routed to one cloud function for processing, and the problem of larger cloud function call delay caused by excessively fine cloud function granularity is avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 is a diagram illustrating an exemplary system architecture to which aspects of embodiments of the present application may be applied;
FIG. 2 illustrates a flow diagram of a cloud function based request processing method according to one embodiment of the present application;
FIG. 3 illustrates a flow diagram of a method for request processing based on cloud functions according to one embodiment of the present application;
FIG. 4 illustrates a flow diagram of a method for request processing based on cloud functions according to one embodiment of the present application;
FIG. 5 illustrates a flow diagram of a method for request processing based on cloud functions according to one embodiment of the present application;
FIG. 6 illustrates a flow diagram of a method for request processing based on cloud functions according to one embodiment of the present application;
7A-7D illustrate logic decision diagrams for a cloud function based request processing method according to one embodiment of the present application;
FIG. 8 shows a block diagram of a request processing device based on cloud functions according to one embodiment of the present application;
FIG. 9 shows a block diagram of a request processing device based on cloud functions according to one embodiment of the present application;
FIG. 10 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
It is to be noted that the terms used in the specification and claims of the present application and the above-described drawings are only for describing the embodiments and are not intended to limit the scope of the present application. It will be understood that the terms "comprises," "comprising," "includes," "including," "has," "having," and the like, when used herein, specify the presence of stated features, integers, steps, operations, elements, components, and/or groups thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It will be further understood that, although the terms first, second, third, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element could be termed a second element without departing from the scope of the present invention. Similarly, a second element may be termed a first element. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It should be understood that in the present application, "at least one" means one or more, "a plurality" means two or more.
Before further detailed description of the embodiments of the present application, terms and expressions referred to in the embodiments of the present application will be described, and the terms and expressions referred to in the embodiments of the present application will be used for the following explanation.
Cloud technology (cloud technology): based on the general names of network technology, information technology, integration technology, management platform technology, application technology and the like applied in the cloud computing business model, a resource pool can be formed and used as required, and the cloud computing business model is flexible and convenient. Cloud computing technology will become an important support. Background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture-like websites and more web portals. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
Cloud computing (cloud computing): a computing model distributes computing tasks across a pool of resources formed by a large number of computers, enabling various application systems to acquire computing power, storage space, and information services as needed. The network that provides the resources is referred to as the "cloud". Resources in the "cloud" appear to the user as being infinitely expandable and available at any time, available on demand, expandable at any time, and paid for on-demand.
As a basic capability provider of cloud computing, a cloud computing resource pool (called as an ifas (Infrastructure as a Service) platform for short is established, and multiple types of virtual resources are deployed in the resource pool and are selectively used by external clients.
According to the logic function division, a PaaS (Platform as a Service) layer can be deployed on an IaaS (Infrastructure as a Service) layer, a SaaS (Software as a Service) layer is deployed on the PaaS layer, and the SaaS can be directly deployed on the IaaS. PaaS is a platform on which software runs, such as a database, a web container, etc. SaaS is a variety of business software, such as web portal, sms, and mass texting. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
Cloud function: the code running on the cloud end (namely the cloud server) is written in a developer tool without a management server, and the code can run on the cloud server end after being uploaded and deployed to the cloud end. In terms of physical design, a cloud function can be composed of a plurality of files, and occupies a certain amount of computing resources such as CPU memory. The cloud functions are completely independent and can be respectively deployed in different regions. Cloud functions can be called by the end side, and meanwhile, cloud functions can also be called mutually.
The action function is as follows: the code branches of different requests are realized in the cloud function, and one request is finally dispatched to an action function.
The action parameters are as follows: when each cloud function is called, an action parameter is transmitted, and the action parameter determines the code branch to which the request is dispatched.
A cloud controller: and code common to each cloud function, the cloud controller to route the request to the corresponding action function based on the action parameter.
At present, for a request processing method based on a cloud function, one request corresponds to one cloud function, however, the method causes a huge number of cloud functions, so that a large number of infrequently used cloud function resources are recovered, the probability of cold start is increased, and the delay of the current network service is increased. In addition, developers do not have a uniform and standard writing method when writing function codes, so that the function codes are very difficult to maintain, the cloud function coarse granularity is not controllable, uniform processing of bottom logic is not utilized, for example, uniform collection of request numbers, and routing of a type of request to one cloud function cannot be realized. Furthermore, some cloud functions only allow scheduling between cloud functions and do not allow access from the end side, and there is a way that a request corresponds to a cloud function that the exposed cloud function is not exposed to the end side.
In view of the above, an embodiment of the present application provides a request processing method based on a cloud function, where first, a request message sent by a call terminal by calling a specified cloud function is received, where the request message includes an action parameter, then, a target action function is determined from a plurality of action functions included in the specified cloud function according to the action parameter included in the request message, then, the request message is routed to the target action function, a processing result returned by the target action function for the request message is received, and finally, the processing result is sent to the specified cloud function, so that the specified cloud function forwards the processing result to the call terminal. The request processing method based on the cloud function provided by the embodiment of the application standardizes the writing method of the standardized cloud function by the action function, avoids the problem that the writing method in the cloud function is not standardized, enables the style of the cloud function to be more uniform, is higher in maintainability, responds to different requests by a plurality of action functions, routes similar requests to one cloud function for processing, and avoids the problem that the cloud function call delay is larger due to the fact that the cloud function granularity is too fine.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
As shown in fig. 1, system architecture 100 may include a calling end 101, a cloud function 102, an action function 103, and a cloud controller 104.
The calling terminal 101 may be various electronic devices with a display screen, the electronic devices include but are not limited to a desktop computer, a portable computer, a smart phone, a tablet computer, a camera, and the like, a plurality of Application (APP) clients may be installed on the electronic devices, and a user may initiate a request through different clients to obtain corresponding request data.
The cloud function 102 is code running on a cloud end (i.e., a cloud server), and the calling terminal 101 may send a call request for the cloud function 102 to the cloud end through a network according to a specified protocol, so as to call the code for executing the cloud function 102. The network is a medium for providing a communication link between the calling terminal 101 and the cloud terminal, and may include various connection types, such as a wired communication link, a wireless communication link, or a fiber optic cable.
The cloud function 102 may include a plurality of action functions 103, where the action functions 103 are respectively used to process different request messages of the calling terminal 101, and the cloud controller 104 is used to route different request messages of the calling terminal 101 to different action functions 103.
It should be understood that the number of call ends 101, cloud functions 102, action functions 103, and cloud controllers 104 in fig. 1 is merely illustrative. There may be any number of call ends 101, cloud functions 102, action functions 103, and cloud controllers 104, as desired for an implementation.
In an embodiment of the present application, after receiving a request message containing an action parameter, which is sent by a calling terminal 101 calling a cloud function 102, a cloud controller 104 may determine a target action function from a plurality of action functions 103 included in the cloud function 102 according to the action parameter contained in the request message, then route the request message to the target action function, receive a processing result returned by the target action function for the request message, and finally, the cloud controller 104 may send the processing result to the cloud function 102, so that the cloud function 102 forwards the processing result to the calling terminal 101.
In an embodiment of the present application, the cloud controller 104 may obtain, from the plurality of action functions 103 included in the cloud function 102, an action function 103 that matches the action function identification according to the action function identification included in the action parameter. Illustratively, the action function identification, includes the action function name. Of course, in other embodiments, the action function identification may also include an action function name and an additional label. The additional flag is an auxiliary flag for adding the action function. It is to be appreciated that the additional indicia can include at least one of an action function identity indicia and an action function location indicia. And the action function identity mark is used for showing and emphasizing the action function identity. The action function position mark is a position for showing the action function creation.
In an embodiment of the present application, if the obtained action function 103 matching the action function identifier by the cloud controller 104 is a function that can be called by the calling terminal 101, the cloud controller 104 may use the obtained action function 103 matching the action function identifier as a target action function.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 2 illustrates a flow diagram of a cloud function-based request processing method that may be performed by a cloud controller, which may be the cloud controller 104 shown in fig. 1, according to one embodiment of the present application. In this embodiment, the cloud function includes a plurality of action functions, and the plurality of action functions are respectively used for processing different action parameters, and as shown in fig. 2, the request processing method based on the cloud function includes:
step S210, receiving a request message sent by a calling terminal by calling a specified cloud function, wherein the request message comprises an action parameter;
step S220, determining a target action function from a plurality of action functions contained in the specified cloud function according to the action parameters contained in the request message;
step S230, routing the request message to the target action function, and receiving a processing result returned by the target action function for the request message;
step S240, sending the processing result to the specified cloud function, so that the specified cloud function forwards the processing result to the calling end.
These steps are described in detail below.
In step S210, a request message sent by the calling terminal by calling the specified cloud function is received, where the request message includes an action parameter.
In this embodiment, the cloud controller may receive the request message in a wired connection manner or a wireless connection manner. The request message is used for requesting the specified cloud function to carry out corresponding response. For example: during registration, the request message is used for requesting the specified cloud function to return a registration result; and when the user information is inquired, the request message is used for requesting the specified cloud function to return the user information.
The request message contains action parameters, the action parameters are parameters which are required to be uploaded by a calling terminal when the specified cloud function is called, and the action parameters are used for enabling the cloud controller to determine an action function for processing the request message from a plurality of action functions contained in the specified cloud function.
It should be further noted that the calling end is a calling side of the cloud function, in some embodiments, the calling end may be a terminal, the terminal may be various electronic devices including but not limited to a desktop computer, a portable computer, a smart phone, a tablet computer, a camera, and the like, a client of multiple application programs (APP) may be installed on the terminal, and a user may trigger calling of the cloud function through different clients. In other embodiments, since cloud functions may also be called from each other, the calling end may also include a cloud function.
In step S220, a target action function is determined from the plurality of action functions included in the specified cloud function according to the action parameter included in the request message.
The cloud function can be specified to include a plurality of action functions, and the cloud controller can determine a target action function from the plurality of action functions included in the specified cloud function and process a request message of a calling end through the target action function.
In one embodiment, the manner of determining the target action function according to the action parameters contained in the request message may be by defining the action parameters by the name of the action function, for example, the action parameters: { act: and the name of the action function, after the action parameters are obtained, a target action function with the same name as the name of the action function in the action parameters can be determined from a plurality of action functions contained in the specified cloud function according to the name of the action function in the action parameters.
In step S230, the request message is routed to the target action function, and a processing result returned by the target action function for the request message is received.
After determining the target action function, the cloud controller can directly distribute the request message to the target action function so that the target action function responds to the received request message, and then the target action function returns a processing result to the cloud controller.
In step S240, after receiving the processing result, the cloud controller may send the processing result to the specified cloud function, so that the specified cloud function forwards the processing result to the calling end.
Based on the technical scheme of the embodiment, the cloud function comprises a plurality of action functions, the writing method of the cloud function is normalized through the action functions, the problem that the writing method in the cloud function is not normalized is avoided, the style of the cloud function is more uniform, the maintainability is higher, meanwhile, the action functions respond to different requests, the similar requests are routed to one cloud function for processing, and compared with the traditional method that one request corresponds to one cloud function, the technical scheme of the embodiment of the application avoids the problem that the cloud function call delay is larger due to the fact that the cloud function granularity is too fine.
In an embodiment of the present application, determining the target action function according to the action parameter included in the request message may be determining according to an action function identifier included in the action parameter, and in this embodiment, as shown in fig. 3, step S220 may specifically include steps S2201-S2202, which are described in detail as follows:
step S2201, according to the action function identifier included in the action parameter, obtaining an action function matching the action function identifier from the plurality of action functions included in the specified cloud function.
Specifically, the action parameter includes an action function identifier, and after the cloud controller acquires the request message including the action parameter, the cloud controller may further acquire, according to the action function identifier included in the action parameter, an action function matched with the action function identifier from a plurality of action functions included in the specified cloud function.
In some embodiments, the action function identification includes an action function name. In other embodiments, the action function identification may also include an action function name and an additional label. The additional flag is an auxiliary flag for adding the action function. It will be appreciated that the additional indicia may include at least one of an action function identity indicia and an action function location indicia. And the action function identity mark is used for showing and emphasizing the action function identity. The action function position mark is a position for showing the action function creation.
In step S2202, if the acquired action function is a function that can be called by the calling terminal, the acquired action function is taken as the target action function.
In this embodiment, only when the obtained action function can be called by the calling terminal, the obtained action function may be used as the target action function, so that the request message of the calling terminal is processed by the target action function.
Conversely, if the obtained action function is not a function that can be called by the calling end, it indicates that the obtained action function is not a target action function and cannot be used to process a request message of the calling end, and in an embodiment, in a case that the obtained action function is not a function that can be called by the calling end, an invokable message may be returned to the calling end, in this embodiment, the method further includes:
and if the obtained action function is a function which cannot be called by the calling terminal, returning a message which cannot be called to the calling terminal through the specified cloud function.
According to the technical scheme, after the cloud controller acquires the action function according to the action parameters, whether the acquired action function can be called is further judged, and the acquired action function is used as the target action function only under the condition that the action function can be called by the calling terminal so as to be used for processing the request message of the calling terminal.
In an embodiment of the present application, whether the action function can be called can be determined according to the identification information of the action function, in this embodiment, as shown in fig. 4, the method further includes steps S410 to S420, which are described in detail as follows:
and step S410, detecting the acquired identification information of the action function.
In order to determine whether the action function can be called by the calling terminal, the cloud controller may detect identification information of the obtained action function, where the identification information may be any identifier having an identification function, and for example, the identification information is a character such as an underline, a wavy line, an asterisk, and the like.
Step S420, determining a calling authority of the action function according to whether the identification information includes a designated character, where the calling authority is used to indicate a calling terminal type capable of calling the action function.
After the identification information is detected, determining a calling authority of the action function according to whether the identification information contains the designated character, where the calling authority is used to indicate a calling terminal type capable of calling the action function, where the calling terminal type may include, but is not limited to, a terminal, a cloud function, and so on.
Specifically, determining the calling authority of the action function according to whether the identification information includes the specified character may be that, if the identification information includes the specified character, determining that the type of the calling terminal capable of calling the action function is the terminal, otherwise, if the identification information does not include the specified character, determining that the type of the calling terminal capable of calling the action function is the cloud function. Of course, if the identification information includes the specified character, it may be determined that the type of the call end capable of calling the action function is the cloud function, and conversely, if the identification information does not include the specified character, it may be determined that the type of the call end capable of calling the action function is the terminal.
In order to ensure the normal operation of the cloud function, according to any embodiment, the number of the plurality of action functions included in the specified cloud function does not exceed a preset threshold.
It can be understood that if the designated cloud function includes too many action functions, the cloud function code is inevitably redundant, the execution difficulty is increased, and a fault is likely to occur, so that the number of the action functions included in the designated cloud function may be set not to exceed a preset threshold, and the preset threshold may be set according to an actual situation, for example, in combination with actual situations such as the development difficulty of the cloud function, the request load amount, and the like.
In this embodiment, if the number of the plurality of action functions included in the specified cloud function exceeds the preset threshold, the cloud controller may directly return error information to the calling terminal after receiving a request message sent by the calling terminal by calling the specified cloud function.
Fig. 5 illustrates a flowchart of a cloud function-based request processing method according to an embodiment of the present application, which may be performed by a cloud function of a cloud, which may be the cloud function 102 illustrated in fig. 1. Referring to fig. 5, the request processing method based on the cloud function includes:
step S510, receiving a call of a call end, and sending a request message of the call end to a cloud controller, wherein the request message is used for enabling the cloud controller to determine a target action function according to an action parameter contained in the request message, and the target action function is used for processing the request message;
and step S520, receiving a processing result returned by the target action function sent by the cloud controller, and sending the processing result to the calling end.
These steps are described in detail below.
In step S510, a call of a call end is received, and a request message of the call end is sent to a cloud controller, where the request message is used to enable the cloud controller to determine a target action function according to an action parameter included in the request message, and the target action function is used to process the request message.
In this embodiment, after receiving the call of the call terminal through the network, the cloud function may send the request message of the call terminal to the cloud controller, so that the cloud controller determines the target action function from the plurality of action functions included in the cloud function according to the action parameters included in the request message. The target action function may be used to process the request message of the calling side.
In step S520, a processing result returned by the target action function sent by the cloud controller is received, and the processing result is sent to the calling end.
After the target action function processes the request message, a processing result can be returned to the cloud controller, after the cloud controller receives the processing result, the processing result is forwarded to the cloud function, and finally, the cloud function sends the processing result to the calling end.
In an embodiment of the present application, in order to enable the target action function to return the processing result according to the agreed format, the calling end may include a back-reference format in the sent request message, where the back-reference format is used to instruct the target action function to return the processing result according to the back-reference format, and in this embodiment, as shown in fig. 6, the method may specifically include step S610 to step S620, which is described in detail below:
and step S610, receiving the call of the calling terminal, and sending the request message of the calling terminal containing the echo format to the cloud controller.
It should be noted that, in this embodiment, a request message that the cloud function receives a call from the calling end through the network includes a callback format, where the callback format is used to define a data format of a processing result returned by the target action function, for example, the data format returned by the target action function may be in a Json format (JavaScript Object Notation, JS Object Notation). Json has a simple and clear hierarchical structure, is easy to read and write by people, is easy to analyze and generate by a machine, and can effectively improve the network transmission efficiency.
And step S620, receiving a processing result returned by the target action function according to the back reference format and sent by the cloud controller.
After the cloud function sends the request message containing the back-reference format to the cloud controller through step S610, the cloud controller forwards the request message to the target action function, and the target action function returns the processing result to the cloud controller according to the back-reference format after processing the request message, so that the cloud function can receive the processing result returned by the target action function sent by the cloud controller according to the back-reference format.
Fig. 7A-7D illustrate logic decision diagrams for a cloud function based request processing method according to an embodiment of the present application.
As shown in fig. 7A, in an embodiment of the present application, for a specified cloud function, a cloud controller may determine whether the number of a plurality of action functions included in the specified cloud function exceeds a preset threshold, if not, the cloud controller may obtain an action function from the plurality of action functions included in the specified cloud function according to an action parameter included in a request message, if the obtained action function is a function that can be called by a calling end, the obtained action function is taken as a target action function, and if the obtained action function is a function that cannot be called by the calling end, an invokable message is returned to the calling end, which specifically includes the following steps:
step S11, judging whether the number of the plurality of action functions contained in the designated cloud function exceeds a preset threshold value, if not, executing step S12; otherwise, an error message is returned to the calling terminal.
Step S12 is to acquire an action function from a plurality of action functions included in the specified cloud function.
As shown in fig. 7B, in an embodiment of the application, after obtaining an action function from a plurality of action functions included in a specified cloud function according to an action parameter included in a request message, if the obtained action function is a function that cannot be called by a calling end, returning an invokable message to the calling end, if the obtained action function is a function that can be called by the calling end, the cloud controller may further determine, for the specified cloud function, whether the number of the plurality of action functions included in the specified cloud function exceeds a preset threshold, and if not, taking the obtained action function as a target action function, which specifically includes the following steps:
step S21, judging whether the number of the plurality of action functions contained in the designated cloud function exceeds a preset threshold value, if not, executing step S22; otherwise, an error message is returned to the calling terminal.
In step S22, the acquired operation function is set as a target operation function.
As shown in fig. 7C, in an embodiment of the present application, for an action function obtained by a cloud controller from a plurality of action functions included in a specified cloud function, if the obtained action function includes a specified character, it may be determined that the obtained action function is a function that can be called by a calling end, that is, a target action function, specifically including the following steps:
step S31, judging that the obtained action function contains the designated character, if yes, executing step S32; otherwise, returning the non-invokable message to the calling end.
In step S32, the acquired operation function is set as a target operation function.
As shown in fig. 7D, in an embodiment of the present application, for an action function obtained by a cloud controller from a plurality of action functions included in a specified cloud function, if the obtained action function does not include a specified character, it may be determined that the obtained action function is a function that can be called by a calling terminal, that is, a target action function, specifically including the following steps:
step S41, judging that the obtained action function contains the specified character, if not, executing step S42; otherwise, returning the non-invokable message to the calling end.
In step S42, the acquired operation function is set as a target operation function.
Embodiments of the apparatus of the present application are described below, which may be used to perform the image processing methods in the above-described embodiments of the present application. For details that are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the image processing method described above in the present application.
Fig. 8 is a block diagram illustrating a request processing apparatus based on a cloud function according to an embodiment of the present application, and referring to fig. 8, a request processing apparatus 800 based on a cloud function according to an embodiment of the present application includes: a first receiving unit 802, a determining unit 804, a routing unit 806 and a first sending unit 808.
The first receiving unit 802 is configured to receive a request message sent by a calling terminal by calling a specified cloud function, where the request message includes an action parameter; a determining unit 804, configured to determine a target action function from a plurality of action functions included in the specified cloud function according to the action parameter included in the request message; a routing unit 806, configured to route the request message to the target action function, and receive a processing result returned by the target action function for the request message; a first sending unit 808, configured to send the processing result to the specified cloud function, so that the specified cloud function forwards the processing result to the calling end.
In some embodiments of the present application, the determining unit 804 is further configured to: detecting the obtained identification information of the action function; and determining the calling authority of the action function according to whether the identification information contains the designated characters or not, wherein the calling authority is used for indicating the type of a calling terminal capable of calling the action function.
In some embodiments of the present application, the determining unit 804 is further configured to: and if the obtained action function is a function which cannot be called by the calling terminal, returning a message which cannot be called to the calling terminal through the specified cloud function.
In some embodiments of the present application, the number of the plurality of action functions included in the specified cloud function does not exceed a preset threshold.
Fig. 9 shows a block diagram of a request processing device based on cloud functions according to an embodiment of the present application.
Referring to fig. 9, a request processing apparatus 900 based on a cloud function according to an embodiment of the present application includes: a second receiving unit 902 and a second transmitting unit 904.
The second receiving unit 902 is configured to receive a call of a call end, and send a request message of the call end to the cloud controller, where the request message is used to enable the cloud controller to determine a target action function according to an action parameter included in the request message, and the target action function is used to process the request message; a second sending unit 904, configured to receive a processing result returned by the target action function sent by the cloud controller, and send the processing result to the calling end.
In some embodiments of the present application, the second receiving unit 902 is further configured to receive a call of the calling end, and send a request message containing a back reference format of the calling end to the cloud controller; the second sending unit 904 is further configured to receive a processing result, sent by the cloud controller, returned by the target action function according to the back-reference format.
FIG. 10 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1000 of the electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 10, the computer system 1000 includes a Central Processing Unit (CPU)1001 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1002 or a program loaded from a storage portion 1008 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for system operation are also stored. The CPU 1001, ROM 1002, and RAM 1003 are connected to each other via a bus 1004. An Input/Output (I/O) interface 1005 is also connected to the bus 1004.
The following components are connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011. When the computer program is executed by a Central Processing Unit (CPU)1001, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may 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), a 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 application, 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 this application, however, a computer readable signal medium may include a propagated data signal with a computer program 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. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, 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 application. 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 units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A request processing method based on a cloud function is characterized in that the cloud function comprises a plurality of action functions, and the action functions are respectively used for processing different action parameters, and the method comprises the following steps:
receiving a request message sent by a calling terminal by calling a specified cloud function, wherein the request message comprises an action parameter;
determining a target action function from a plurality of action functions contained in the specified cloud function according to the action parameters contained in the request message;
routing the request message to the target action function, and receiving a processing result returned by the target action function aiming at the request message;
and sending the processing result to the specified cloud function so that the specified cloud function forwards the processing result to the calling terminal.
2. The method according to claim 1, wherein determining a target action function from a plurality of action functions included in the specified cloud function according to the action parameter included in the request message comprises:
acquiring an action function matched with the action function identifier from a plurality of action functions contained in the specified cloud function according to the action function identifier contained in the action parameter;
and if the obtained action function is a function which can be called by the calling terminal, taking the obtained action function as the target action function.
3. The method of claim 2, further comprising:
detecting the obtained identification information of the action function;
and determining the calling authority of the action function according to whether the identification information contains the designated characters or not, wherein the calling authority is used for indicating the type of a calling terminal capable of calling the action function.
4. The method of claim 2, further comprising:
and if the obtained action function is a function which cannot be called by the calling terminal, returning a message which cannot be called to the calling terminal through the specified cloud function.
5. The method according to any one of claims 1 to 4, wherein the number of the plurality of action functions included in the specified cloud function does not exceed a preset threshold.
6. A request processing method based on a cloud function is characterized in that the cloud function comprises a plurality of action functions, and the action functions are respectively used for processing different action parameters, and the method comprises the following steps:
receiving a call of a call terminal, and sending a request message of the call terminal to a cloud controller, wherein the request message is used for enabling the cloud controller to determine a target action function according to an action parameter contained in the request message, and the target action function is used for processing the request message;
and receiving a processing result returned by the target action function sent by the cloud controller, and sending the processing result to the calling terminal.
7. The method of claim 6, wherein receiving the call of the calling terminal and sending the request message of the calling terminal to the cloud controller comprises:
receiving the call of the calling terminal, and sending a request message containing a back reference format of the calling terminal to the cloud controller;
receiving a processing result returned by the target action function sent by the cloud controller, wherein the processing result comprises:
and receiving a processing result returned by the target action function according to the back reference format and sent by the cloud controller.
8. A request processing device based on a cloud function, wherein the cloud function includes a plurality of action functions, and the action functions are respectively used for processing different action parameters, the device comprising:
the cloud function scheduling device comprises a first receiving unit, a second receiving unit and a processing unit, wherein the first receiving unit is configured to receive a request message sent by a calling terminal through calling a specified cloud function, and the request message comprises an action parameter;
a determining unit configured to determine a target action function from a plurality of action functions included in the specified cloud function according to the action parameter included in the request message;
the routing unit is configured to route the request message to the target action function and receive a processing result returned by the target action function for the request message;
the first sending unit is configured to send the processing result to the specified cloud function, so that the specified cloud function forwards the processing result to the calling terminal.
9. A request processing device based on a cloud function, wherein the cloud function includes a plurality of action functions, and the action functions are respectively used for processing different action parameters, the device comprising:
a second receiving unit, configured to receive a call of a call end, and send a request message of the call end to a cloud controller, where the request message is used to enable the cloud controller to determine a target action function according to an action parameter included in the request message, and the target action function is used to process the request message;
and the second sending unit is configured to receive a processing result returned by the target action function sent by the cloud controller and send the processing result to the calling end.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, implements the cloud function-based request processing method according to any one of claims 1 to 5, or implements the cloud function-based request processing method according to any one of claims 6 to 7.
CN202010751036.9A 2020-07-30 2020-07-30 Request processing method and device based on cloud function and computer readable medium Pending CN111970338A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010751036.9A CN111970338A (en) 2020-07-30 2020-07-30 Request processing method and device based on cloud function and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010751036.9A CN111970338A (en) 2020-07-30 2020-07-30 Request processing method and device based on cloud function and computer readable medium

Publications (1)

Publication Number Publication Date
CN111970338A true CN111970338A (en) 2020-11-20

Family

ID=73363680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010751036.9A Pending CN111970338A (en) 2020-07-30 2020-07-30 Request processing method and device based on cloud function and computer readable medium

Country Status (1)

Country Link
CN (1) CN111970338A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113238853A (en) * 2021-06-15 2021-08-10 上海交通大学 Server-free computing scheduling system and method based on function intermediate expression

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113238853A (en) * 2021-06-15 2021-08-10 上海交通大学 Server-free computing scheduling system and method based on function intermediate expression
CN113238853B (en) * 2021-06-15 2021-11-12 上海交通大学 Server-free computing scheduling system and method based on function intermediate expression

Similar Documents

Publication Publication Date Title
CN109117252B (en) Method and system for task processing based on container and container cluster management system
CN109359194B (en) Method and apparatus for predicting information categories
CN111818136A (en) Data processing method and device, electronic equipment and computer readable medium
CN109857577B (en) Access control method, device, medium, and electronic apparatus
CN109905431B (en) Message processing method and system, storage medium and electronic equipment
CN110706093A (en) Accounting processing method and device
CN110445632B (en) Method and device for preventing client from crashing
CN110609755A (en) Message processing method, device, equipment and medium for cross-block chain node
CN110287146A (en) Using the method, equipment and computer storage medium of downloading
CN113076153A (en) Interface calling method and device
CN115237589A (en) SR-IOV-based virtualization method, device and equipment
CN111176641B (en) Flow node execution method, device, medium and electronic equipment
CN111970338A (en) Request processing method and device based on cloud function and computer readable medium
CN110928594A (en) Service development method and platform
CN111010453B (en) Service request processing method, system, electronic device and computer readable medium
CN107045452B (en) Virtual machine scheduling method and device
CN111580883A (en) Application program starting method, device, computer system and medium
CN111062572A (en) Task allocation method and device
CN114301980A (en) Method, device and system for scheduling container cluster and computer readable medium
CN113127561B (en) Method and device for generating service single number, electronic equipment and storage medium
CN111241368B (en) Data processing method, device, medium and equipment
CN113791944A (en) Monitoring method and device of page timer, medium and electronic equipment
CN113312900A (en) Data verification method and device
CN112784187A (en) Page display method and device
CN113743425A (en) Method and device for generating classification model

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