CN117539451B - Flow execution method, device, electronic equipment and storage medium - Google Patents
Flow execution method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117539451B CN117539451B CN202410033102.7A CN202410033102A CN117539451B CN 117539451 B CN117539451 B CN 117539451B CN 202410033102 A CN202410033102 A CN 202410033102A CN 117539451 B CN117539451 B CN 117539451B
- Authority
- CN
- China
- Prior art keywords
- instance
- flow
- phase
- preset
- stage
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 230000008569 process Effects 0.000 claims abstract description 23
- 238000004590 computer program Methods 0.000 claims description 2
- 230000004048 modification Effects 0.000 abstract description 9
- 238000012986 modification Methods 0.000 abstract description 9
- 239000000463 material Substances 0.000 abstract description 5
- 230000001066 destructive effect Effects 0.000 abstract description 3
- 230000006399 behavior Effects 0.000 description 64
- 238000010586 diagram Methods 0.000 description 10
- 230000009471 action Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 4
- 238000005859 coupling reaction Methods 0.000 description 4
- 230000000903 blocking effect Effects 0.000 description 3
- 238000007726 management method Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 239000011800 void material Substances 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000739 chaotic effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the application discloses a flow execution method, a flow execution device, electronic equipment and a storage medium. The creation method comprises the following steps: under the condition of receiving a flow execution request carrying a flow identifier, acquiring execution logic information of a target flow corresponding to the flow identifier and step information of each step; for any step, creating a phase instance corresponding to the step according to the step information of the step; and creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow through the operation flow instance. Based on the above, in the embodiment of the application, each step of the flow is respectively instantiated as a corresponding stage instance, and then the execution logic information is instantiated as the flow instance, so that destructive modification of codes is not needed, the modification process is simpler, and the investment of manpower and material resources is reduced.
Description
Technical Field
The embodiment of the application relates to the technical field of business processes, in particular to a process execution method, a process execution device, electronic equipment and a storage medium.
Background
With the development of technology, various businesses of enterprises are generally subjected to online flow so as to facilitate better management and execution. For some complex services, the service flow is often complex, and the actually executed flows may be different for different requests, events, data states and program states. In the face of this, complex business logic usage codes are typically described in terms of conditional control statements.
However, when the business process changes, such as new addition, modification, deletion and the like, the code coupling degree is very high, and the code can be only destructively modified to meet the changing requirement, so that the destructively modified code consumes a great deal of manpower, and the destructively modified code is often in a condition of code confusion, so that code holes are frequent, further manpower and material resources are consumed, the modification cost is high, and the modification time is long.
Disclosure of Invention
The embodiment of the application provides a flow execution method, a device, electronic equipment and a storage medium, so as to reduce the code coupling degree of a flow and avoid the situation of consuming a large amount of manpower and material resources caused by destructively modifying codes.
In a first aspect, an embodiment of the present application provides a method for executing a flow, where the method includes:
under the condition of receiving a flow execution request carrying a flow identifier, acquiring execution logic information of a target flow corresponding to the flow identifier and step information of each step;
for any step, creating a phase instance corresponding to the step according to the step information of the step;
and creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow by operating the flow instance.
In a second aspect, an embodiment of the present application provides a flow execution apparatus, where the apparatus includes:
the information acquisition module is used for acquiring the execution logic information of the target flow corresponding to the flow identifier and the step information of each step under the condition that the flow execution request carrying the flow identifier is received;
the stage instance creation module is used for creating a stage instance corresponding to any step according to the step information of the step;
the flow instance creation module is used for creating a flow instance corresponding to the target flow according to the execution logic information;
and the flow instance operation module is used for realizing the operation of the stage instance of each step in the target flow by operating the flow instance.
In a third aspect, an embodiment of the present application further provides an electronic device, including:
one or more processors;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement a flow execution method as provided by any of the embodiments of the present application.
In a fourth aspect, embodiments of the present application further provide a computer readable storage medium having a computer program stored thereon, where the program when executed by a processor implements a flow execution method as provided in any embodiment of the present application.
According to the technical scheme, under the condition that a flow execution request carrying a flow identifier is received, logic information of execution of a target flow corresponding to the flow identifier and step information of each step are acquired; for any step, creating a phase instance corresponding to the step according to the step information of the step; and creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow by operating the flow instance. Based on the above, in the embodiment of the present application, each step of the flow is respectively instantiated as a corresponding stage instance, and then the execution logic information is instantiated as a flow instance, so that the execution logic of a single step and the service logic corresponding to the flow are separated, the coupling degree of codes between the steps is greatly reduced, and when a certain step needs to be modified, only the step information of the step and the related execution logic information need to be adjusted, and no destructive modification of the codes is required, so that the modification process is simpler, and the investment of manpower and material resources is reduced.
Drawings
Fig. 1 is a flow chart of a flow execution method according to a first embodiment of the present application;
FIG. 2 is a schematic diagram of a phase instance template according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a flowchart example template according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a process example operation provided in accordance with an embodiment of the present application;
fig. 5 is a schematic structural diagram of a flow execution device according to a second embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
The present application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present application are shown in the drawings.
Example 1
Fig. 1 is a flow chart of a flow creation method provided in an embodiment of the present application, as shown in fig. 1, where the flow creation method provided in the embodiment may specifically include the following steps:
step 101, under the condition that a flow execution request carrying a flow identifier is received, obtaining execution logic information of a target flow corresponding to the flow identifier and step information of each step.
It should be noted that, the flow in this step is a flow that needs to be executed this time, and the flow includes a plurality of steps, each step corresponds to at least one action, where the action refers to an action that needs to be executed in the step, such as acquiring data, comparing differences, and so on.
In addition, the step information may include a resource identification, a phase behavior code, and a common behavior code. The resource identifier refers to a resource required by the step when the step is executed, for example, a difference between two items is compared, then the required resource is an item warehouse for storing the two items, and a storage address of the item warehouse can be used as the resource identifier.
The step identifier can be named by a user, after the user inputs the named step identifier, the user needs to distinguish whether the same step identifier exists currently, if so, the step identifier cannot be used, and if not, the user needs to be prompted to rename.
The phase behavior code is a code corresponding to the action required to be executed in the step, and if the current created flow has an old flow code, the user can strip the code part corresponding to the step from the old flow code and adaptively adjust the code part to obtain the phase behavior code. If the current created flow does not have old flow codes, the user is required to write the phase behavior codes by himself.
The common behavior code is a unified management code for stage execution exception handling and the like in the whole flow.
It should be noted that, unlike the conventional process code, the foregoing step information is configured and stored in steps in this embodiment, that is, for each service flow, the embodiment pre-configures, for each service flow, execution logic information corresponding to each service flow and step information of the step therein, and completes execution of a certain target flow in cooperation with the process execution method of this embodiment.
Therefore, when the steps in the flow are modified, only the step information of the corresponding steps and the execution logic information are required to be modified, and compared with the method that all the codes need to be read and understood to find the corresponding steps and then the corresponding steps are required to be modified when the steps in the whole flow codes are modified in the prior art, the method does not need to read and understand all the step information, only new step information is required to be added, and then the sequence of the stage instances in the execution logic information is required to be modified.
Step 102, for any step, creating a phase instance corresponding to the step according to the step information of the step.
In this step, when creating the phase instance, a phase instance template may be first obtained, where a preset information field, a preset behavior field, a preset public behavior field, and a result field are set in the phase instance template, where the result field is used to store an execution result when running the phase instance.
The phase instance template may refer to fig. 2, and fig. 2 is a schematic structural diagram of the phase instance template according to the first embodiment of the present application.
As shown in fig. 2, 4 fields, namely, a preset information field (stageInfo), a preset behavior field (execFunction), a preset common behavior field (exec (): void) and a result field (result), are set in the phase instance (stage) template.
And then writing the resource identification and the stage identification into a preset information field, writing the stage behavior code into a preset behavior field, and writing the public behavior code into a preset public behavior field to obtain a stage instance corresponding to the step.
It should be noted that, in the preset information field, besides the processing resource identifier and the stage identifier, some stage control information may also be stored, for example, whether the present stage instance is executed asynchronously. In addition, for the result field, the execution result stored in the result field may be set as a mechanism shared in all phases within the present process, so as to ensure that the subsequent phase instance, which uses the execution result of the phase instance as the execution base, can operate normally.
Based on the above setting, each stage instance can be regarded as a unique execution stage, the created stage instance is put into the stage pool, and when other subsequent processes need the same stage, multiplexing can be performed, so that the behaviors and service attributes of the stages are separated, the reusability is improved, and the process of the subsequent creation process is simpler.
Step 103, creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow through operating the flow instance.
In this step, the execution logic information includes a phase instance sequence and a flow common code, where the phase instance sequence is a list of phase identifiers having an order, such as a flow composed of phase a, phase b, phase c, and phase d, and the phase instance sequence is: order 1: stage a, order 2: stage c, order 3: stage b, order 4: stage d.
The flow common code is the update code of the current flow execution state and the code of some flow exception handling.
It should be noted that, in this step, a flow instance template may be obtained first, where a preset stage list field and a preset flow public behavior field are set in the flow instance template.
Referring specifically to fig. 3, fig. 3 is a schematic structural diagram of a flow example template according to an embodiment of the present application.
As shown in fig. 3, the flow instance (life cycle) template contains 2 fields: a preset phase list field (life cycle: list >) and a preset flow common behavior field (run (): void).
In this step, based on the above fields, the phase instance sequence is written into a preset phase list field, and the flow public code is written into a preset flow public behavior field, so as to obtain the flow instance corresponding to the target flow.
The process of running a flow example in this step may refer to fig. 4, and fig. 4 is a schematic diagram of the running process of the flow example provided in the first embodiment of the present application. As shown in fig. 4, the process of running the flow instance may include:
step 401, retrieving phase instances according to the phase instance sequence contained in the flow instance corresponding to the target flow.
It should be noted that, each flow instance created in the foregoing embodiment corresponds to a different flow identifier, so when a certain target flow is triggered and operated, the step only needs to call the flow instance corresponding to the flow identifier according to the flow identifier included in the trigger instruction.
In this step, the flow instance includes a preset phase list field, in which a phase instance sequence in the execution logic information is encapsulated. The related content may refer to the description of the first embodiment, and will not be repeated here.
It should be noted that, the step of calling is performed sequentially according to the sequence of the phase instances in the flow instance, usually, the current phase instance is executed and the next phase instance is called, so after any phase instance is executed and completed, a phase instance calling instruction is generated, after the phase instance calling instruction is obtained, according to the sequence of the phase instance of the current phase instance, the phase identifier corresponding to the next phase instance sequence of the phase instance is determined from the sequence of the phase instance.
Taking the sequence of the phase instances in the foregoing specific example as an example, if the sequence number of the phase instance of the current phase instance is in the sequence 3, it can be determined that the sequence number of the next phase instance is in the sequence 4, and corresponds to the phase d.
Step 402, executing the stage instance according to the step information contained in the stage instance under the condition that any stage instance is called.
In the common behavior code of the phase instance, jump logic, block logic, and resource lock logic may be set.
For jump logic, this is typically associated with a decision step in the flow. In this embodiment, for the judging step in the flow, the judging step is fused into a phase instance corresponding to the next step to which the affirmative result or a certain result is connected.
It should be noted that, in the judging step in the flow, two or more steps are usually connected, different judging results jump to different steps, one of the steps connected with the judging step may be selected, and when a stage instance of the step is created, the judging logic and the jump value of the judging step are fused into jump logic, and then the jump logic and the jump logic are packaged into a common behavior code of the stage instance.
It should be noted that the skip value may have various arrangements, for example, the skip number may be set to be a skip number, for example, -2, -1, 0, 1, 2, etc., and the skip value is a negative number, which indicates that the skip number is a number of steps requiring reverse skip, for example, -2, and then two steps need to be skipped.
In the setting mode, the sequence number of the current stage instance and the jump value can be added to obtain the sequence number of the next stage instance, and then the stage identifier corresponding to the sequence number is searched from the stage instance sequence.
Of course, the jump value may be a phase identifier directly, and in this setting, the phase identifier in the jump value may be determined as the phase identifier of the next phase instance.
Thus, based on the above settings, the jump logic may be executed first to match the decision steps in the flow when running the phase instance.
In addition, the blocking logic and the resource lock logic are described in the following paragraphs, and are not described in detail herein.
Specifically, in this step, the phase instance includes a preset information field, a preset behavior field, a preset public behavior field, and a result field; the preset information field is encapsulated with a resource identifier in the step information; the preset behavior field is encapsulated with a phase behavior code in the step information; the preset public behavior field is encapsulated with a public behavior code in the step information.
When the method is specifically executed, the resources corresponding to the resource identifiers are obtained; the phase behavior code and the common behavior code are then executed based on the resource and the execution results are stored in the results field.
Of course, in order to avoid the occurrence of a condition that the same resource is chaotic due to simultaneous access of multiple phases, the embodiment sets a resource lock logic and a blocking logic, specifically, acquires a resource lock corresponding to a resource identifier, and acquires a resource corresponding to the resource identifier when the resource lock is acquired. And under the condition that the execution of the instance at any stage is completed, releasing the resource lock corresponding to the resource identifier.
And if the resource lock corresponding to the resource identifier is not acquired, repeating the step of acquiring the resource lock corresponding to the resource identifier, thereby realizing the blocking effect.
By setting the resource lock mechanism, the resource can be used only when the resource lock is acquired, if the resource lock is acquired by the stage instance, the resource cannot be used if other stage instances cannot acquire the resource lock, and the other stage instances can only release the resource lock after the execution of the stage instance is completed, so that the resource lock can be acquired.
It should be noted that, in this step, the execution results of each stage instance are all shared with each other, and the shared manner may be writing the execution results into a certain file.
Step 403, determining that the execution of the target flow is completed in the case of executing the last phase instance indicated by the execution phase instance sequence.
In this step, the last stage identification of the stage instance sequence in the execution logic information is the last stage instance, and after the stage instance is completed, it represents that the execution of the target flow is completed.
In this embodiment, under the condition that a flow execution request carrying a flow identifier is received, logic information of execution of a target flow corresponding to the flow identifier and step information of each step are obtained; for any step, creating a phase instance corresponding to the step according to the step information of the step; and creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow through the operation flow instance. Based on the above, in the embodiment of the present application, each step of the flow is respectively instantiated as a corresponding stage instance, and then the execution logic information is instantiated as a flow instance, so that the execution logic of a single step and the service logic corresponding to the flow are separated, the coupling degree of codes between the steps is greatly reduced, and when a certain step needs to be modified, only the step information of the step and the related execution logic information need to be adjusted, and no destructive modification of the codes is required, so that the modification process is simpler, and the investment of manpower and material resources is reduced.
Example two
Fig. 5 is a schematic structural diagram of a flow execution device according to a second embodiment of the present application. The flow execution device provided by the embodiment of the application can execute the flow execution method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. The device may be implemented in software and/or hardware, as shown in fig. 5, and the flow execution device specifically includes: an information acquisition module 501, a phase instance creation module 502, a flow instance creation module 503, and a flow instance running module 504.
The information acquisition module is used for acquiring the execution logic information of the target flow corresponding to the flow identifier and the step information of each step under the condition that the flow execution request carrying the flow identifier is received;
the phase instance creation module is used for creating a phase instance corresponding to the step according to the step information of the step for any step;
the flow instance creation module is used for creating a flow instance corresponding to the target flow according to the execution logic information;
and the flow instance operation module is used for realizing the operation of the stage instance of each step in the target flow by operating the flow instance.
Example III
Fig. 6 is a schematic structural diagram of an electronic device according to a third embodiment of the present application, as shown in fig. 6, the electronic device includes a processor 610, a memory 620, an input device 630, and an output device 640; the number of processors 610 in the electronic device may be one or more, one processor 610 being taken as an example in fig. 6; the processor 610, memory 620, input device 630, and output device 640 in the electronic device may be connected by a bus or other means, for example in fig. 6.
The memory 620 is a computer readable storage medium, and may be used to store a software program, a computer executable program, and modules, such as program instructions/modules corresponding to the process execution method in the embodiment of the present invention. The processor 610 executes various functional applications of the electronic device and data processing by executing software programs, instructions and modules stored in the memory 620, namely, implements the above-described flow execution method:
under the condition of receiving a flow execution request carrying a flow identifier, acquiring execution logic information of a target flow corresponding to the flow identifier and step information of each step;
for any step, creating a phase instance corresponding to the step according to the step information of the step;
and creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow through the operation flow instance.
Further, the step information comprises a resource identifier, a stage behavior code and a public behavior code;
creating a stage instance corresponding to the step according to the step information of the step, including:
acquiring a phase instance template, wherein the phase instance template is provided with a preset information field, a preset behavior field, a preset public behavior field and a result field, and the result field is used for storing an execution result when the phase instance is operated;
writing the resource identification and the stage identification into a preset information field, writing the stage behavior code into a preset behavior field, and writing the public behavior code into a preset public behavior field to obtain a stage instance corresponding to the step.
Further, the execution logic information includes phase instance sequence and flow common code;
creating a flow instance corresponding to the target flow according to the execution logic information, including:
acquiring a flow instance template, wherein a preset stage list field and a preset flow public behavior field are arranged in the flow instance template;
and writing the phase examples into a preset phase list field sequentially, and writing the flow public codes into a preset flow public behavior field to obtain flow examples corresponding to the target flow.
Further, the flow instance includes a preset stage list field, and a stage instance sequence is encapsulated in the preset stage list field;
the operation of the stage instance of each step in the target flow is realized through the operation flow instance, which comprises the following steps:
according to the phase instance sequence contained in the flow instance corresponding to the target flow, the phase instance is fetched;
under the condition that any phase instance is called, executing the phase instance according to the step information contained in the phase instance;
in the case of executing the last phase instance of the completion phase instance sequence indication, determining that the target flow execution is complete.
Further, the phase instance includes a preset information field, a preset behavior field, a preset common behavior field, and a result field; the preset information field is encapsulated with a resource identifier in the step information; the preset behavior field is encapsulated with a phase behavior code in the step information; the preset public behavior field is encapsulated with a public behavior code in the step information;
executing the phase instance according to the step information contained in the phase instance, including:
acquiring resources corresponding to the resource identifiers;
the phase behavior code is executed based on the resource and the common behavior code, and the execution result is stored in the result field.
Further, obtaining the resource corresponding to the resource identifier includes:
acquiring a resource lock corresponding to the resource identifier, and acquiring a resource corresponding to the resource identifier under the condition that the resource lock is acquired;
and if the resource lock corresponding to the resource identifier is not acquired, repeating the step of acquiring the resource lock corresponding to the resource identifier.
Further, the method further comprises:
and under the condition that the execution of the instance at any stage is completed, releasing the resource lock corresponding to the resource identifier.
Memory 620 may include primarily a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required for functionality; the storage data area may store data created according to the use of the terminal, etc. In addition, memory 620 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 620 may further include memory remotely located relative to processor 610, which may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Example IV
A fourth embodiment of the present application also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a process execution method comprising:
under the condition of receiving a flow execution request carrying a flow identifier, acquiring execution logic information of a target flow corresponding to the flow identifier and step information of each step;
for any step, creating a phase instance corresponding to the step according to the step information of the step;
and creating a flow instance corresponding to the target flow according to the execution logic information, and operating the phase instance of each step in the target flow through the operation flow instance.
Further, the step information comprises a resource identifier, a stage behavior code and a public behavior code;
creating a stage instance corresponding to the step according to the step information of the step, including:
acquiring a phase instance template, wherein the phase instance template is provided with a preset information field, a preset behavior field, a preset public behavior field and a result field, and the result field is used for storing an execution result when the phase instance is operated;
writing the resource identification and the stage identification into a preset information field, writing the stage behavior code into a preset behavior field, and writing the public behavior code into a preset public behavior field to obtain a stage instance corresponding to the step.
Further, the execution logic information includes phase instance sequence and flow common code;
creating a flow instance corresponding to the target flow according to the execution logic information, including:
acquiring a flow instance template, wherein a preset stage list field and a preset flow public behavior field are arranged in the flow instance template;
and writing the phase examples into a preset phase list field sequentially, and writing the flow public codes into a preset flow public behavior field to obtain flow examples corresponding to the target flow.
Further, the flow instance includes a preset stage list field, and a stage instance sequence is encapsulated in the preset stage list field;
the operation of the stage instance of each step in the target flow is realized through the operation flow instance, which comprises the following steps:
according to the phase instance sequence contained in the flow instance corresponding to the target flow, the phase instance is fetched;
under the condition that any phase instance is called, executing the phase instance according to the step information contained in the phase instance;
in the case of executing the last phase instance of the completion phase instance sequence indication, determining that the target flow execution is complete.
Further, the phase instance includes a preset information field, a preset behavior field, a preset common behavior field, and a result field; the preset information field is encapsulated with a resource identifier in the step information; the preset behavior field is encapsulated with a phase behavior code in the step information; the preset public behavior field is encapsulated with a public behavior code in the step information;
executing the phase instance according to the step information contained in the phase instance, including:
acquiring resources corresponding to the resource identifiers;
the phase behavior code is executed based on the resource and the common behavior code, and the execution result is stored in the result field.
Further, obtaining the resource corresponding to the resource identifier includes:
acquiring a resource lock corresponding to the resource identifier, and acquiring a resource corresponding to the resource identifier under the condition that the resource lock is acquired;
and if the resource lock corresponding to the resource identifier is not acquired, repeating the step of acquiring the resource lock corresponding to the resource identifier.
Further, the method further comprises:
and under the condition that the execution of the instance at any stage is completed, releasing the resource lock corresponding to the resource identifier.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present application is not limited to the above method operations, but may also perform the related operations in the flow execution method provided in any embodiment of the present application.
From the above description of embodiments, it will be clear to a person skilled in the art that the present application may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk, or an optical disk of a computer, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method of the embodiments of the present application.
It should be noted that, in the above-mentioned embodiments of the search apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above-mentioned division, as long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present application.
Note that the above is only a preferred embodiment of the present application and the technical principle applied. Those skilled in the art will appreciate that the present application is not limited to the particular embodiments described herein, but is capable of numerous obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the present application. Therefore, while the present application has been described in connection with the above embodiments, the present application is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present application, the scope of which is defined by the scope of the appended claims.
Claims (8)
1. A flow execution method, the method comprising:
under the condition of receiving a flow execution request carrying a flow identifier, acquiring execution logic information of a target flow corresponding to the flow identifier and step information of each step;
for any step, creating a phase instance corresponding to the step according to the step information of the step;
creating a flow instance corresponding to the target flow according to the execution logic information, and operating the flow instance to realize the operation of the stage instance of each step in the target flow; the execution logic information comprises a phase instance sequence and a flow public code, the flow instance comprises a preset phase list field, and the phase instance sequence is packaged in the preset phase list field;
the creating a flow instance corresponding to the target flow according to the execution logic information includes:
acquiring a flow instance template, wherein a preset stage list field and a preset flow public behavior field are arranged in the flow instance template;
sequentially writing the phase examples into the preset phase list field, and writing the flow public codes into the preset flow public behavior field to obtain flow examples corresponding to the target flow;
the step of implementing the operation of the stage instance of each step in the target flow by operating the flow instance includes:
according to the phase instance sequence contained in the flow instance corresponding to the target flow, a phase instance is fetched;
executing the stage instance according to the step information contained in the stage instance under the condition that any stage instance is called;
and determining that the target flow is executed to be completed under the condition that the last stage instance indicated by the stage instance sequence is executed to be completed.
2. The method of claim 1, wherein the step information includes a resource identification, a phase behavior code, and a common behavior code;
the step of creating the stage instance corresponding to the step according to the step information of the step comprises the following steps:
a phase instance template is obtained, wherein a preset information field, a preset behavior field, a preset public behavior field and a result field are arranged in the phase instance template, and the result field is used for storing an execution result when the phase instance is operated;
writing the resource identifier and the stage identifier into the preset information field, writing the stage behavior code into the preset behavior field, and writing the public behavior code into the preset public behavior field to obtain a stage instance corresponding to the step.
3. The method of claim 1, wherein the phase instance comprises a preset information field, a preset behavior field, a preset common behavior field, and a result field; the preset information field is encapsulated with a resource identifier in the step information; the preset behavior field is encapsulated with a phase behavior code in the step information; the preset public behavior field is packaged with a public behavior code in the step information;
the executing the phase instance according to the step information contained in the phase instance comprises the following steps:
acquiring resources corresponding to the resource identifiers;
the phase behavior code and the common behavior code are executed based on the resource, and the execution result is stored in the result field.
4. A method according to claim 3, wherein the obtaining the resource corresponding to the resource identifier comprises:
acquiring a resource lock corresponding to the resource identifier, and acquiring a resource corresponding to the resource identifier under the condition that the resource lock is acquired;
and if the resource lock corresponding to the resource identifier is not obtained, repeating the step of obtaining the resource lock corresponding to the resource identifier.
5. The method according to claim 4, wherein the method further comprises:
and under the condition that the execution of any stage instance is completed, releasing the resource lock corresponding to the resource identifier.
6. A flow execution apparatus, the apparatus comprising:
the information acquisition module is used for acquiring the execution logic information of the target flow corresponding to the flow identifier and the step information of each step under the condition that the flow execution request carrying the flow identifier is received;
the stage instance creation module is used for creating a stage instance corresponding to any step according to the step information of the step;
the flow instance creation module is used for creating a flow instance corresponding to the target flow according to the execution logic information; the execution logic information comprises a phase instance sequence and a flow public code;
the process instance operation module is used for realizing the operation of the phase instance of each step in the target process by operating the process instance, wherein the process instance comprises a preset phase list field, and the preset phase list field is encapsulated with a phase instance sequence;
the flow instance creation module is specifically configured to:
acquiring a flow instance template, wherein a preset stage list field and a preset flow public behavior field are arranged in the flow instance template;
sequentially writing the phase examples into the preset phase list field, and writing the flow public codes into the preset flow public behavior field to obtain flow examples corresponding to the target flow;
the flow instance operation module is specifically configured to:
according to the phase instance sequence contained in the flow instance corresponding to the target flow, a phase instance is fetched;
executing the stage instance according to the step information contained in the stage instance under the condition that any stage instance is called;
and determining that the target flow is executed to be completed under the condition that the last stage instance indicated by the stage instance sequence is executed to be completed.
7. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the flow performing method of any of claims 1-5.
8. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the flow execution method according to any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410033102.7A CN117539451B (en) | 2024-01-10 | 2024-01-10 | Flow execution method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410033102.7A CN117539451B (en) | 2024-01-10 | 2024-01-10 | Flow execution method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117539451A CN117539451A (en) | 2024-02-09 |
CN117539451B true CN117539451B (en) | 2024-04-12 |
Family
ID=89782683
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410033102.7A Active CN117539451B (en) | 2024-01-10 | 2024-01-10 | Flow execution method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117539451B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6823521B1 (en) * | 1999-02-26 | 2004-11-23 | International Business Machines Corporation | Apparatus and method for communicating between computer systems using active datastreams |
CN1870028A (en) * | 2005-05-26 | 2006-11-29 | 株式会社理光 | Work flow system, work flow processing method and work flow processing program |
US7353488B1 (en) * | 2004-05-27 | 2008-04-01 | Magma Design Automation, Inc. | Flow definition language for designing integrated circuit implementation flows |
GB201207206D0 (en) * | 2012-04-25 | 2012-06-06 | Ibm | Migrating business process instances |
CN114756293A (en) * | 2022-03-07 | 2022-07-15 | 曙光信息产业(北京)有限公司 | Service processing method, device, computer equipment and storage medium |
CN115860451A (en) * | 2022-12-27 | 2023-03-28 | 奇安信网神信息技术(北京)股份有限公司 | Flow operation method and device, electronic equipment and storage medium |
CN115934093A (en) * | 2022-10-31 | 2023-04-07 | 支付宝(杭州)信息技术有限公司 | Applet cross-terminal application method, related device and computer storage medium |
WO2023151268A1 (en) * | 2022-02-14 | 2023-08-17 | 华为云计算技术有限公司 | Service distribution method, apparatus and system |
CN116860344A (en) * | 2023-07-19 | 2023-10-10 | 北京字跳网络技术有限公司 | Flow management method, system, equipment and medium |
-
2024
- 2024-01-10 CN CN202410033102.7A patent/CN117539451B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6823521B1 (en) * | 1999-02-26 | 2004-11-23 | International Business Machines Corporation | Apparatus and method for communicating between computer systems using active datastreams |
US7353488B1 (en) * | 2004-05-27 | 2008-04-01 | Magma Design Automation, Inc. | Flow definition language for designing integrated circuit implementation flows |
CN1870028A (en) * | 2005-05-26 | 2006-11-29 | 株式会社理光 | Work flow system, work flow processing method and work flow processing program |
GB201207206D0 (en) * | 2012-04-25 | 2012-06-06 | Ibm | Migrating business process instances |
WO2023151268A1 (en) * | 2022-02-14 | 2023-08-17 | 华为云计算技术有限公司 | Service distribution method, apparatus and system |
CN114756293A (en) * | 2022-03-07 | 2022-07-15 | 曙光信息产业(北京)有限公司 | Service processing method, device, computer equipment and storage medium |
CN115934093A (en) * | 2022-10-31 | 2023-04-07 | 支付宝(杭州)信息技术有限公司 | Applet cross-terminal application method, related device and computer storage medium |
CN115860451A (en) * | 2022-12-27 | 2023-03-28 | 奇安信网神信息技术(北京)股份有限公司 | Flow operation method and device, electronic equipment and storage medium |
CN116860344A (en) * | 2023-07-19 | 2023-10-10 | 北京字跳网络技术有限公司 | Flow management method, system, equipment and medium |
Non-Patent Citations (2)
Title |
---|
基于PDM的工作流程管理的研究;甘婕;;机械工程与自动化;20081215(第06期);全文 * |
基于实例的动态定义执行工作流引擎研究;林永毅;罗锶;;计算机工程与科学;20070615(第06期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN117539451A (en) | 2024-02-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5042454B2 (en) | Method and computer program for receiving computing system and computing system | |
CN107015853B (en) | Method and device for realizing multi-stage task | |
CN111124906A (en) | Tracking method, compiling method and device based on dynamic embedded points and electronic equipment | |
US7567257B2 (en) | Partition-based undo of partitioned object graph | |
CN108762825B (en) | Method and system for realizing heavy load of dynamic library | |
CN110162344B (en) | Isolation current limiting method and device, computer equipment and readable storage medium | |
US10133768B2 (en) | Latest external dependee entity in transaction record | |
CN112817657B (en) | Application program starting item loading method, device, system and storage medium | |
US20160306841A1 (en) | Collection record for overlapping data stream collections | |
CN111988429A (en) | Algorithm scheduling method and system | |
CN111857984A (en) | Job calling processing method and device in bank system and computer equipment | |
CN109582382B (en) | Loading method and device of configuration information, storage medium and terminal equipment | |
CN112199200B (en) | Resource scheduling method and device, computer equipment and storage medium | |
CN111221650A (en) | System resource recovery method and device based on process type association | |
CN112596746B (en) | Application installation package generation method and device, computer equipment and storage medium | |
CN109783159A (en) | Application starting method and apparatus based on configuration information | |
CN110019260B (en) | User data updating method and related equipment | |
CN117539451B (en) | Flow execution method, device, electronic equipment and storage medium | |
CN112860412A (en) | Service data processing method and device, electronic equipment and storage medium | |
CN114816170A (en) | Rule scheme generation method, device, medium and electronic equipment | |
CN112685360B (en) | Method and device for persistence of memory data, storage medium and computer equipment | |
CN115904611A (en) | Java byte code injection method and device, electronic equipment and storage medium | |
CN114756362A (en) | Resource quota management method and system, intelligent terminal and storage medium | |
CN114020278B (en) | Data processing method, device, equipment and storage medium | |
CN111737964A (en) | Form dynamic processing method, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |