CN113360220A - Workflow realization method, system, equipment and medium based on global context class - Google Patents

Workflow realization method, system, equipment and medium based on global context class Download PDF

Info

Publication number
CN113360220A
CN113360220A CN202110695897.4A CN202110695897A CN113360220A CN 113360220 A CN113360220 A CN 113360220A CN 202110695897 A CN202110695897 A CN 202110695897A CN 113360220 A CN113360220 A CN 113360220A
Authority
CN
China
Prior art keywords
workflow
context class
current
data
global context
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
CN202110695897.4A
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202110695897.4A priority Critical patent/CN113360220A/en
Publication of CN113360220A publication Critical patent/CN113360220A/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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • G06F16/2343Locking methods, e.g. distributed locking or locking implementation details

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a workflow realization method, a workflow realization system, computer equipment and a storage medium based on global context, which relate to a pedestal operation and maintenance technology, and are characterized in that if a single request sent by a user end is detected, target workflow process data corresponding to the single request and corresponding single request entry parameters are obtained; creating a current local context class to send a process ID corresponding to the target workflow process data to a server; receiving current workflow public parameters correspondingly sent by a server; locally loading the target workflow process data and the current workflow common parameters to obtain workflow process data to be operated; and inputting the single-time request parameter into the workflow process data to be operated so as to execute the process and obtain the current execution result. The data sharing in the same type of data stream execution process is realized by the global context class in the data stream execution process, the data is not required to be inquired to prepare the node execution parameter data, the delivery of a large number of databases is reduced, and the flow execution process is accelerated.

Description

Workflow realization method, system, equipment and medium based on global context class
Technical Field
The invention relates to the technical field of software monitoring, in particular to a workflow realization method, a workflow realization system, workflow realization equipment and workflow realization media based on global context classes.
Background
Workflow (Workflow) refers to "automation of a portion or the whole of a business process in a computer application environment". The goal of workflow is to separate business logic from process logic, let business developers concentrate on the core business development, and the processing of process logic is handed over to the workflow engine. And the business system using the workflow is pushed reversely to carry out service combing. The workflow can clarify the flow structure with complex business flow, and ensure the flexibility of the system in operation. And a new flow is formed according to the existing service under the condition of not developing codes or developing a small amount of codes. And the functions of enabling, disabling and adjusting sequence of service and service components can be realized on line through a friendly interface.
Currently, when a workflow is executed in a server or a client, data interaction is often performed in a context-like manner. For example, when a client sends a request to a server, the scope of the context class in the server is at a request level (i.e., request level), that is, the flow execution data can be shared in the request at this time, and when the flow is executed across the request, a large amount of database queries are required to prepare for the reference data, which results in low data processing efficiency.
Disclosure of Invention
The embodiment of the invention provides a workflow realization method, a workflow realization system, computer equipment and a storage medium based on a global context class, and aims to solve the problem that in the prior art, when a user side sends a request to a server, the scope of the context class in the server is at a request level, and when a cross-request execution flow needs a large amount of database query to prepare for entering data, the data processing efficiency is low.
In a first aspect, an embodiment of the present invention provides a workflow implementation method based on a global context class, which is applied to a workflow integration terminal, and includes:
if a single request sent by a user side is detected, acquiring target workflow process data corresponding to the single request, and acquiring single request entry corresponding to the single request;
creating a current local context class, and sending a process ID corresponding to the target workflow process data to a server through the current local context class;
receiving current workflow public parameters which are correspondingly obtained in the server according to the process ID and are sent by the server;
locally loading the target workflow process data and the current workflow common parameters to obtain workflow process data to be operated;
performing flow execution according to the single request access and the workflow flow data to be operated to obtain a current execution result; and
and sending the current execution result to a user side, and destroying the current local context class.
In a second aspect, an embodiment of the present invention provides a workflow implementation method based on a global context class, which is applied to a server, and includes:
if a flow ID sent by the workflow integration terminal through the current local context class is received, judging a locking result of a distributed lock corresponding to the local global context class; wherein the locking result is one of a locked state or an unlocked state;
if the locking result is in a non-locking state, retrieving and acquiring a current workflow common parameter corresponding to the process ID in the global context class, and sending the current workflow common parameter to the current local context class in a workflow integrated terminal;
if the locking result is in a locking state, when the locking result in a non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is greater than 0, returning to execute the step of retrieving and acquiring the current workflow common parameter corresponding to the process ID in the global context class if the locking result is in the non-locking state, and sending the current workflow common parameter to the current local context class in the workflow integration terminal;
if the locking result in the non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is equal to 0, the process is ended.
In a third aspect, an embodiment of the present invention provides a workflow implementation system based on a global context class, which includes a workflow integration terminal and a server, where the workflow integration terminal is configured to execute the workflow implementation method based on the global context class according to the first aspect, and the server is configured to execute the workflow implementation method based on the global context class according to the second aspect.
In a fourth aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor, when executing the computer program, implements the method for implementing a workflow based on a global context class according to the first aspect, or implements the method for implementing a workflow based on a global context class according to the second aspect.
In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program, when executed by a processor, causes the processor to execute the method for implementing a workflow based on a global context class according to the first aspect, or when executed, causes the processor to execute the method for implementing a workflow based on a global context class according to the second aspect.
The embodiment of the invention provides a workflow realization method, a workflow realization system, computer equipment and a storage medium based on global context class, wherein a workflow integration terminal firstly acquires corresponding single request input parameters after receiving a single request sent by a user terminal, acquires and locally loads target workflow data after local query, then performs data interaction with the global context class in a server through a created current local context class to acquire current workflow common parameters corresponding to a flow ID, and finally performs flow execution through the target workflow flow data, the current workflow common parameters and the single request input parameters to acquire a current execution result. In the whole process, the workflow integration terminal performs data interaction between the current local context class created locally and the global context class in the server to transmit parameter data, so that data sharing in the same type of data flow execution process is realized by the global context class in the data flow execution process, a database preparation node is not required to be inquired to execute the parameter data, a large amount of database delivery is reduced, and the flow execution process is accelerated.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a workflow implementation method based on global context classes according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a workflow implementation method based on global context classes according to an embodiment of the present invention;
fig. 3 is another schematic flowchart of a workflow implementation method based on global context classes according to an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a workflow implementation system based on global context classes according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
In order to more clearly understand the technical solution of the present application, the following detailed description is made on the terminal concerned. The technical scheme is described by taking a workflow integration terminal and a server as execution main bodies respectively.
And the user can use the user side to perform operations such as user information filling and the like to trigger the workflow integration terminal to call the corresponding workflow so as to perform corresponding data processing.
The workflow integration terminal may be understood as a workflow integration party, where a plurality of workflow processes are stored locally in the workflow integration terminal, each workflow process includes a plurality of process nodes, and common data in the plurality of workflow processes are stored in a global context class (i.e., a global context class) in the server for being called by the plurality of workflow integration terminals.
The server, wherein there is a global context class deployed, and the global context class has the following 4 functions and roles: (1) caching the process data; (2) invalidation and reconstruction of global context class; (3) checking the workflow process; (4) and controlling the workflow concurrently.
And the Redis database is used as a transition storage of data between the workflow integration terminal and the server.
First, the technical solution is described in terms of a workflow integration terminal.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a workflow implementation method based on global context class according to an embodiment of the present invention; fig. 2 is a flowchart of a workflow implementation method based on a global context class according to an embodiment of the present invention, where the workflow implementation method based on the global context class is applied to a workflow integration terminal (the workflow integration terminal may also be understood as a server), and the method is executed by application software installed in the workflow integration terminal.
As shown in fig. 2, the method includes steps S101 to S106.
S101, if a single request sent by a user side is detected, target workflow process data corresponding to the single request are obtained, and single request access parameters corresponding to the single request are obtained.
In this embodiment, when a user opens an application program to interact with a server and a workflow integration terminal by using a user side (e.g., a smart phone, a tablet computer, etc.), a workflow may be selected on an interface of the application program and a single request entry may be sent to the workflow integration terminal, after receiving the single request, the workflow integration terminal first obtains target workflow data by locally querying according to the single request, then locally loads the target workflow data, and then locally stores the single request entry corresponding to the single request sent by the user side in a local place as an input parameter of the target workflow data.
And S102, creating a current local context class, and sending a process ID corresponding to the target workflow process data to a server through the current local context class.
In this embodiment, when the workflow integration terminal receives a single request from the user side and needs to invoke a corresponding workflow process to perform data processing, a current local context class needs to be created locally to perform data interaction with a global context class in the server.
In an embodiment, the creating the current local context class specifically includes:
and creating an initial local context class, and increasing and setting the expiration time length and the context class failure condition of the initial local context class to obtain the current local context class.
In this embodiment, when the workflow integration terminal needs to perform data interaction with the global context class deployed in the server, a current local context class for performing interaction between the workflow integration terminal and the server needs to be created. The current local context class is not always valid, some invalidation strategies need to be provided, and the current local context class is set to be in an invalidation state when the following conditions exist:
a1, setting the expiration time length, wherein the current local context class is not accessed and automatically expired within a certain time;
b1, when the database data of the workflow integration terminal is modified, a context type failure condition is triggered;
and C1, under the double-write mechanism, when the database data of the workflow integrated terminal is successfully written, the current local context class fails to be updated.
If the current process continues to be executed after the local context is invalid, the local context is necessarily required to be reconstructed, and the process of reconstructing the local context is to reversely query the execution result of each process node in each target workflow process data, so that the process node accessed to the workflow process must provide a corresponding query function.
When the data modification causes the current local context class to be invalid, the data of the nodes executed by the process is also invalid, and at this time, when the workflow integration terminal performs reverse check, whether the corresponding method needs to be executed again corresponding to the returned result is determined by the workflow integration terminal, and the workflow only reconstructs the local context class according to the returned result.
And when the local context class is reconstructed, an execution link of the target workflow data needs to be acquired, and the current workflow integration terminal has the execution link information of the stored workflow, so that when the local context class is reconstructed, the workflow integration terminal needs to provide a method for acquiring the execution link of the target workflow data, and the method for reconstructing the local context class provided by the workflow integration terminal is recalled according to the corresponding specified link so as to reconstruct the local context class.
And S103, receiving the current workflow public parameters which are correspondingly obtained in the server according to the process ID and are sent by the server.
In this embodiment, after the workflow integration terminal sends the current request and the corresponding data to the server, in order to more quickly acquire the current workflow common parameter required for executing the current target workflow process data, the target data may be acquired in the server according to the process ID of the unique identifier corresponding to the target workflow process data, so as to serve as the current workflow common parameter. For example, the target workflow process data has a function of a process node, namely, user information wind control verification, and at the moment, the server can send the model parameters of the verification model of the user information wind control verification to the workflow integrated terminals as the current workflow common parameters without storing the current workflow common parameters in the local of each workflow integrated terminal. When the common parameters of the current workflow are needed in the workflow integration terminal, the common parameters of the current workflow are directly called from the global context class in the server.
In an embodiment, step S103 further includes, before:
and locally storing a plurality of process data and a process ID corresponding to each process data.
In this embodiment, in order to facilitate faster loading of workflow data after the user side establishes a connection with the workflow integration terminal, it is necessary to store a plurality of flow data in the workflow integration terminal in advance, and a unique flow ID is set for each flow data. Therefore, when a user operates a user interaction interface correspondingly provided by the workflow integration terminal on the user end and selects a service type (such as identity verification), the workflow integration terminal can obtain a process ID corresponding to the service type at the moment and retrieve and obtain target workflow process data from a plurality of local process data according to the process ID. By storing a plurality of process data in the workflow integration terminal in advance instead of the server, the data transmission times are reduced, and the data loading efficiency is improved.
And S104, locally loading the target workflow process data and the current workflow common parameters to obtain workflow process data to be operated.
In this embodiment, when the workflow integration terminal receives a local search of target workflow process data and acquires corresponding common parameters of the current workflow from the global context of the server, the local loading is performed to obtain workflow process data to be executed, which is required for completing the workflow process. At this time, the required data equivalent to the workflow to be executed is prepared, thereby facilitating the subsequent execution flow.
And S105, performing flow execution according to the single request access and the workflow process data to be operated to obtain a current execution result.
In this embodiment, after acquiring workflow process data to be executed on a workflow integration terminal and initially receiving a single request entry parameter corresponding to the single request sent by a user end, the single request entry parameter may be used as an entry parameter of a workflow process to be executed (that is, the workflow process data to be executed corresponds to a workflow process to be executed) to perform an operation, so as to obtain a current execution result corresponding to the single request entry parameter.
In one embodiment, step S105 includes:
judging whether an execution node exists in each execution node corresponding to the workflow process data to be operated and whether the execution node is abnormal or not;
if the execution nodes corresponding to the workflow process data to be operated have abnormality, throwing out and capturing the abnormality, and returning to execute the step of locally loading the target workflow process data and the current workflow common parameters to obtain the workflow process data to be operated;
and if no execution node exists in each execution node corresponding to the workflow process data to be operated, acquiring a current execution result obtained by the workflow process data to be operated through process execution, and sending the current execution result to a Redis database for storage.
Namely, if the single request is finished, whether the execution node has abnormity is captured, if the abnormity exists, the direct data does not fall into the database and is not updated into the Redis database, and after the abnormity is captured, the abnormity is thrown out and is captured and processed by the workflow integrated terminal. I.e. returning to execute step S104, and setting the value to the current local context class when the flow node is successfully re-run.
And if the single request is ended, no exception exists and the data normally fall into the database, and at the moment, the workflow integration terminal sends the current execution result to a Redis database for storage. And when the current execution result is successfully stored in the value of the Redis database, continuing executing the next flow.
If the value of the current execution result in the Redis database fails to be stored, the current local context class is set to be in an invalid state, and the step S104 is also executed in the same way. In the process of re-executing the flow, the process of reconstructing the current local context class is to reversely query the single request input parameter to the flow data of the workflow to be executed to perform the execution result of each flow node after the flow is executed, so that the flow node accessing the workflow must provide a corresponding query function.
Specifically, when the current local context class is reconstructed during the process of re-executing the process, the execution link of the process needs to be first acquired (i.e. retrieved from a plurality of process data stored in the workflow integration terminal), and then a new current local context class needs to be created.
And S106, sending the current execution result to a user side, and destroying the current local context class.
In this embodiment, when a single request entry parameter is input to a to-be-executed workflow process (that is, workflow process data to be executed corresponds to a to-be-executed workflow process) in a workflow integration terminal to perform a process execution to obtain a current execution result, the current execution result needs to be sent to a user side for the user to view.
And because the current local context class only takes effect in the process of executing one process data, the current local context class can be destroyed after the workflow integration terminal and the server complete the interaction of the common parameters of the current workflow. The next time new flow data is executed, the current local context class is also recreated.
In one embodiment, step S106 includes:
setting the expiration duration corresponding to the current local context class to be 0, and setting the context class expiration condition corresponding to the current local context class to be null so as to destroy the current local context class.
In this embodiment, in order to destroy the current local context class when execution of one piece of process data is completed, the expiration time duration corresponding to the current local context class may be quickly set to 0, and the context class expiration condition corresponding to the current local context class is set to null, so that the current local context class is naturally destroyed if the condition for effectiveness is lost. In this way, the destruction of the current local context class can be quickly completed.
The technical solution is described later in the perspective of the server.
Referring to fig. 1 and fig. 3, fig. 3 is another schematic flowchart of a workflow implementation method based on a global context class according to an embodiment of the present invention, where the workflow implementation method based on the global context class is applied to a server, and the method is executed by application software installed in the server.
As shown in fig. 3, the method includes steps S201 to S204.
S201, if a process ID sent by the workflow integration terminal through the current local context class is received, judging a locking result of a distributed lock corresponding to the local global context class; wherein the locking result is one of a locked state or an unlocked state.
In this embodiment, when the server receives a flow ID sent by a certain workflow integration terminal (for example, it is referred to as workflow integration terminal a) through the current local context class, instead of immediately calling the global context class to obtain the current workflow common parameters stored therein corresponding to the flow ID, the locking condition of the local global context class is determined first, because there is only one global context class in the server. If there are other workflow integrated terminals (for example, it is denoted as workflow integrated terminal B) interacting with the global context class, the locking result corresponding to the global context class at this time is the locked state, and the workflow integrated terminal B can interact with the global context class only when the interaction between the workflow integrated terminal B and the global context class of the server is completed and the locked state is switched to the unlocked state.
In order to more reasonably arrange the interaction sequence of each workflow integration terminal and the global context, the global context can adopt a distributed lock to convert the parallel data interaction process into a serial process, namely, queuing can be understood according to the sequence of system time for each workflow integration terminal to send the process ID to the server, namely, the workflow integration terminal which sends the process ID to the server is positioned more ahead in a queue aiming at the distributed lock.
S202, if the locking result is in a non-locking state, retrieving and acquiring the current workflow common parameter corresponding to the process ID in the global context class, and sending the current workflow common parameter to the current local context class in the workflow integrated terminal.
In this embodiment, if the locking result is in a non-locked state, and when the sequence number corresponding to the distributed lock of the corresponding workflow integrated terminal in step S201 is 1, it indicates that it is the turn for the workflow integrated terminal to interact with the global context class, at this time, the flow ID is first transferred into the global context class, and then the current workflow common parameters corresponding to the flow ID are retrieved and obtained in the global context class, and after the parameters are stored in the global context class, it is not necessary to store the current workflow common parameters in the local of each workflow integrated terminal. When the common parameters of the current workflow are needed in the workflow integration terminal, the common parameters of the current workflow are directly called from the global context class in the server.
S203, if the locking result is in a locking state, when the locking result in a non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is larger than 0, returning to execute the step of retrieving and acquiring the current workflow common parameter corresponding to the process ID in the global context class if the locking result is in the non-locking state, and sending the current workflow common parameter to the current local context class in the workflow integrated terminal.
In this embodiment, if the locking result is the locked state, and the corresponding workflow integrated terminal in step S201 has a permutation sequence number of 1 corresponding to the distributed lock, it indicates that data interaction is still performed between the global context class and the current workflow integrated terminal, and only after the round of interaction is completed, it turns to that the workflow integrated terminal having a permutation sequence number of 1 performs interaction with the global context class. That is, the distributed lock is switched to the non-locked state after the global context class completes the current round of interaction, and then the global context class can interact with the next workflow integration terminal (i.e. the workflow integration terminal with the sequence number of 1).
And S204, if the locking result in the non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is equal to 0, ending the process.
In this embodiment, if it is detected that the locking result is the locked state again and the queuing sequence value corresponding to the distributed lock is equal to 0, it indicates that all workflow integration terminals interacting with the server complete data interaction, and at this time, the process is ended.
The method realizes data sharing in the same type of data stream execution process by the global context class in the data stream execution process, does not need to inquire the database preparation node execution parameter data, reduces mass database delivery and accelerates the flow execution process.
The embodiment of the invention also provides a workflow implementation system based on the global context class, which comprises a workflow integration terminal and a server, wherein the workflow integration terminal is used for executing the embodiment recorded in the steps S101 to S106 of the workflow implementation method based on the global context class, and the server is used for executing the embodiment recorded in the steps S201 to S204 of the workflow implementation method based on the global context class. Specifically, referring to fig. 4, fig. 4 is a schematic block diagram of a workflow implementation system based on global context class according to an embodiment of the present invention.
As shown in fig. 4, the workflow implementation system 10 based on global context class includes: the workflow integrates the terminal 100 and the server 200.
As shown in fig. 4, the workflow integrated terminal 100 includes a single request detection unit 101, a local context class creation unit 102, a workflow common parameter receiving unit 103, a data to be executed acquisition unit 104, an execution result acquisition unit 105, and a local context class destruction unit 106.
The single-request detecting unit 101 is configured to, if a single request sent by a user end is detected, obtain target workflow process data corresponding to the single request, and obtain a single-request entry corresponding to the single request.
In this embodiment, when a user opens an application program to interact with a server and a workflow integration terminal by using a user side (e.g., a smart phone, a tablet computer, etc.), a workflow may be selected on an interface of the application program and a single request entry may be sent to the workflow integration terminal, after receiving the single request, the workflow integration terminal first obtains target workflow data by locally querying according to the single request, then locally loads the target workflow data, and then locally stores the single request entry corresponding to the single request sent by the user side in a local place as an input parameter of the target workflow data.
A local context class creating unit 102, configured to create a current local context class, and send a process ID corresponding to the target workflow process data to a server through the current local context class.
In this embodiment, when the workflow integration terminal receives a single request from the user side and needs to invoke a corresponding workflow process to perform data processing, a current local context class needs to be created locally to perform data interaction with a global context class in the server.
In an embodiment, the local context class creation unit 102 is further configured to:
and creating an initial local context class, and increasing and setting the expiration time length and the context class failure condition of the initial local context class to obtain the current local context class.
In this embodiment, when the workflow integration terminal needs to perform data interaction with the global context class deployed in the server, a current local context class for performing interaction between the workflow integration terminal and the server needs to be created. The current local context class is not always valid, some invalidation strategies need to be provided, and the current local context class is set to be in an invalidation state when the following conditions exist:
a1, setting the expiration time length, wherein the current local context class is not accessed and automatically expired within a certain time;
b1, when the database data of the workflow integration terminal is modified, a context type failure condition is triggered;
and C1, under the double-write mechanism, when the database data of the workflow integrated terminal is successfully written, the current local context class fails to be updated.
If the current process continues to be executed after the local context is invalid, the local context is necessarily required to be reconstructed, and the process of reconstructing the local context is to reversely query the execution result of each process node in each target workflow process data, so that the process node accessed to the workflow process must provide a corresponding query function.
When the data modification causes the current local context class to be invalid, the data of the nodes executed by the process is also invalid, and at this time, when the workflow integration terminal performs reverse check, whether the corresponding method needs to be executed again corresponding to the returned result is determined by the workflow integration terminal, and the workflow only reconstructs the local context class according to the returned result.
And when the local context class is reconstructed, an execution link of the target workflow data needs to be acquired, and the current workflow integration terminal has the execution link information of the stored workflow, so that when the local context class is reconstructed, the workflow integration terminal needs to provide a method for acquiring the execution link of the target workflow data, and the method for reconstructing the local context class provided by the workflow integration terminal is recalled according to the corresponding specified link so as to reconstruct the local context class.
And the workflow common parameter receiving unit 103 is configured to receive the current workflow common parameter which is obtained in the server according to the flow ID and is sent by the server.
In this embodiment, after the workflow integration terminal sends the current request and the corresponding data to the server, in order to more quickly acquire the current workflow common parameter required for executing the current target workflow process data, the target data may be acquired in the server according to the process ID of the unique identifier corresponding to the target workflow process data, so as to serve as the current workflow common parameter. For example, the target workflow process data has a function of a process node, namely, user information wind control verification, and at the moment, the server can send the model parameters of the verification model of the user information wind control verification to the workflow integrated terminals as the current workflow common parameters without storing the current workflow common parameters in the local of each workflow integrated terminal. When the common parameters of the current workflow are needed in the workflow integration terminal, the common parameters of the current workflow are directly called from the global context class in the server.
In an embodiment, the workflow integration terminal 100 further comprises:
and the flow data storage unit is used for locally storing a plurality of flow data and the flow ID corresponding to each flow data.
In this embodiment, in order to facilitate faster loading of workflow data after the user side establishes a connection with the workflow integration terminal, it is necessary to store a plurality of flow data in the workflow integration terminal in advance, and a unique flow ID is set for each flow data. Therefore, when a user operates a user interaction interface correspondingly provided by the workflow integration terminal on the user end and selects a service type (such as identity verification), the workflow integration terminal can obtain a process ID corresponding to the service type at the moment and retrieve and obtain target workflow process data from a plurality of local process data according to the process ID. By storing a plurality of process data in the workflow integration terminal in advance instead of the server, the data transmission times are reduced, and the data loading efficiency is improved.
And the data to be operated acquisition unit 104 is configured to locally load the target workflow process data and the common parameters of the current workflow to obtain the workflow process data to be operated.
In this embodiment, when the workflow integration terminal receives a local search of target workflow process data and acquires corresponding common parameters of the current workflow from the global context of the server, the local loading is performed to obtain workflow process data to be executed, which is required for completing the workflow process. At this time, the required data equivalent to the workflow to be executed is prepared, thereby facilitating the subsequent execution flow.
An execution result obtaining unit 105, configured to perform flow execution according to the single request and the workflow process data to be executed to obtain a current execution result.
In this embodiment, after acquiring workflow process data to be executed on a workflow integration terminal and initially receiving a single request entry parameter corresponding to the single request sent by a user end, the single request entry parameter may be used as an entry parameter of a workflow process to be executed (that is, the workflow process data to be executed corresponds to a workflow process to be executed) to perform an operation, so as to obtain a current execution result corresponding to the single request entry parameter.
In one embodiment, the execution result obtaining unit 105 includes:
the abnormal node judging unit is used for judging whether an execution node exists in each execution node corresponding to the workflow process data to be operated and has abnormality;
the first execution unit is used for throwing out and capturing the abnormity if the execution nodes in the execution nodes corresponding to the workflow process data to be operated are abnormal, and returning to execute the step of locally loading the target workflow process data and the current workflow common parameters to obtain the workflow process data to be operated;
and the second execution unit is used for acquiring a current execution result obtained by executing the workflow process data to be operated through the process if no execution node exists in each execution node corresponding to the workflow process data to be operated, and sending the current execution result to a Redis database for storage.
Namely, if the single request is finished, whether the execution node has abnormity is captured, if the abnormity exists, the direct data does not fall into the database and is not updated into the Redis database, and after the abnormity is captured, the abnormity is thrown out and is captured and processed by the workflow integrated terminal. I.e. returning to execute step S104, and setting the value to the current local context class when the flow node is successfully re-run.
And if the single request is ended, no exception exists and the data normally fall into the database, and at the moment, the workflow integration terminal sends the current execution result to a Redis database for storage. And when the current execution result is successfully stored in the value of the Redis database, continuing executing the next flow.
If the value of the current execution result in the Redis database fails to be stored, the current local context class is set to be in an invalid state, and the step S104 is also executed in the same way. In the process of re-executing the flow, the process of reconstructing the current local context class is to reversely query the single request input parameter to the flow data of the workflow to be executed to perform the execution result of each flow node after the flow is executed, so that the flow node accessing the workflow must provide a corresponding query function.
Specifically, when the current local context class is reconstructed during the process of re-executing the process, the execution link of the process needs to be first acquired (i.e. retrieved from a plurality of process data stored in the workflow integration terminal), and then a new current local context class needs to be created.
A local context class destruction unit 106, configured to send the current execution result to the user side, and destroy the current local context class.
In this embodiment, when a single request entry parameter is input to a to-be-executed workflow process (that is, workflow process data to be executed corresponds to a to-be-executed workflow process) in a workflow integration terminal to perform a process execution to obtain a current execution result, the current execution result needs to be sent to a user side for the user to view.
And because the current local context class only takes effect in the process of executing one process data, the current local context class can be destroyed after the workflow integration terminal and the server complete the interaction of the common parameters of the current workflow. The next time new flow data is executed, the current local context class is also recreated.
In an embodiment, the local context class destruction unit 106 is further configured to:
setting the expiration duration corresponding to the current local context class to be 0, and setting the context class expiration condition corresponding to the current local context class to be null so as to destroy the current local context class.
In this embodiment, in order to destroy the current local context class when execution of one piece of process data is completed, the expiration time duration corresponding to the current local context class may be quickly set to 0, and the context class expiration condition corresponding to the current local context class is set to null, so that the current local context class is naturally destroyed if the condition for effectiveness is lost. In this way, the destruction of the current local context class can be quickly completed.
As shown in fig. 4, the server 200 includes a lock state determining unit 201, a non-lock state executing unit 202, a lock state executing unit 203, and an end control unit 204.
A lock state determining unit 201, configured to determine, if a process ID sent by the workflow integration terminal through the current local context class is received, a locking result of the distributed lock corresponding to the local global context class; wherein the locking result is one of a locked state or an unlocked state.
In this embodiment, when the server receives a flow ID sent by a certain workflow integration terminal (for example, it is referred to as workflow integration terminal a) through the current local context class, instead of immediately calling the global context class to obtain the current workflow common parameters stored therein corresponding to the flow ID, the locking condition of the local global context class is determined first, because there is only one global context class in the server. If there are other workflow integrated terminals (for example, it is denoted as workflow integrated terminal B) interacting with the global context class, the locking result corresponding to the global context class at this time is the locked state, and the workflow integrated terminal B can interact with the global context class only when the interaction between the workflow integrated terminal B and the global context class of the server is completed and the locked state is switched to the unlocked state.
In order to more reasonably arrange the interaction sequence of each workflow integration terminal and the global context, the global context can adopt a distributed lock to convert the parallel data interaction process into a serial process, namely, queuing can be understood according to the sequence of system time for each workflow integration terminal to send the process ID to the server, namely, the workflow integration terminal which sends the process ID to the server is positioned more ahead in a queue aiming at the distributed lock.
A non-locking state executing unit 202, configured to, if the locking result is in a non-locking state, retrieve and acquire a current workflow common parameter corresponding to the process ID in the global context class, and send the current workflow common parameter to the current local context class in the workflow integrated terminal.
In this embodiment, if the locking result is in a non-locked state, and when the sequence number corresponding to the distributed lock of the corresponding workflow integrated terminal in step S201 is 1, it indicates that it is the turn for the workflow integrated terminal to interact with the global context class, at this time, the flow ID is first transferred into the global context class, and then the current workflow common parameters corresponding to the flow ID are retrieved and obtained in the global context class, and after the parameters are stored in the global context class, it is not necessary to store the current workflow common parameters in the local of each workflow integrated terminal. When the common parameters of the current workflow are needed in the workflow integration terminal, the common parameters of the current workflow are directly called from the global context class in the server.
And a locking state execution unit 203, configured to, if the locking result is the locking state, return to execute, when a locking result in the non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is greater than 0, retrieve and acquire the current workflow common parameter corresponding to the process ID in the global context class if the locking result is the non-locking state, and send the current workflow common parameter to the current local context class in the workflow integration terminal.
In this embodiment, if the locking result is the locked state, and the corresponding workflow integrated terminal in step S201 has a permutation sequence number of 1 corresponding to the distributed lock, it indicates that data interaction is still performed between the global context class and the current workflow integrated terminal, and only after the round of interaction is completed, it turns to that the workflow integrated terminal having a permutation sequence number of 1 performs interaction with the global context class. That is, the distributed lock is switched to the non-locked state after the global context class completes the current round of interaction, and then the global context class can interact with the next workflow integration terminal (i.e. the workflow integration terminal with the sequence number of 1).
And the ending control unit 204 is configured to end the process if the locking result in the non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is equal to 0.
In this embodiment, if it is detected that the locking result is the locked state again and the queuing sequence value corresponding to the distributed lock is equal to 0, it indicates that all workflow integration terminals interacting with the server complete data interaction, and at this time, the process is ended.
The system realizes data sharing in the same type of data stream execution process by the global context class in the data stream execution process, does not need to inquire the database preparation node to execute the input parameter data, reduces mass database delivery and accelerates the flow execution process.
The above-described workflow implementation system based on global context classes may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 5.
Referring to fig. 5, fig. 5 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 500 is a server, and the server may be an independent server or a server cluster composed of a plurality of servers.
Referring to fig. 5, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a storage medium 503 and an internal memory 504.
The storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, may cause the processor 502 to perform a global context class based workflow implementation method.
The processor 502 is used to provide computing and control capabilities that support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 can be enabled to execute the workflow implementation method based on the global context class.
The network interface 505 is used for network communication, such as providing transmission of data information. Those skilled in the art will appreciate that the configuration shown in fig. 5 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing device 500 to which aspects of the present invention may be applied, and that a particular computing device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
The processor 502 is configured to run a computer program 5032 stored in the memory to implement the workflow implementation method based on the global context class disclosed in the embodiment of the present invention.
Those skilled in the art will appreciate that the embodiment of a computer device illustrated in fig. 5 does not constitute a limitation on the specific construction of the computer device, and that in other embodiments a computer device may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may only include a memory and a processor, and in such embodiments, the structures and functions of the memory and the processor are consistent with those of the embodiment shown in fig. 5, and are not described herein again.
It should be understood that, in the embodiment of the present invention, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a nonvolatile computer-readable storage medium or a volatile computer-readable storage medium. The computer readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the global context class-based workflow implementation method disclosed by the embodiments of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses, devices and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the 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 invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method can be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only a logical division, and there may be other divisions when the actual implementation is performed, or units having the same function may be grouped into one unit, for example, a plurality of units or components may be combined or may be 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 also be an electric, mechanical or other form of connection.
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 of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A workflow realization method based on global context class is applied to a workflow integration terminal and is characterized by comprising the following steps:
if a single request sent by a user side is detected, acquiring target workflow process data corresponding to the single request, and acquiring single request entry corresponding to the single request;
creating a current local context class, and sending a process ID corresponding to the target workflow process data to a server through the current local context class;
receiving current workflow public parameters which are correspondingly obtained in the server according to the process ID and are sent by the server;
locally loading the target workflow process data and the current workflow common parameters to obtain workflow process data to be operated;
performing flow execution according to the single request access and the workflow flow data to be operated to obtain a current execution result; and
and sending the current execution result to a user side, and destroying the current local context class.
2. The method for implementing workflow based on global context class according to claim 1, wherein said creating a current local context class comprises:
and creating an initial local context class, and increasing and setting the expiration time length and the context class failure condition of the initial local context class to obtain the current local context class.
3. The method for implementing workflow based on global context class according to claim 1, wherein before receiving the common parameters of the current workflow correspondingly obtained in the server according to the process ID and sent by the server, the method further comprises:
and locally storing a plurality of process data and a process ID corresponding to each process data.
4. The method for implementing workflow based on global context class according to claim 1, wherein the performing the flow execution according to the single request access and the workflow process data to be executed to obtain the current execution result comprises:
judging whether an execution node exists in each execution node corresponding to the workflow process data to be operated and whether the execution node is abnormal or not;
if the execution nodes corresponding to the workflow process data to be operated have abnormality, throwing out and capturing the abnormality, and returning to execute the step of locally loading the target workflow process data and the current workflow common parameters to obtain the workflow process data to be operated;
and if no execution node exists in each execution node corresponding to the workflow process data to be operated, acquiring a current execution result obtained by the workflow process data to be operated through process execution, and sending the current execution result to a Redis database for storage.
5. The method for implementing workflow based on global context class according to claim 1, wherein said destroying the current local context class comprises:
setting the expiration duration corresponding to the current local context class to be 0, and setting the context class expiration condition corresponding to the current local context class to be null so as to destroy the current local context class.
6. A workflow implementation method based on global context class is applied to a server and is characterized by comprising the following steps:
if a flow ID sent by the workflow integration terminal through the current local context class is received, judging a locking result of a distributed lock corresponding to the local global context class; wherein the locking result is one of a locked state or an unlocked state;
if the locking result is in a non-locking state, retrieving and acquiring a current workflow common parameter corresponding to the process ID in the global context class, and sending the current workflow common parameter to the current local context class in a workflow integrated terminal;
if the locking result is in a locking state, when the locking result in a non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is greater than 0, returning to execute the step of retrieving and acquiring the current workflow common parameter corresponding to the process ID in the global context class if the locking result is in the non-locking state, and sending the current workflow common parameter to the current local context class in the workflow integration terminal;
if the locking result in the non-locking state is detected again and the queuing sequence value corresponding to the distributed lock is equal to 0, the process is ended.
7. The method as claimed in claim 6, wherein if the locking result in the non-locked state is detected again and the queued sequence value corresponding to the distributed lock is equal to 0, after the process is completed, the method further comprises:
and destroying the global context class.
8. A workflow implementation system based on global context class is characterized by comprising a workflow integration terminal and a server, wherein the workflow integration terminal is used for executing the workflow implementation method based on global context class according to any one of claims 1 to 5, and the server is used for executing the workflow implementation method based on global context class according to any one of claims 6 to 7.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the global context class-based workflow implementation method according to any one of claims 1 to 5 or implements the global context class-based workflow implementation method according to any one of claims 6 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, causes the processor to perform the global context class based workflow implementation method of any one of claims 1 to 5 or the global context class based workflow implementation method of any one of claims 6 to 7.
CN202110695897.4A 2021-06-23 2021-06-23 Workflow realization method, system, equipment and medium based on global context class Pending CN113360220A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110695897.4A CN113360220A (en) 2021-06-23 2021-06-23 Workflow realization method, system, equipment and medium based on global context class

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110695897.4A CN113360220A (en) 2021-06-23 2021-06-23 Workflow realization method, system, equipment and medium based on global context class

Publications (1)

Publication Number Publication Date
CN113360220A true CN113360220A (en) 2021-09-07

Family

ID=77535864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110695897.4A Pending CN113360220A (en) 2021-06-23 2021-06-23 Workflow realization method, system, equipment and medium based on global context class

Country Status (1)

Country Link
CN (1) CN113360220A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120159341A1 (en) * 2010-12-21 2012-06-21 Microsoft Corporation Interactions with contextual and task-based computing environments
US20160321342A1 (en) * 2015-04-28 2016-11-03 International Business Machines Corporation Management of event contexts using bookend events
US9852220B1 (en) * 2012-10-08 2017-12-26 Amazon Technologies, Inc. Distributed workflow management system
US20200151839A1 (en) * 2019-12-12 2020-05-14 Netspective Communications Llc Computer-controlled precision education and training
EP3671584A1 (en) * 2018-12-17 2020-06-24 Siemens Aktiengesellschaft Method and system for controlling a production process
CN112367363A (en) * 2020-10-23 2021-02-12 深圳前海微众银行股份有限公司 Information sharing method, device, server and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120159341A1 (en) * 2010-12-21 2012-06-21 Microsoft Corporation Interactions with contextual and task-based computing environments
US9852220B1 (en) * 2012-10-08 2017-12-26 Amazon Technologies, Inc. Distributed workflow management system
US20160321342A1 (en) * 2015-04-28 2016-11-03 International Business Machines Corporation Management of event contexts using bookend events
EP3671584A1 (en) * 2018-12-17 2020-06-24 Siemens Aktiengesellschaft Method and system for controlling a production process
US20200151839A1 (en) * 2019-12-12 2020-05-14 Netspective Communications Llc Computer-controlled precision education and training
CN112367363A (en) * 2020-10-23 2021-02-12 深圳前海微众银行股份有限公司 Information sharing method, device, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王明微 等: "基于工作流的主动信息共享体系结构", 制造业自动化, no. 01, pages 4 - 7 *

Similar Documents

Publication Publication Date Title
KR20210071942A (en) Transaction processing methods, devices and devices, and computer storage media
CN103782573A (en) Masking server outages from clients and applications
AU2019347897B2 (en) Methods, devices and systems for real-time checking of data consistency in a distributed heterogenous storage system
US20210042218A1 (en) System and method for performance regression detection
CN107070919A (en) Idempotence for db transaction
CN113568686B (en) Asynchronous processing method and device for Lua language, computer equipment and storage medium
CN113595788B (en) API gateway management method and device based on plug-in
CN112463318B (en) Timing task processing method, device and system
CN109218407B (en) Code management and control method based on log monitoring technology and terminal equipment
CN112035276A (en) Java-based cross-platform extensible Remote Procedure Call (RPC) framework design method
CN112788270A (en) Video backtracking method and device, computer equipment and storage medium
CN114185900B (en) Service data processing method, device, computer equipment and storage medium
CN114389882A (en) Gateway flow control method and device, computer equipment and storage medium
CN113435605B (en) AI dynamic injection control method and device based on network data pool
CN110297822A (en) Key management method, device, equipment and storage medium towards block chain
CN113360220A (en) Workflow realization method, system, equipment and medium based on global context class
CN116820790A (en) Delay processing method, device, equipment and medium for distributed lock
CN114564286B (en) Rule engine warning method and rule engine warning system
CN113760608B (en) Data recovery method and device, electronic equipment and storage medium
JP2003043119A (en) Parallel scan test software
CN113157522B (en) Method, system, device and storage medium for preventing loss of event based on alliance chain
CN113656064B (en) Frame flow processing method, system, readable storage medium and device
US20230069449A1 (en) History management apparatus, history management method, and program
CN115442226B (en) Log acquisition method, related device and storage medium
CN116346667A (en) System production verification method and device and electronic equipment

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