Summary of the invention
In view of this, the application provides a kind of service request processing method and device, service request processing system.
To achieve the above object, technical solution provided by the present application is as follows:
According to a first aspect of the present application, a kind of service request processing method is proposed, comprising:
Flow engine receives the service request for the carrying required parameter value that request end is sent;
Flow engine determines packet corresponding with the required parameter value carried in the request of data according to flow template file
Target flow template containing at least one flow object, the flow template file include predetermined flow template and request
The corresponding relationship of parameter value;
Flow engine is from obtaining corresponding with each flow object in target flow template industry in code components container
Business code simultaneously loads, and the code components container storage has the universal code component and individualized code component extracted in advance, institute
The code stated in code components container is updated by Dynamical Deployment mode;
Flow engine successively executes the service code according to the sequence of flow object in the target flow template, obtains
Implementing result is simultaneously back to the request end.
According to a second aspect of the present application, a kind of service request processing unit is proposed, is applied in flow engine, the dress
It sets including request reception unit, flow template determination unit, Code obtaining unit and code execution unit, in which:
The request reception unit receives the service request for the carrying required parameter value that request end is sent;
The flow template determination unit is determining to join with the request carried in the request of data according to flow template file
The corresponding target flow template comprising at least one flow object of numerical value, the flow template file include predetermined stream
The corresponding relationship of journey template and required parameter value;
The Code obtaining unit from code components container obtain with the target flow template in each flow object
Corresponding service code simultaneously loads, and the code components container storage has the universal code component and individualized code extracted in advance
Component, the code in the code components container are updated by Dynamical Deployment mode;
The code execution unit successively executes the business according to the sequence of flow object in the target flow template
Code obtains implementing result and is back to the request end.
According to the third aspect of the application, a kind of service request processing system, including flow engine, code update are proposed
Server, static component container and dynamic assembly container;
The static component container storage has universal code component, and the dynamic assembly container storage has individualized code group
Part;
The code update server be used for by way of Dynamical Deployment to the code in the dynamic assembly container into
Row updates;
The flow engine includes that request reception unit, flow template determination unit, Code obtaining unit and code execute
Unit, in which:
The request reception unit receives the service request for the carrying required parameter value that request end is sent;
The flow template determination unit is determining to join with the request carried in the request of data according to flow template file
The corresponding target flow template comprising at least one flow object of numerical value, the flow template file include predetermined stream
The corresponding relationship of journey template and required parameter value;
The Code obtaining unit obtains and the target flow template from static component container and dynamic assembly container
In the corresponding service code of each flow object and load;
The code execution unit successively executes the business according to the sequence of flow object in the target flow template
Code obtains implementing result and is back to the request end.
By above technical scheme as can be seen that the embodiment of the present application can be general by taking out different business scene
Code (universal code component) and each business scenario cannot be general individualized code component, and these code components are stored
In code components container.It, can be according to the required parameter value carried in service request, really during service request processing
The fixed corresponding target flow template comprising at least one flow object is then obtained from above-mentioned code components container
Required service code simultaneously loads, finally, successively execute according to the sequence of flow object in the target flow template described in
Service code obtains implementing result and is back to the request end.The embodiment of the present application can effectively promote tieing up for flow engine
Shield property, scalability.In addition, in the embodiment of the present application, the code in the code components container can pass through dynamic state part management side
Formula is updated, so that the flexibility of code deployment is improved by combining flow engine technology and Dynamical Deployment technology, it is real
The update upgrading that new realization logic is completed in the case where not restarting application server now, reduces code development cost.
Specific embodiment
Fig. 1 is a kind of system architecture shown according to an exemplary embodiment, the system may include: application server,
Code update server, static component container and dynamic assembly container.Wherein, it is deployed with flow engine on application server,
Static component container and dynamic assembly container can be with persistences in certain database (Database), code update server
On be deployed with backstage management procedure, to be updated to the code components stored in database, wherein SQL language can be passed through
Sentence realizes the operation for increasing, deleting, change, looking into access above-mentioned database.Application server is for receiving the business that request end is sent
It requests and executes corresponding processing movement, and return to corresponding processing result.For example, above-mentioned request end can for external system or
The client device that user uses.Above-mentioned application server needs to meet the demand of different business scenarios, for different industry
Business scene, can realize by the inclusion of the service request of different required parameter values.Typically, for different business fields
Scape, the required operation flow handled of flow engine is also different.This just determines under different business scene, flow engine
The difference of the code of required execution.For this purpose, at least two different business scenarios can be taken out in advance in the embodiment of the present application
Can general code components (referred to as " universal code component ") and different business scene cannot be general code components (referred to as
" individualized code component "), for the ease of the management of code, execution efficiency is improved, above-mentioned static component container can be used for depositing
It puts and states universal code component, above-mentioned dynamic assembly container can be used for storing above-mentioned individualized code component.Flow engine exists
After receiving service request, then required generation can be got respectively from above-mentioned static component container, dynamic assembly container
Code character part simultaneously executes.Come specifically to describe realization process below with reference to Fig. 2.
As shown in Fig. 2, this method can be applied to flow engine, which can be deployed on application server, example
Such as, the effect of the application server, which can be, provides data service for outside.In one embodiment, this method includes the following steps
101~104, in which:
In a step 101, the service request for the carrying required parameter value that request end is sent is received.
For example, the required parameter in each service request from request end is as follows:
" serviceType ", " tradeType " and " sceneType ";
Wherein, " serviceType " can represent service type, and " tradeType " can represent type of transaction, "
SceneType " can represent scene type.
It is required in each service request comprising value corresponding with above-mentioned each required parameter, for example, " serviceType "
=" TRANS_IN ", " tradeType "=" PKG_BUY ", " sceneType "=" QIANBAO01 ".
In a step 102, according to flow template file, determination is corresponding with the required parameter value carried in the request of data
The target flow template comprising at least one flow object, wherein the flow template file include predetermined process
The corresponding relationship of template and required parameter value.
Since different business scenarios corresponds to different operation flows, need to realize by different service requests.
In the embodiment of the present application, it can be described by the inclusion of the flow template of at least one flow object needed for some business scenario
The operation flow to be executed (including which process, the order etc. between each process).For this reason, it may be necessary to predefine process mould
The corresponding relationship of plate and required parameter value, to can quickly be determined corresponding after receiving a service request
Target flow template.
For example, for describing a kind of exemplary flow template text of the corresponding relationship of flow template and required parameter value
Code content in part is as follows:
Wherein, by above-mentioned code content, when in service request required parameter " serviceType ", "
TradeType ", " sceneType " value be respectively " TRANS_IN ", " PKG_BUY ", " QIANBAO01 " when, be matched to
Target flow template is made of following flow object (according to precedence):
" PRO-TRANS-IN-PKG-BUY-INIT " (process one);
" PRO-TRANS-IN-PKG-BUY-PRECHECK " (process two);
" PRO-TRANS-IN-PKG-BUY-APPLY " (process three);
" PRO-TRANS-IN-PKG-BUY-CONFIRM " (process four);
" PRO-TRANS-IN-SUCCESS-RESULT-RETURN " or
" PRO-TRANS-IN-FAIL-RESULT-RETURN " (process five).
After step 102, flow engine needs to instantiate each flow object for including in the target flow template.?
In the programming of object-oriented, usually the process referred to as instantiation with class creation object.
Above-mentioned example code only lists the flow template under a kind of business scenario, in actual moving process, developer
Corresponding flow template accordingly can be set for other business scenarios in advance, and in the form of code according to actual needs
It is added in above-mentioned flow template file, will not enumerate herein.It should be noted that according to the development of business, developer
The corresponding relationship in above-mentioned flow template file can be dynamically adjusted, so-called dynamic adjustment, which refers to, is not restarting application server
In the case of be adjusted.Modified flow template file can be uploaded to the database that can be accessed by flow engine by developer
In, flow engine can route operation flow according to the flow template file after change when perceiving change.
In step 103, corresponding with each flow object in the target flow template from being obtained in code components container
Service code and load, wherein code components container storage has the universal code component extracted in advance and personalized generation
Code character part, the code in the code components container are updated by Dynamical Deployment mode.
In an alternative embodiment, the code components container may include the static component that storage has universal code component
Container and storage have the dynamic assembly container of individualized code component;Wherein, the code in the dynamic assembly container passes through dynamic
State deployment way is updated." Dynamical Deployment " is alternatively referred to as " heat deployment (hotswap) ", and heat deployment is not restart business clothes
It is engaged under the premise of device, energy Auto-Sensing updates the behavior of runtime code to the variation of code file.In the embodiment of the present application,
Compared to static component container, the code in dynamic assembly container is due to needing regular change, often with business complexity
The increase of degree, later period are larger for the maintenance cost of dynamic assembly container, and scalability is also general.For this purpose, the embodiment of the present application is logical
The mode that static component container and dynamic assembly container combine is crossed, it periodically or non-periodically will be certain in dynamic assembly container
It can be transferred in static component container by the code components that at least two business scenarios are multiplexed and carry out persistent storage, to the greatest extent may be used
Energy ground reduces the code components stored in dynamic assembly container, stores in static component container draw for process as much as possible
The code components of load are held up, maintenance cost is reduced.In other embodiments, when a certain object code component is in one section of long period
When not changing inside, which can also be transferred in the static component container from the dynamic assembly container.It is right
In the individualized code for needing newly-increased some business scenarios or realization logic, the mode that can first pass through Dynamical Deployment is stored in
In above-mentioned dynamic assembly container, to avoid restarting for application server, guarantee not interrupting for service operation.In an embodiment
In, the universal code component is the JAVA code (the JAVA code after compiling) being packaged, and the individualized code component is to need
Want the JAVA class, and/or dynamic script (such as groovy script), and/or EL expression formula of dynamically load.
Based on the above content, in an alternative embodiment, step 103 be may particularly include:
Step 1031: flow engine determines according to each flow object for including in the target flow template and realizes the mesh
Mark universal code component and individualized code component required for flow template;
Step 1032: flow engine obtains the universal code component from the static component container;
Step 1033: flow engine obtains the individualized code component from the dynamic assembly container.
For example, a kind of specific implementation code of each flow object in target flow template is as follows:
Wherein, above-mentioned various flow objects can be realized by one or more " action ".Each realization of " action "
Code can be compiled using JAVA sentence, and/or EL (Expression Language) expression formula, and/or groovy script etc.
It writes.For in above-mentioned " action ", " action " (i.e. general purpose module) that can be general by different business scene can be divided into,
And cannot be general by different business scene " action " (i.e. personalization component).Developer can take out every in advance
A code components define corresponding label, to indicate that it belongs to general purpose module or personalization component.
In the embodiment of the present application, logical required for being got respectively from static component container and dynamic assembly container
After component and personalization component, the service code of acquisition can be loaded.Wherein, code is read from database and is answered
It is loading procedure with the process in the memory of server.
At step 104, the service code is successively executed according to the sequence of flow object in the target flow template,
It obtains implementing result and is back to the request end.
According to practical business demand, it can recycle and execute above-mentioned loaded service code, until being held required for obtaining
Row result.Certainly, if implementing result (executing exception) can not be obtained, corresponding exception information can also be returned to request end.
By above-mentioned service request processing method, due to taking out the generally applicable code of different business scene and cannot lead to
Individualized code, and be persisted in static component container and dynamic assembly container respectively, it can effectively promote flow engine
Maintainability, scalability, maintenance cost is effectively reduced, and to a certain extent improve flow engine execution efficiency.
In addition, can be updated by Dynamical Deployment mode to the code components in dynamic assembly container, thus by drawing process
It holds up technology and Dynamical Deployment technology combines, improve the flexibility of code deployment, realize the case where not restarting application server
The lower update upgrading for completing new realization logic, reduces code development cost.
Fig. 3 is the hardware configuration of a kind of electronic equipment shown according to an exemplary embodiment.Referring to FIG. 3, in hardware
Level, the electronic equipment can be the application server for being deployed with flow engine, which may include processor, inside
Bus, network interface, memory (including memory and nonvolatile memory), are also possible that certainly required for other business
Hardware.Wherein, it can store the interrelated logic to realize above-mentioned service request processing method in memory (to calculate
Machine program), processor can from read in nonvolatile memory corresponding computer program into memory then run.Certainly,
Other than software realization mode, the application is not precluded other implementations, such as logical device or software and hardware combining
Mode etc., that is to say, that the executing subject of following process flow is not limited to each logic unit, be also possible to hardware or
Logical device.
As shown in figure 4, in one embodiment, a kind of service request processing unit 200 can be applied in flow engine, it should
Device 200 may include that request reception unit 201, flow template determination unit 202, Code obtaining unit 203 and code execute
Unit 204, in which:
The request reception unit 201 receives the service request for the carrying required parameter value that request end is sent.
The flow template determination unit 202 is asked according to flow template file, determination with what is carried in the request of data
The target flow template comprising at least one flow object of asking parameter value corresponding, the flow template file include to predefine
Flow template and required parameter value corresponding relationship.
The Code obtaining unit 203 from code components container obtain with the target flow template in each process pair
It as corresponding service code and loads, the code components container storage has the universal code component extracted in advance and personalized generation
Code character part, the code in the code components container are updated by Dynamical Deployment mode.
The code execution unit 204 successively executes the industry according to the sequence of flow object in the target flow template
Business code obtains implementing result and is simultaneously back to the request end.
In an optional embodiment, the code components container includes that storage has the static component of universal code component to hold
Device and storage have the dynamic assembly container of individualized code component.
Wherein, the Code obtaining unit 203 may particularly include:
It determines subelement, according to each flow object for including in the target flow template, determines and realize the target process
Universal code component and individualized code component required for template;
First obtains subelement, and the universal code component is obtained from the static component container;
Second obtains subelement, and the individualized code component is obtained from the dynamic assembly container.
In an optional embodiment, the code in the dynamic assembly container can be carried out more by Dynamical Deployment mode
Newly.
In an optional embodiment, described device further include:
Code transformations unit, when the object code in the dynamic assembly container is multiplexed by least two business scenarios,
The object code is transferred in the static component container from the dynamic assembly container.
In an optional embodiment, described device further include:
Instantiating unit instantiates each flow object for including in the target flow template.
In an optional embodiment, the universal code component is the JAVA code being packaged, the individualized code group
Part is the JAVA class, and/or dynamic script, and/or EL expression formula for needing dynamically load.
The step of above computer program is realized when being executed by processor is referred to the description to embodiment of the method above,
Also, under the premise of not colliding, the content of above-mentioned apparatus embodiment and the content of above method embodiment can mend each other
It fills, this is no longer repeated.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
For convenience of description, it is divided into various units when description apparatus above with function to describe respectively.Certainly, implementing this
The function of each unit can be realized in the same or multiple software and or hardware when application.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flashRAM).Memory is showing for computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitorymedia), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can provide as method, system or computer program product.
Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application
Form.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program code
The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The application can describe in the general context of computer-executable instructions executed by a computer, such as program
Module.Generally, program module includes routines performing specific tasks or implementing specific abstract data types, programs, objects, group
Part, data structure etc..The application can also be practiced in a distributed computing environment, in these distributed computing environments, by
Task is executed by the connected remote processing devices of communication network.In a distributed computing environment, program module can be with
In the local and remote computer storage media including storage equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The above description is only an example of the present application, is not intended to limit this application.For those skilled in the art
For, various changes and changes are possible in this application.All any modifications made within the spirit and principles of the present application are equal
Replacement, improvement etc., should be included within the scope of the claims of this application.