CN114327896A - Micro-service-based activity calling method and platform - Google Patents

Micro-service-based activity calling method and platform Download PDF

Info

Publication number
CN114327896A
CN114327896A CN202111642014.XA CN202111642014A CN114327896A CN 114327896 A CN114327896 A CN 114327896A CN 202111642014 A CN202111642014 A CN 202111642014A CN 114327896 A CN114327896 A CN 114327896A
Authority
CN
China
Prior art keywords
micro
component
service
configuration
request
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
CN202111642014.XA
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.)
Guangzhou Pacific Computer Information Consulting Co ltd
Original Assignee
Guangzhou Pacific Computer Information Consulting 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 Guangzhou Pacific Computer Information Consulting Co ltd filed Critical Guangzhou Pacific Computer Information Consulting Co ltd
Priority to CN202111642014.XA priority Critical patent/CN114327896A/en
Publication of CN114327896A publication Critical patent/CN114327896A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention discloses a micro-service-based activity calling method and a platform, wherein the method is applied to a component micro-service module, the component micro-service module is in communication connection with a preset function micro-service module, the component micro-service module comprises a plurality of component micro-services, and the method comprises the following steps: when an activity request sent by any client is received, extracting activity target information corresponding to the activity request; selecting a target component microservice from the plurality of component microservices according to the activity target information; calling and executing the corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result; and returning an activity result to the client through the target component micro-service, so that the compatibility of the micro-service is improved, and the resource waste and the development cost are reduced.

Description

Micro-service-based activity calling method and platform
Technical Field
The invention relates to the technical field of micro services, in particular to an activity calling method and platform based on micro services.
Background
With the rapid development of automobile business, the cooperation with various manufacturers is more and more, and a great amount of activities in the field of automobile business need to be developed at present, and the activities have the following characteristics: firstly, the magnitude of the game is indefinite from the scale of the business, small-sized activities only have a plurality of pages and have single playing method, large-sized activities have a plurality of branch places, and the logic complexity of a plurality of playing methods is high; secondly, the development is usually completed within one to three weeks due to large quantity and short delivery cycle in terms of service frequency, and a plurality of projects may be developed in parallel in the same time period; finally, in business form, it typically involves a series of activity processes that combine one or more common marketing campaign play functions (e.g., entry, red envelope, draw, etc.), which, while fundamentally formally unchanged, vary in activity details.
In the prior art, partial iterative upgrade is usually performed by using an old system of the past activity, and delivery is performed by adopting a mode of redeployment or directly using an original project to update online; or aiming at the current business, the brand-new development is carried out by using the latest technical framework, and the method is particularly suitable for large-scale activities with novel playing methods and complex playing methods systems; or packaging the service logic of the old system into an activity product, and generating different activity ids by continuously building new activity products to realize simultaneous execution of a plurality of similar activities.
When the scheme is repeatedly developed every time, the active application service occupies a large amount of hardware resources, and meanwhile, the development based on the original old system is greatly limited by original logic and is difficult to be compatible, so that the waste of development resources is easily caused, and the development cost is increased.
Disclosure of Invention
The invention provides a method and a platform for calling activities based on micro-services, which solve the technical problems that the existing scheme occupies a large amount of hardware resources when repeatedly developed every time, and meanwhile, the development based on the original old system is greatly limited by the original logic and is difficult to be compatible, the waste of development resources is easily caused, and the development cost is increased.
The invention provides a micro-service-based activity calling method, which is applied to a component micro-service module, wherein the component micro-service module is in communication connection with a preset function micro-service module, the component micro-service module comprises a plurality of component micro-services, and the method comprises the following steps:
when an activity request sent by any client is received, extracting activity target information corresponding to the activity request;
selecting target component microservices from the plurality of component microservices according to the activity target information;
calling and executing a corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result;
and returning the activity result to the client through the target component microserver.
Optionally, the component microservice module is further communicatively connected to a preset configuration microservice module, and the method further includes:
when a data request sent by the configuration micro-service module responding to a configuration request of an external terminal is received, extracting configuration target information corresponding to the data request;
selecting a configuration function micro-service according to the configuration target information and returning a corresponding parameter configuration interface to the configuration micro-service module;
responding to the input parameters of the external terminal through the configuration micro-service module to perform parameter configuration on the parameter configuration interface until a configuration completion instruction is received;
and when receiving configuration completion information forwarded by the configuration micro-service module in response to the configuration completion instruction, creating an update component micro-service corresponding to the configuration function micro-service.
Optionally, the configuration microservice module includes a component name mapping table, and is specifically further configured to:
when a configuration request sent by the external terminal is received, carrying out user verification on the external terminal corresponding to the configuration request according to pre-stored user authentication information;
if the user verification is judged to be successful, extracting the request name in the configuration request and searching the component name mapping table to obtain request address information;
sending a data request to the component micro-service module according to the request address information;
and if the user authentication fails, returning an authentication failure prompt to the external terminal.
Optionally, the configuration microservice module further comprises a plurality of standardized interfaces, the method further comprising:
searching whether the updating component micro service exists according to a preset period;
if the update component micro service exists, acquiring address information and a component name corresponding to the update component micro service and forwarding the address information and the component name to the configuration micro service module;
adopting the address information and the component name to construct mapping information through the configuration micro-service module and caching the mapping information to the component name mapping table;
and connecting the updating component micro-service by adopting the standardized interface through the configuration micro-service module, and adding the updating component micro-service to the component micro-service module.
Optionally, the method further comprises:
when the receiving quantity of the activity request in unit time is larger than a first preset threshold value, calculating the sum of the receiving quantity in unit time and a preset request redundancy value to obtain capacity to be expanded;
acquiring a plurality of cloud server nodes according to the capacity to be expanded;
respectively associating the plurality of cloud server nodes to the target function micro-service and the target component micro-service according to a preset association ratio;
and when the receiving amount per unit time is less than or equal to a second preset threshold, reducing the number of the nodes of the cloud server node to a preset reference minimum value.
The invention also provides a micro-service-based activity calling platform, which comprises a component micro-service module and a functional micro-service module, wherein the component micro-service module is in communication connection with the functional micro-service module and comprises a plurality of component micro-services;
the component micro-service module is used for extracting activity target information corresponding to an activity request when the activity request sent by any client is received; selecting target component microservices from the plurality of component microservices according to the activity target information; calling and executing a corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result; and returning the activity result to the client through the target component microserver.
And the functional microservice module is used for storing a plurality of functional microservices and responding to the calling of the target component microservices to execute the corresponding target functional microservices.
Optionally, the platform further comprises a configuration micro-service module, and the component micro-service module is in communication connection with the configuration micro-service module;
the configuration micro-service module is used for responding to a configuration request of an external terminal, generating a data request and forwarding the data request to the component micro-service module;
the component micro-service module is further used for extracting configuration target information corresponding to the data request when the data request is received; selecting a configuration function micro-service according to the configuration target information and returning a corresponding parameter configuration interface to the configuration micro-service module;
the configuration micro-service module is also used for responding the input parameters of the external terminal to perform parameter configuration on the parameter configuration interface until a configuration completion instruction is received, and forwarding configuration completion information to the component micro-service module;
and the component micro-service module is also used for creating an updated component micro-service corresponding to the configuration function micro-service when the configuration completion information is received.
Optionally, the configuration microservice module includes a component name mapping table, and is specifically further configured to:
when a configuration request sent by the external terminal is received, carrying out user verification on the external terminal corresponding to the configuration request according to pre-stored user authentication information;
if the user verification is judged to be successful, extracting the request name in the configuration request and searching the component name mapping table to obtain request address information;
sending a data request to the component micro-service module according to the request address information;
and if the user authentication fails, returning an authentication failure prompt to the external terminal.
Optionally, the configuration microservice module further comprises a plurality of standardized interfaces;
the component micro-service module is also used for retrieving whether the update component micro-service exists according to a preset period; if the update component micro service exists, acquiring address information and a component name corresponding to the update component micro service and forwarding the address information and the component name to the configuration micro service module;
the configuration micro-service module is also used for constructing mapping information by adopting the address information and the component name and caching the mapping information to the component name mapping table; and connecting the updating component micro-service by adopting the standardized interface, and adding the updating component micro-service to the component micro-service module.
Optionally, the component microservice module is further configured to:
when the receiving quantity of the activity request in unit time is larger than a first preset threshold value, calculating the sum of the receiving quantity in unit time and a preset request redundancy value to obtain capacity to be expanded;
acquiring a plurality of cloud server nodes according to the capacity to be expanded;
respectively associating the plurality of cloud server nodes to the target function micro-service and the target component micro-service according to a preset association ratio;
and when the receiving amount per unit time is less than or equal to a second preset threshold, reducing the number of the nodes of the cloud server node to a preset reference minimum value.
According to the technical scheme, the invention has the following advantages:
the component micro-service module is in communication connection with a preset function micro-service module, the component micro-service module comprises a plurality of component micro-services, and when the component micro-service module receives an activity request sent by any client, activity target information corresponding to the activity request is extracted; selecting target component microservices from the plurality of component microservices according to the activity target information; calling and executing a corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result; and returning the activity result to the client through the target component microserver. Therefore, the technical problems that the active application service repeatedly developed in each time in the existing scheme occupies a large amount of hardware resources, and meanwhile, the development based on the original old system is greatly limited by original logic and difficult to be compatible, the waste of development resources is easily caused, and the development cost is increased are solved, so that the compatibility of micro-services is improved, and the resource waste and the development cost are reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
FIG. 1 is a flowchart illustrating steps of a method for invoking an activity based on microservice according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of hot-plug of a component microservice in accordance with an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a process of dynamically expanding target function microservices and target component microservices according to an embodiment of the present invention;
FIG. 4 is a block diagram of a microservice-based activity call platform according to an embodiment of the present invention;
fig. 5 is a block diagram illustrating a structure of a microservice-based activity call platform according to another embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method and a platform for calling activities based on micro-services, which are used for solving the technical problems that the existing scheme occupies a large amount of hardware resources when repeatedly developed every time, and meanwhile, the development based on the original old system is greatly limited by the original logic and is difficult to be compatible, the waste of development resources is easily caused, and the development cost is increased.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating steps of a method for invoking an activity based on a microservice according to an embodiment of the present invention.
The invention provides a micro-service-based activity calling method, which is applied to a component micro-service module, wherein the component micro-service module is in communication connection with a preset function micro-service module, the component micro-service module comprises a plurality of component micro-services, and the method comprises the following steps:
step 101, when receiving an activity request sent by any client, extracting activity target information corresponding to the activity request;
the activity request refers to request information transmitted by the client, and is used for calling the corresponding function micro-service through the request so as to participate in the activity set by the external terminal corresponding to each automobile manufacturer.
In the embodiment of the invention, when an activity request sent by any client is received, the activity request is analyzed to extract the activity target information corresponding to the activity request, so that the activity target requested by the activity request is determined, and the component micro-service corresponding to the activity target is associated with the activity target.
102, selecting a target component micro-service from a plurality of component micro-services according to the activity target information;
in the embodiment of the invention, each component microservice is provided with an independent fixed function microservice calling path, and after the activity target information is extracted, the component microservice module matches the implementation function corresponding to each component microservice according to the activity target appointed by the activity target information, so that the target component microservice matched with the activity target information is selected from the component microservices.
103, calling and executing a corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result;
after the target component micro-service is selected, the corresponding target function micro-service is called from the function micro-service module through the target component micro-service along the set calling path, and the target function micro-service is executed at the same time to generate an activity result responding to the activity request.
And 104, returning an activity result to the client through the target component microservice.
And after the target function micro-service executes to generate an activity result, returning the activity result to the target component micro-service, and returning the activity result to the client through the target component micro-service.
Taking a red packet discount activity as an example, when any client sends an activity request participating in the red packet discount activity to the component micro-service module, the component micro-service module selects a target component micro-service corresponding to the red packet discount activity from the multiple component micro-services, and calls the corresponding target function micro-service from the function micro-service module through the target component micro-service according to a set calling path. At the moment, the target function micro-service checks whether the client side has the qualification of red packet discount extraction, if so, a corresponding discount red packet result can be generated according to the probability parameters, and the discount red packet result is returned to the client side through the target component micro-service.
Optionally, the component microservice module is further communicatively connected to a preset configuration microservice module, and the method further includes the following steps S11-S14:
s11, when receiving a data request sent by the micro-service configuration module responding to the configuration request of the external terminal, extracting configuration target information corresponding to the data request;
in the embodiment of the invention, the component micro-service module can be in communication connection with the configuration micro-service module, when the configuration micro-service module receives a configuration request input by an external terminal, the configuration micro-service module can verify the configuration request, if the verification is judged to be passed, the request name carried in the configuration micro-service module can be extracted, the corresponding request address information is determined, and a data request is sent to the component micro-service module according to the request address information; and after the component micro-service module receives the data request, extracting corresponding configuration target information in the data request so as to determine the configuration function micro-service required to be configured by the data request from the function micro-service module.
In an example of the present invention, the configuration microservice module includes a component name mapping table, and is further specifically configured to:
when a configuration request sent by an external terminal is received, carrying out user verification on the external terminal corresponding to the configuration request according to pre-stored user authentication information;
if the user verification is judged to be successful, extracting a request name in the configuration request and searching a component name mapping table to obtain request address information;
sending a data request to the component micro-service module according to the request address information;
and if the user authentication fails, returning an authentication failure prompt to the external terminal.
The external terminal refers to a product configuration terminal or an operation terminal, for example, a mobile phone, a tablet, a computer, and other terminal devices used by a product manager or an operator.
In this embodiment, the configuration microservice module includes a component name mapping table, and when the configuration microservice module receives a configuration request sent by an external terminal, the configuration microservice module can perform user verification on the external terminal corresponding to the configuration request according to user authentication information pre-stored in the configuration microservice module, so as to determine whether the external terminal has the permission of parameter configuration; if the user verification is judged to be successful, the request name in the configuration request can be further extracted and used as a keyword to search the component name mapping table, the request address information mapped by the request name is determined, and the data request is sent to the component micro-service corresponding to the request address information.
And if the user authentication fails, directly returning an authentication failure prompt to the external terminal on the configuration microservice module, and waiting for further input of the external terminal.
S12, selecting a configuration function micro service according to the configuration target information and returning a corresponding parameter configuration interface to the configuration micro service module;
s13, responding to the input parameters of the external terminal through the configuration micro-service module to perform parameter configuration on the parameter configuration interface until a configuration completion instruction is received;
and S14, when receiving the configuration completion information forwarded by the configuration micro service module responding to the configuration completion instruction, creating the update component micro service corresponding to the configuration function micro service.
After selecting the configuration function micro-service according to the configuration target information, returning a parameter configuration interface corresponding to each configuration function micro-service to the configuration micro-service module, responding to input parameters of an external terminal through the configuration micro-service module, performing parameter configuration in the parameter configuration interface until a configuration completion instruction sent by the external terminal is received, at the moment, forwarding configuration completion information to the component micro-service module, and recording a calling path of the configuration function micro-service through the component micro-service module so as to create an updated component micro-service corresponding to the configuration function micro-service.
Further, the configuration microservice module further includes a plurality of standardized interfaces, and the method further includes the following steps S21-S24:
s21, searching whether the update component micro service exists according to a preset period;
s22, if yes, obtaining the address information and component name corresponding to the update component micro service and forwarding to the configuration micro service module;
s23, constructing mapping information by configuring the micro-service module by adopting the address information and the component name and caching the mapping information to a component name mapping table;
and S24, connecting the update component micro-service by adopting a standardized interface through the configuration micro-service module, and adding the update component micro-service to the component micro-service module.
Due to different updating of activities, the activity updating time and the activity holding time have overlapping intervals, if the traditional activity micro-service calling scheme is adopted, the frequent updating of the activities cannot be met by stopping the activity holding and then updating the activities.
To this end, the configuration microservice module may provide a plurality of standardized interfaces, such as a parameter configuration function standardized interface and an operational data output capability standardized interface, through which the following features are provided: the interface of the micro-service module is configured to respond to the requests of a plurality of different request paths through path rules, and the names of the component micro-services to be called in the request paths can be obtained; the interface path provided by the component microservice also needs to respond according to a designed format; the interface of the micro service module and the interface of the component micro service are configured, and the information can be uniformly converted through codes among the receiving request heads, the request bodies, the response heads and the response bodies.
In one example, a standardized interface receives a Request that identifies a component name in the Request path in the format of "component/{ component name }/{ component configuration id }/remaining Request path … …", so that the configuration microservice module can retrieve the service name ServiceName of the component microservice to access it. During this request processing, the request path contains a name pointing to a unique component microservice (this component microservice may be either native in the system or newly added), which the operator service uses to retrieve its HOST in the caching middleware, so the configuration microservice module can initiate a standardized request for this HOST: the request path is the original interception of the rear part of the request path of the micro-service module; the request head, the request body and the request parameters all adopt the original clone in the request for configuring the micro-service module; and the response result of the component micro service is not processed and is returned as the response result of the configuration micro service module.
In another example, the interface responds to GET requests which are all in accordance with a "/_ x/export" path from the domain name of the configuration micro-service module, standardizes the request header of the GET requests and forwards the GET requests to downstream component micro-services, and after the component micro-services return to a file stream, the component micro-services are read in blocks by a request body and return in a standardized manner, so that the returned files can be directly provided to the front end of the configuration micro-service module. After the design, the component micro-service corresponding to the new hot insertion can respond to the standardized request body and return the file stream, and the configuration micro-service module can realize the response to the micro-service without iteration.
Whether the updating component micro service exists is searched according to a preset period, if yes, address information and a component name corresponding to the updating component micro service can be obtained and forwarded to the configuration micro service module, and the mapping information is constructed by the configuration micro service module by adopting the address information and the component name and is cached in a component name mapping table. Meanwhile, a standardized interface is adopted to connect the updating component micro-service, and the updating component micro-service is added to the component micro-service module, so that hot plug-in of the component micro-service is realized.
Referring to fig. 2, fig. 2 is a schematic diagram illustrating hot-plug of a component microservice according to an embodiment of the present invention.
In this embodiment, the component micro service module may provide the address information and the component name to the configuration micro service module by means of service discovery or registration. The configuration microservice module receives the request and can uniquely identify the component microservice to be invoked on the request path or at the request header or at the requestor. Processing the original path to obtain a path for calling the micro-service of the component, processing the original request head, the request body and the request parameter to obtain a new original request head, a new original request body and a new original request parameter, wherein the request modes need to ensure the consistency of processing logics when being designed.
For example, when the component microservice C needs to be hot-plugged, the component microservice C can be added to the component microservice module by loading the component microservice C with the standardized interface for parameter configuration function and the standardized interface for operation data output capability, and by connecting and configuring the respective standardized interfaces on the microservice module.
Optionally, the method further comprises the following steps S31-S34:
s31, when the unit time receiving quantity of the activity request is larger than a first preset threshold value, calculating the sum of the unit time receiving quantity and a preset request redundancy value to obtain the capacity to be expanded;
s32, acquiring a plurality of cloud server nodes according to the capacity to be expanded;
s33, respectively associating the cloud server nodes with a target function micro service and a target component micro service according to a preset association ratio;
and S34, when the receiving amount per unit time is smaller than or equal to a second preset threshold, reducing the number of the nodes of the cloud server nodes to a preset reference minimum value.
In another example of the present invention, if the received amount of the active request in a unit time is greater than a first preset threshold, a sum of the received amount in the unit time and a preset request redundancy value may be calculated to obtain the capacity to be expanded; acquiring a plurality of cloud server nodes according to the capacity to be expanded, and respectively associating the plurality of cloud service nodes to the target function micro-service and the target component micro-service according to a preset association proportion; and when the receiving amount per unit time is less than or equal to a second preset threshold, reducing the number of the nodes of the cloud server nodes to a preset reference minimum value.
It should be noted that the first preset threshold and the second preset threshold may be obtained by performing a pressure test on each component micro service or each functional micro service by an operation and maintenance worker to obtain the number of serviceable users of each functional micro service and a cloud server node associated with the component micro service in unit time, and the first preset threshold and the second preset threshold are set according to the number of serviceable users. When the average CPU load of the server container reaches a certain degree (such as 70%) or reaches other hardware index conditions, the k8s cluster of the cloud service can trigger elastic expansion to reduce the average load; accordingly, when the load is at the valley, the service capacity can be automatically contracted to the preset reference minimum value. Therefore, each expansion is the minimum hardware resource number needing expansion, and the high-sustainable and high-cost-performance state that the whole system always runs at the reasonable lowest hardware cost is achieved.
Referring to fig. 3, fig. 3 is a schematic diagram illustrating a process of dynamically expanding target function microservices and target component microservices according to an embodiment of the present invention.
In this embodiment, taking the "second ticket-killing" activity as an example, at the beginning of the activity, since the participating clients may not reach the peak value, the execution may be performed according to the originally set target component microservice, that is, the second ticket-killing component invokes the second ticket-killing microservice and the ticket-purchasing microservice in the function microservice module; and after the activity starts, the second ticket-killing and purchasing component, the second microservice service and the ticket-purchasing microservice service are monitored in real time, when the service capacity cannot meet the number of the requested persons, namely the receiving quantity in unit time is greater than a first preset threshold value, the sum of the receiving quantity in unit time and a preset request redundancy value is calculated at the moment, the capacity to be expanded is obtained, and the corresponding second ticket-killing and purchasing component and the second microservice service are respectively connected with a new cloud service node 8C32G so as to meet the requirement of the receiving quantity in unit time. However, as the number of coupons in the coupon purchase microservice is reduced, the number of participating clients is reduced, that is, the receiving amount per unit time is less than or equal to the second preset threshold, and at this time, according to a preset gradient, the number of nodes of the cloud server node is gradually reduced to a preset reference minimum value until the activity is finished.
Optionally, the component microservice module may perform custom configuration on each associated functional microservice in response to the configuration of the configuration microservice module, thereby implementing microservice multiplexing of the functional microservice.
In the embodiment of the invention, a component micro-service module is in communication connection with a preset function micro-service module, the component micro-service module comprises a plurality of component micro-services, and when the component micro-service module receives an activity request sent by any client, activity target information corresponding to the activity request is extracted; selecting a target component microservice from the plurality of component microservices according to the activity target information; calling and executing the corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result; and returning an activity result to the client through the target component microservice. Therefore, the technical problems that the active application service repeatedly developed in each time in the existing scheme occupies a large amount of hardware resources, and meanwhile, the development based on the original old system is greatly limited by original logic and difficult to be compatible, the waste of development resources is easily caused, and the development cost is increased are solved, so that the compatibility of micro-services is improved, and the resource waste and the development cost are reduced.
Referring to fig. 4, fig. 4 is a block diagram illustrating a structure of a micro-service based activity call platform according to an embodiment of the present invention.
The embodiment of the invention provides an activity calling platform based on micro-services, which comprises a component micro-service module 401 and a function micro-service module 402, wherein the component micro-service module 401 is in communication connection with the function micro-service module 402, and the component micro-service module 401 comprises a plurality of component micro-services;
the component micro-service module 401 is configured to, when receiving an activity request sent by any client, extract activity target information corresponding to the activity request; selecting a target component microservice from the plurality of component microservices according to the activity target information; calling and executing the corresponding target function micro service from the function micro service module 402 through the target component micro service to generate an activity result; and returning an activity result to the client through the target component microservice.
And the function microservice module 402 is configured to store a plurality of function microservices, and respond to the call of the target component microservices to execute corresponding target function microservices.
Optionally, the platform further includes a configuration micro-service module 403, and the component micro-service module 401 is in communication connection with the configuration micro-service module 403;
a configuration microservice module 403, configured to respond to a configuration request from an external terminal, generate a data request, and forward the data request to the component microservice module 401;
the component micro-service module 401 is further configured to, when receiving a data request, extract configuration target information corresponding to the data request; selecting a configuration function micro-service according to the configuration target information and returning a corresponding parameter configuration interface to the configuration micro-service module 403;
the configuration micro-service module 403 is further configured to respond to an input parameter of an external terminal to perform parameter configuration on the parameter configuration interface until a configuration completion instruction is received, and forward configuration completion information to the component micro-service module 401;
the component microserver module 401 is further configured to create an updated component microservice corresponding to the configuration function microservice when the configuration completion information is received.
Optionally, the micro service module 403 includes a component name mapping table, and is specifically further configured to:
when a configuration request sent by an external terminal is received, carrying out user verification on the external terminal corresponding to the configuration request according to pre-stored user authentication information;
if the user verification is judged to be successful, extracting a request name in the configuration request and searching a component name mapping table to obtain request address information;
sending a data request to the component micro service module 401 according to the request address information;
and if the user authentication fails, returning an authentication failure prompt to the external terminal.
Optionally, the configuration microservice module 403 further includes a plurality of standardized interfaces;
the component micro-service module 401 is further configured to retrieve whether an updated component micro-service exists according to a preset period; if the update component micro service exists, the address information and the component name corresponding to the update component micro service are acquired and forwarded to the configuration micro service module 403;
the micro-service module 403 is configured, and is further configured to construct mapping information by using the address information and the component name, and cache the mapping information to a component name mapping table; the updated component microservices are connected using standardized interfaces and added to the component microservices module 401.
Optionally, the component microserver module 401 is further configured to:
when the receiving quantity of the activity request in unit time is larger than a first preset threshold value, calculating the sum of the receiving quantity in unit time and a preset request redundancy value to obtain capacity to be expanded;
acquiring a plurality of cloud server nodes according to the capacity to be expanded; respectively associating the plurality of cloud server nodes to a target function micro-service and a target component micro-service according to a preset association ratio;
and when the receiving amount per unit time is less than or equal to a second preset threshold, reducing the number of the nodes of the cloud server nodes to a preset reference minimum value.
It should be noted that, the functional microservice executes an independent functional flow, and there is no duplicate portion in the code logic between the two microservices; information is not directly exchanged among the functional micro services, so that logical loose coupling is ensured; the function micro-service is compatible with the old version execution mode during the iterative upgrade, namely, after the parameters used during the initialization and execution of the function executor are increased and deleted, the original calling mode (including a calling path and calling parameters) can be correctly executed, thereby ensuring that the iterative process does not influence other parts of the platform system. The functional microservice is an application service, is generally deployed by using a cluster architecture, supports upstream load balancing, and is independently accessed into a set of unified distributed database system and a set of distributed cache system.
Referring to fig. 5, fig. 5 is a block diagram illustrating a microservice-based active call platform according to another embodiment of the present invention.
In this embodiment, the micro-service-based activity platform includes a configuration micro-service module, a component micro-service module, and a function micro-service module, where the configuration micro-service module includes an operation system, and an activity service and a user service providing data basis for the operation system; the component microservice module includes a plurality of component microservices A, B, C, etc., and the functional microservice module includes a plurality of functional microservices 1, 2, 3, etc.
In the operation process of the platform, a configuration request or an operation request sent by an external terminal is received by a configuration micro-service module and forwarded to a component micro-service module to realize the configuration of the functional micro-service; meanwhile, the component microservice module can receive activity requests sent by various clients through an 'API GATEWAY' gateway system (providing functions such as load balancing) by using an HTTP protocol, and after receiving the activity requests, call the function microservices 1, 2 and 3 to execute through the component microservice A, B, C and the like therein, so as to return corresponding activity results to the clients.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the platform and the module described above may refer to corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided by the present invention, it should be understood that the disclosed platform and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A micro-service-based activity calling method is applied to a component micro-service module, the component micro-service module is in communication connection with a preset function micro-service module, the component micro-service module comprises a plurality of component micro-services, and the method comprises the following steps:
when an activity request sent by any client is received, extracting activity target information corresponding to the activity request;
selecting target component microservices from the plurality of component microservices according to the activity target information;
calling and executing a corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result;
and returning the activity result to the client through the target component microserver.
2. The method of claim 1, wherein the component microservice module is further communicatively coupled to a pre-defined configuration microservice module, the method further comprising:
when a data request sent by the configuration micro-service module responding to a configuration request of an external terminal is received, extracting configuration target information corresponding to the data request;
selecting a configuration function micro-service according to the configuration target information and returning a corresponding parameter configuration interface to the configuration micro-service module;
responding to the input parameters of the external terminal through the configuration micro-service module to perform parameter configuration on the parameter configuration interface until a configuration completion instruction is received;
and when receiving configuration completion information forwarded by the configuration micro-service module in response to the configuration completion instruction, creating an update component micro-service corresponding to the configuration function micro-service.
3. The method according to claim 2, wherein the configuration microservice module comprises a component name mapping table, further configured to:
when a configuration request sent by the external terminal is received, carrying out user verification on the external terminal corresponding to the configuration request according to pre-stored user authentication information;
if the user verification is judged to be successful, extracting the request name in the configuration request and searching the component name mapping table to obtain request address information;
sending a data request to the component micro-service module according to the request address information;
and if the user authentication fails, returning an authentication failure prompt to the external terminal.
4. The method of claim 3, wherein the configuration microservice module further comprises a plurality of standardized interfaces, the method further comprising:
searching whether the updating component micro service exists according to a preset period;
if the update component micro service exists, acquiring address information and a component name corresponding to the update component micro service and forwarding the address information and the component name to the configuration micro service module;
adopting the address information and the component name to construct mapping information through the configuration micro-service module and caching the mapping information to the component name mapping table;
and connecting the updating component micro-service by adopting the standardized interface through the configuration micro-service module, and adding the updating component micro-service to the component micro-service module.
5. The method of claim 1, further comprising:
when the receiving quantity of the activity request in unit time is larger than a first preset threshold value, calculating the sum of the receiving quantity in unit time and a preset request redundancy value to obtain capacity to be expanded;
acquiring a plurality of cloud server nodes according to the capacity to be expanded;
respectively associating the plurality of cloud server nodes to the target function micro-service and the target component micro-service according to a preset association ratio;
and when the receiving amount per unit time is less than or equal to a second preset threshold, reducing the number of the nodes of the cloud server node to a preset reference minimum value.
6. An activity calling platform based on micro-services is characterized by comprising a component micro-service module and a function micro-service module, wherein the component micro-service module is in communication connection with the function micro-service module and comprises a plurality of component micro-services;
the component micro-service module is used for extracting activity target information corresponding to an activity request when the activity request sent by any client is received; selecting target component microservices from the plurality of component microservices according to the activity target information; calling and executing a corresponding target function micro service from the function micro service module through the target component micro service to generate an activity result; returning the activity result to the client through the target component microserver;
and the functional microservice module is used for storing a plurality of functional microservices and responding to the calling of the target component microservices to execute the corresponding target functional microservices.
7. The platform of claim 6, further comprising a configuration microservice module, the component microservice module communicatively coupled to the configuration microservice module;
the configuration micro-service module is used for responding to a configuration request of an external terminal, generating a data request and forwarding the data request to the component micro-service module;
the component micro-service module is further used for extracting configuration target information corresponding to the data request when the data request is received; selecting a configuration function micro-service according to the configuration target information and returning a corresponding parameter configuration interface to the configuration micro-service module;
the configuration micro-service module is also used for responding the input parameters of the external terminal to perform parameter configuration on the parameter configuration interface until a configuration completion instruction is received, and forwarding configuration completion information to the component micro-service module;
and the component micro-service module is also used for creating an updated component micro-service corresponding to the configuration function micro-service when the configuration completion information is received.
8. The platform of claim 7, wherein the configuration microservice module comprises a component name mapping table, further configured to:
when a configuration request sent by the external terminal is received, carrying out user verification on the external terminal corresponding to the configuration request according to pre-stored user authentication information;
if the user verification is judged to be successful, extracting the request name in the configuration request and searching the component name mapping table to obtain request address information;
sending a data request to the component micro-service module according to the request address information;
and if the user authentication fails, returning an authentication failure prompt to the external terminal.
9. The platform of claim 3, wherein the configuration microservices module further comprises a plurality of standardized interfaces;
the component micro-service module is also used for retrieving whether the update component micro-service exists according to a preset period; if the update component micro service exists, acquiring address information and a component name corresponding to the update component micro service and forwarding the address information and the component name to the configuration micro service module;
the configuration micro-service module is also used for constructing mapping information by adopting the address information and the component name and caching the mapping information to the component name mapping table; and connecting the updating component micro-service by adopting the standardized interface, and adding the updating component micro-service to the component micro-service module.
10. The platform of claim 6, wherein the component microservice module is further to:
when the receiving quantity of the activity request in unit time is larger than a first preset threshold value, calculating the sum of the receiving quantity in unit time and a preset request redundancy value to obtain capacity to be expanded;
acquiring a plurality of cloud server nodes according to the capacity to be expanded;
respectively associating the plurality of cloud server nodes to the target function micro-service and the target component micro-service according to a preset association ratio;
and when the receiving amount per unit time is less than or equal to a second preset threshold, reducing the number of the nodes of the cloud server node to a preset reference minimum value.
CN202111642014.XA 2021-12-29 2021-12-29 Micro-service-based activity calling method and platform Pending CN114327896A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111642014.XA CN114327896A (en) 2021-12-29 2021-12-29 Micro-service-based activity calling method and platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111642014.XA CN114327896A (en) 2021-12-29 2021-12-29 Micro-service-based activity calling method and platform

Publications (1)

Publication Number Publication Date
CN114327896A true CN114327896A (en) 2022-04-12

Family

ID=81017190

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111642014.XA Pending CN114327896A (en) 2021-12-29 2021-12-29 Micro-service-based activity calling method and platform

Country Status (1)

Country Link
CN (1) CN114327896A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002207A (en) * 2022-05-27 2022-09-02 三一智矿科技有限公司 Information communication method and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002207A (en) * 2022-05-27 2022-09-02 三一智矿科技有限公司 Information communication method and system
CN115002207B (en) * 2022-05-27 2024-02-23 三一智矿科技有限公司 Information communication method and system

Similar Documents

Publication Publication Date Title
CN106850746B (en) The method and device of smooth service upgrading
CN106878045B (en) Service calling method and device
CN109408132A (en) A kind of configuration file processing method and server, user terminal, storage medium
US9639444B2 (en) Architecture for end-to-end testing of long-running, multi-stage asynchronous data processing services
CN111327647B (en) Method and device for providing service to outside by container and electronic equipment
CN111859832B (en) Chip simulation verification method and device and related equipment
CN112995269B (en) Data processing method, computer device and readable storage medium
CN110519127B (en) Network delay detection method, device and storage medium
CN107168765A (en) A kind of method and system of remote compilation software
CN113268308A (en) Information processing method, device and storage medium
CN111147308A (en) Network management method and system based on micro-service architecture
CN114327896A (en) Micro-service-based activity calling method and platform
CN109753424B (en) AB test method and device
CN116974948B (en) Service system testing method, system, equipment and medium
CN109491767A (en) The processing method and distributed system of distributed transaction
CN108647315A (en) Collecting method and system
CN112087327B (en) Information state acquisition method and apparatus, storage medium, and electronic apparatus
JP6533502B2 (en) Communication service providing system and communication service providing method
CN113992664B (en) Cluster communication method, related device and storage medium
CN114489754A (en) Configurable service management method and device
US20220004403A1 (en) Methods of providing an integrated interface that includes a virtual mobile device
CN110995574B (en) User information management method, acquisition method and system
CN114020359A (en) Distributed platform integration method based on plug-in
CN109936672B (en) Online charging method and device
CN113691618A (en) Message notification method, device, message center and storage medium

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