CN112486698A - Micro-service access method and related device - Google Patents

Micro-service access method and related device Download PDF

Info

Publication number
CN112486698A
CN112486698A CN202011302020.6A CN202011302020A CN112486698A CN 112486698 A CN112486698 A CN 112486698A CN 202011302020 A CN202011302020 A CN 202011302020A CN 112486698 A CN112486698 A CN 112486698A
Authority
CN
China
Prior art keywords
micro
service
access
activity
sending
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
CN202011302020.6A
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.)
Shandong Civic Se Commercial Middleware Co ltd
Original Assignee
Shandong Civic Se Commercial Middleware 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 Shandong Civic Se Commercial Middleware Co ltd filed Critical Shandong Civic Se Commercial Middleware Co ltd
Priority to CN202011302020.6A priority Critical patent/CN112486698A/en
Publication of CN112486698A publication Critical patent/CN112486698A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Abstract

The application discloses a micro-service access method, which comprises the following steps: monitoring the process by adopting an active monitoring engine; when the target activity in the process is monitored to be in the running state, acquiring micro-service information of the target activity; and sending an access request to the corresponding micro service according to the micro service information to realize the access to the micro service. And sending an access request to the corresponding micro-service through the monitoring result of the activity monitoring engine so as to realize micro-service access without adopting other services, thereby realizing automatic access to the micro-service. The application also discloses a micro-service access device, a server and a computer readable storage medium, which have the beneficial effects.

Description

Micro-service access method and related device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a micro-service access method, a micro-service access device, a server, and a computer-readable storage medium.
Background
With the continuous development of information technology, different software architectures are applied in different fields so as to adapt to different types of software. The microservice is a software architecture supporting microservice, which divides a large single application program and service into tens of parts. A microservice policy may make work easier by extending individual components rather than the entire application stack to meet service level agreements.
In the related art, the process relates to a collaboration problem of automatically calling a microservice system during operation, and generally an EJB (Enterprise Java Beans) system collaboration mode is adopted to access microservices among systems. However, EJB is heavy and not suitable for small and medium-sized projects, and meanwhile, corresponding EJB services need to be purchased independently by adopting EJB services, so that project cost is increased, and later maintenance is not facilitated.
Therefore, how to implement automatic access to the microservice is a major concern for those skilled in the art.
Disclosure of Invention
The application aims to provide a micro-service access method, a micro-service access device, a server and a computer readable storage medium, wherein an access request is sent to a corresponding micro-service through a monitoring result of an activity monitoring engine so as to realize micro-service access, and other services are not adopted, so that the micro-service is automatically accessed.
In order to solve the above technical problem, the present application provides a micro service access method, including:
monitoring the process by adopting an active monitoring engine;
when the target activity in the process is monitored to be in the running state, acquiring micro-service information of the target activity;
and sending an access request to the corresponding micro service according to the micro service information to realize the access to the micro service.
Optionally, the method further includes:
and when the micro service is started, registering the network address of the micro service to a registry system.
Optionally, sending an access request to a corresponding micro service according to the micro service information, to implement access to the micro service, including:
sending an information acquisition request to the registry system according to the micro service information so that the registry system can return a corresponding network address;
and sending an access request to the network address so as to realize micro-service access.
Optionally, after the step of sending an access request to a corresponding micro service according to the micro service information, the method further includes:
executing a next activity of the target activities.
Optionally, after the step of sending an access request to a corresponding micro service according to the micro service information, the method further includes:
monitoring a return interface;
and processing the return data when the return data is monitored.
The present application further provides a microservice access device, comprising:
the activity monitoring module is used for monitoring the process by adopting an activity monitoring engine;
the target activity information acquisition module is used for acquiring micro service information of the target activity when the target activity in the process is monitored to be in the running state;
and the micro-service access module is used for sending an access request to the corresponding micro-service according to the micro-service information to access the micro-service.
Optionally, the method further includes:
and the micro-service registration module is used for registering the network address of the micro-service to a registration center system when the micro-service is started.
Optionally, the micro service access module includes:
a network address request unit, configured to send an information acquisition request to the registry system according to the micro service information, so that the registry system returns a corresponding network address;
and the access request sending unit is used for sending an access request to the network address so as to realize micro-service access.
The present application further provides a server, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the microservice access method as described above when executing said computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the microservice access method as described above.
The micro-service access method provided by the application comprises the following steps: monitoring the process by adopting an active monitoring engine; when the target activity in the process is monitored to be in the running state, acquiring micro-service information of the target activity; and sending an access request to the corresponding micro service according to the micro service information to realize the access to the micro service.
The process is monitored in real time through the activity monitoring engine, when the activity monitoring engine monitors that the corresponding target activity is in the running state, micro-service access is carried out according to the micro-service information corresponding to the target activity, automatic access to the micro-service is achieved, the micro-service access is not carried out through an EJB system, automatic access to the micro-service is achieved, the project cost is reduced, and later maintenance is facilitated.
The application also provides a micro-service access device, a server and a computer readable storage medium, which have the above beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a micro service access method provided in an embodiment of the present application;
fig. 2 is a schematic structural diagram of a micro service access device according to an embodiment of the present application.
Detailed Description
The core of the application is to provide a micro-service access method, a micro-service access device, a server and a computer readable storage medium, and an access request is sent to a corresponding micro-service through a monitoring result of an activity monitoring engine so as to realize micro-service access, and other services are not needed, so that the micro-service is automatically accessed.
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all 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 application.
In the related art, the process relates to the cooperation problem of automatically calling the micro-service system during the operation, and generally, an EJB system cooperation mode is adopted to access the micro-service among all systems. However, EJB is heavy and not suitable for small and medium-sized projects, and meanwhile, corresponding EJB services need to be purchased independently by adopting EJB services, so that project cost is increased, and later maintenance is not facilitated.
Therefore, the method for accessing the micro-service provided by the application monitors the process in real time through the activity monitoring engine, and when the activity monitoring engine monitors that the corresponding target activity is in the running state, the micro-service access is performed according to the micro-service information corresponding to the target activity, so that the micro-service is automatically accessed instead of an EJB system, the micro-service is automatically accessed, the project cost is reduced, and the method is favorable for later maintenance.
The following describes a micro-service access method provided by the present application by using an embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a micro service access method according to an embodiment of the present disclosure.
In this embodiment, the method may include:
s101, monitoring the process by adopting an active monitoring engine;
this step is directed to listening for a flow using an active listening engine.
The active monitoring engine is mainly an engine for monitoring and judging a target object in a system.
Optionally, before the step of listening to the flow by using the active listening engine, the method may further include: the active listening engine is configured.
Optionally, this embodiment may further include:
when the micro-service is started, the network address of the micro-service is registered to the registry system.
It can be seen that the present alternative is primarily illustrative of the initiation of microservice. In the alternative, the network address of the micro service is registered to the registry system when the micro service is started. It is contemplated that the present embodiment may include a plurality of microservices during actual use. When any one of the micro-services is started, the network address of the micro-service is registered in the registry system. Wherein, the registration process may be to record the micro-service information of the micro-service and the corresponding network address in a database of the registry system.
S102, when the target activity in the process is monitored to be in the running state, acquiring micro-service information of the target activity;
on the basis of S101, this step is intended to obtain micro service information of the target activity when it is monitored that the target activity in the process is in a running state.
The flow refers to a flow sequence composed of a plurality of target activities and arranged according to a certain sequence. In a flow, when an activity is executed, the state of the activity is modified from not running to running. Therefore, when the state of the target activity in the process is monitored to be the running state, the target activity is activated to be in running. At this time, the micro-service corresponding to the micro-service information in the target activity can be accessed.
The acquired micro-service information of the target activity is mainly information describing the micro-service, and may include a service name, a method name, and the like.
And S103, sending an access request to the corresponding micro service according to the micro service information to realize the access to the micro service.
On the basis of S102, this step is intended to send an access request to the corresponding micro service according to the micro service information, so as to access the micro service.
In this step, the name and method name of the micro service can be determined according to the information in the micro service information. And acquiring a current activity ID, a process ID and a related data ID as parameters, and splicing the information into corresponding url. And the obtained network address of the micro-service sends the generated url to the network address so as to realize corresponding access to the micro-service through the url.
Optionally, this step may include:
step 1, sending an information acquisition request to a registry system according to the micro service information so that the registry system can return a corresponding network address;
and step 2, sending an access request to the network address so as to realize micro-service access.
It can be seen that the present alternative is mainly described how to send an access request to a microservice. In the alternative, firstly, an information acquisition request is sent to a registry system according to the micro-service information so that the registry system can return a corresponding network address; an access request is then sent to the network address to enable microservice access. Therefore, in the alternative, the corresponding network address is mainly obtained through the registration center system, that is, the addresses of the micro-services in different systems can be obtained through the registration center system, so that the micro-service access is performed through the network address, and the micro-service access between different systems is realized.
Optionally, after this step, the method may further include:
the next activity of the target activity is executed.
It can be seen that the present alternative scheme mainly explains the operation after the access request is sent. In general, this alternative scheme mainly uses asynchronous operation, i.e. it does not have to wait for the feedback of the microservice when an access request is sent, and directly executes the next activity of the target activity.
Optionally, after this step, the method may further include:
monitoring a return interface; and when the returned data are monitored, processing the returned data.
It can be seen that the present alternative scheme mainly explains the operation after the access request is sent. In summary, in this alternative scheme, a synchronization operation is mainly adopted, that is, after an access request is sent, a return interface is monitored; and when the returned data are monitored, processing the returned data. That is, the feedback of the microservice is waited for, and corresponding processing is performed according to the feedback data.
In summary, in the embodiment, the process is monitored in real time by the activity monitoring engine, and when the activity monitoring engine monitors that the corresponding target activity is in the running state, the micro-service access is performed according to the micro-service information corresponding to the target activity, so that the micro-service is automatically accessed instead of performing the micro-service access by using an EJB system, the micro-service is automatically accessed, the project cost is reduced, and the post-maintenance is facilitated.
The micro-service access method provided by the present application is further described below by a specific embodiment.
In this embodiment, the method may include:
step 1, configuring a flow in a flow designer, and configuring active monitoring in an active node needing to trigger microservice; wherein, the monitoring condition is selected as 'monitoring after active start'; and configuring the service name (for example: workflowClient) and the method name of the micro-service needing to be triggered in the extended attribute of the activity.
And 2, starting the micro-service, and starting the micro-service system workflowClient needing to be accessed. When the service is started, the information such as the network address corresponding to the micro service is registered in the registration center.
And 3, after the flow runs to the configuration of the activity needing triggering the microservice, triggering the activity monitoring after the engine monitors that the activity state is changed into running.
The supported event listening types include, but are not limited to: before the creation of an activity instance, after the creation of an activity instance, before the start of an activity instance, after the start of an activity instance, before the termination of an activity instance, after the termination of an activity instance, before the suspension of an activity instance, after the suspension of an activity instance, before the reply of an activity instance, after the reply of an activity instance, before the completion of an activity instance, before the jump of an activity instance, after the jump of an activity instance, before the rollback of an activity instance, after the rollback of an activity instance, before the release of an activity instance, after the release of an activity instance, before the recovery of an activity instance, and after the recovery of an activity instance.
And 4, after the activity monitoring is triggered, reading the extended attribute information configured in the activity definition, analyzing the service name and the method name of the micro service to be accessed, and simultaneously transmitting the current activity ID, the process ID and the related data ID as parameters. The access information is spliced into url (Uniform Resource Locator) and then the microservice is accessed through RestTemplate.
And 5, when accessing the micro service (workflowClient), searching a network address of the service from the registration center according to the service name (workflowClient), and calling an interface of the workflowClient service through the address.
And 6, after receiving the call request, the micro service workflow client analyzes the parameters (activity ID, process ID and related data ID) and then performs corresponding processing.
And 7, after the micro service workflow client finishes corresponding operation, calling an engine interface to assign values to related data, and calling a submission interface of the engine to submit the current activity according to the activity ID and the process ID.
And 8, after the activity is submitted, judging that the flow has different branches according to the value of the related data ID by the engine, and then continuing to flow downwards.
It can be seen that, in this embodiment, the process can be monitored in real time by the activity monitoring engine, and when the activity monitoring engine monitors that the corresponding target activity is in the running state, the micro-service access is performed according to the micro-service information corresponding to the target activity, so that the micro-service is automatically accessed instead of the EJB system, and the micro-service is automatically accessed, thereby reducing the project cost and facilitating the later maintenance.
In the following, the micro service access device provided in the embodiment of the present application is introduced, and the micro service access device described below and the micro service access method described above may be referred to correspondingly.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a micro service access device according to an embodiment of the present disclosure.
In this embodiment, the apparatus may include:
an activity monitoring module 100, configured to monitor a process by using an activity monitoring engine;
the target activity information acquiring module 200 is configured to acquire micro service information of a target activity when it is monitored that the target activity in the process is in an operating state;
the micro-service access module 300 is configured to send an access request to a corresponding micro-service according to the micro-service information, so as to access the micro-service.
Optionally, the apparatus may further include:
and the micro-service registration module is used for registering the network address of the micro-service to the registration center system when the micro-service is started.
Optionally, the micro service access module 300 may include:
the network address request unit is used for sending an information acquisition request to the registration center system according to the micro service information so that the registration center system can return a corresponding network address;
and the access request sending unit is used for sending an access request to the network address so as to realize micro-service access.
An embodiment of the present application further provides a server, including:
a memory for storing a computer program;
a processor for implementing the steps of the micro-service access method as described in the above embodiments when executing the computer program.
The present application also provides a computer readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the micro service access method according to the above embodiments.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
A micro service access method, a micro service access device, a server and a computer readable storage medium provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

Claims (10)

1. A microservice access method, comprising:
monitoring the process by adopting an active monitoring engine;
when the target activity in the process is monitored to be in the running state, acquiring micro-service information of the target activity;
and sending an access request to the corresponding micro service according to the micro service information to realize the access to the micro service.
2. The micro-service access method of claim 1, further comprising:
and when the micro service is started, registering the network address of the micro service to a registry system.
3. The micro-service access method of claim 2, wherein sending an access request to a corresponding micro-service according to the micro-service information to access the micro-service, comprises:
sending an information acquisition request to the registry system according to the micro service information so that the registry system can return a corresponding network address;
and sending an access request to the network address so as to realize micro-service access.
4. The micro-service access method according to claim 1, wherein after the step of sending the access request to the corresponding micro-service according to the micro-service information, the method further comprises:
executing a next activity of the target activities.
5. The micro-service access method according to claim 1, wherein after the step of sending the access request to the corresponding micro-service according to the micro-service information, the method further comprises:
monitoring a return interface;
and processing the return data when the return data is monitored.
6. A microservice access device, comprising:
the activity monitoring module is used for monitoring the process by adopting an activity monitoring engine;
the target activity information acquisition module is used for acquiring micro service information of the target activity when the target activity in the process is monitored to be in the running state;
and the micro-service access module is used for sending an access request to the corresponding micro-service according to the micro-service information to access the micro-service.
7. The microservice access device of claim 6, further comprising:
and the micro-service registration module is used for registering the network address of the micro-service to a registration center system when the micro-service is started.
8. The microservice access device of claim 7, wherein the microservice access module comprises:
a network address request unit, configured to send an information acquisition request to the registry system according to the micro service information, so that the registry system returns a corresponding network address;
and the access request sending unit is used for sending an access request to the network address so as to realize micro-service access.
9. A server, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the microservice access method of any of claims 1 to 5 when executing said computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the microservice access method according to any one of claims 1 to 5.
CN202011302020.6A 2020-11-19 2020-11-19 Micro-service access method and related device Pending CN112486698A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011302020.6A CN112486698A (en) 2020-11-19 2020-11-19 Micro-service access method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011302020.6A CN112486698A (en) 2020-11-19 2020-11-19 Micro-service access method and related device

Publications (1)

Publication Number Publication Date
CN112486698A true CN112486698A (en) 2021-03-12

Family

ID=74931950

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011302020.6A Pending CN112486698A (en) 2020-11-19 2020-11-19 Micro-service access method and related device

Country Status (1)

Country Link
CN (1) CN112486698A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242864A (en) * 2022-06-28 2022-10-25 度小满科技(北京)有限公司 Micro-service access method and device, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108427581A (en) * 2018-02-07 2018-08-21 平安普惠企业管理有限公司 System micro services method and terminal device
CN111949326A (en) * 2020-08-03 2020-11-17 杭州当虹科技股份有限公司 Micro-service workflow method based on Activiti

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108427581A (en) * 2018-02-07 2018-08-21 平安普惠企业管理有限公司 System micro services method and terminal device
CN111949326A (en) * 2020-08-03 2020-11-17 杭州当虹科技股份有限公司 Micro-service workflow method based on Activiti

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
山金孝 等: "《OpenShift云原生架构》", 29 February 2020 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115242864A (en) * 2022-06-28 2022-10-25 度小满科技(北京)有限公司 Micro-service access method and device, electronic equipment and storage medium
CN115242864B (en) * 2022-06-28 2023-12-05 度小满科技(北京)有限公司 Micro-service access method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US7962612B2 (en) Method for connection leak detection and prevention
CN108462598B (en) Log generation method, log analysis method and device
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
CN110677475A (en) Micro-service processing method, device, equipment and storage medium
US7571165B2 (en) Method and system for providing locking behavior
CN113407383A (en) Main/standby system switching method and device, server and main/standby system
CN109857391A (en) Processing method and processing device, storage medium and the electronic device of data
CN111381847B (en) Information processing method and device
CN112486698A (en) Micro-service access method and related device
EP2224381A1 (en) Method and apparatus for case-based service composition
CN113641384A (en) Probe upgrading management method, device and system
US7734763B2 (en) Application for testing the availability of software components
CN107425994B (en) Method, terminal and server for realizing remote parameter management
CN112818016A (en) API-based real-time and off-line data query method and system
CN109245941B (en) Service compensation method and device
CN113220480B (en) Distributed data task cross-cloud scheduling system and method
CN106844073B (en) Method for diagnosing application, diagnosis client and system
CN111737028B (en) Dubbo service detection method and device
CN108052380B (en) Business function docking method and device, computer equipment and storage medium
CN113806813A (en) Data isolation switching method and system for multiple data sources
CN113434234A (en) Page jump method, device, computer readable storage medium and processor
CN113094074A (en) Service cluster updating method and device
CN115269161B (en) Abnormal process reverse rollback method and system
CN117082068B (en) Elastic expansion method and system for tax return server
CN115102854B (en) Remote procedure call route management control method, system and equipment for micro-service

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210312

RJ01 Rejection of invention patent application after publication