Implementations of the engines allowing to create processes with use of this language I know not so much. In particular, it is possible to mention Oracle BPEL Process Manager and a product about which the speech further – Serena Business Manager (SBM) will go. SBM allows to create quickly the web applications automating some process. An opportunity at the time of state change to call external web service is provided in a process model (workflow). And if it is necessary to implement some logic and one challenge insufficiently? Here also the procedure written in the BPEL language and performed by means of the same BPM platform is useful.
I will not dwell upon the language, it is possible to find enough information in a network on this subject, for example, here. I will describe implementation of a specific objective.
The task was set as follows – to develop functionality of copying of business entities (in my process – TD Links), but not just like that, and with preliminary poll of third-party web service. This service (bridge) possesses the method accepting some object attributes of TD Link on an input. Then bridge polls third-party system and in reply reports whether there can be an object with such attributes in our system. As it does it me does not interest, bridge for me is "a black box".
Besides, I needed one more web service implementing functions of work with business entities in our system (reading, creation, etc.). I will call it AppServices.
The list of steps of which process can be based looks as follows:
The most important of them it:
- Service. Allows to issue the appeal to web service.
- Service. Allows to issue the appeal to web service.
- Calculate. It is used for work with variables, a mapping of data, processings, etc.
- Scope, Compensate and Throw. Steps for error handling.
Other steps implement basic functions – cycles and conditions.
Final worflow looks so:
As objects of TD Links exist in system not in itself, and in connection with other objects (Stagings type), for a start I needed to find in system necessary to me Stagings.
AppServices possesses the method allowing to do selection with use of the SQL query. The SQL query is built directly in the form of a line:
Yes, important retreat. The engine allows to define variables which will be used on the process course, than I in this case also used:
Having created the SQL query, it is possible to pass to a challenge of the necessary method, having executed a mapping of data:
For a mapping both variables, and results of execution of the previous steps of process can be used (for example, result of start of web service).
After a similar method (through the SQL query) selection of objects for copying – TD Links and start of a cycle becomes.
And, at last, the stage of poll of external web service, is configured also through a "Service" element.
The last step we execute creation of the copy of object of TD Link, with saving in it of the results received from bridge (including an error message if it is).
Naturally, from debugging not to get to anywhere, and the building tool has for this purpose quite quite good potential. In particular, it is possible to look at result of execution of each step separately and to see on what of them something went not so.
What can be told as a result. From pluses of the offered implementation it is possible to note the next moments:
- Simplicity of development. In fact, no coding was required.
- Speed. It is possible to create and debug small process in a couple of hours. At the same time I had not to be beyond the regular SBM Composer development environment.
- Convenience of debugging. In total log in one place; it is visible on what step there was a failure. Besides, there is a uniform log where errors during operating time of all working processes are reset.
- Controlled ease of modification. Updating of descriptions of web services, renaming of variables, modification of a mapping of data – all this becomes very easily. And at the same time, my changes are fixed in the embedded system of control of versions – at any time it is possible to be rolled away to the previous working version.
- Possibility of start by means of an external event. In my case process is initiated by the user, clicking on the user interface, but a certain external event can be the initiator of process also.
Minuses, of course, too are:
- Problematical character of implementation of difficult algorithms. Nevertheless, the instrument of creation workflow is limited in the opportunities. Nevertheless it is better for service to make out difficult data handling in own web.
- Difficulties with a mapping of data. Sometimes it is necessary to use additional steps of process for a mapping of data that makes heavier process a little.
- The restrictions imposed on web services. It is supported only architecture of SOAP and REST (through a special wrapper), there are also number of restrictions imposed on the WSDL file.
Thanks to all who read up a post up to the end. Let's be glad to answer your questions in comments.
This article is a translation of the original post at habrahabr.ru/post/273281/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: firstname.lastname@example.org.
We believe that the knowledge, which is available at the most popular Russian IT blog habrahabr.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.