SubProcess is again a new concept that is introduced in ORacle SOA 12c.
It allows the user to define a piece of code in a composite which can be reused within the code any number of time. you can think of it as a piece of pl/sql procedure which can be called from any program, thus it totally supports the feature of WORA.
Sub process are of two types
One is inline and the other one is Standalone subprocess.
Inline subprocess are used inside a scope in a BPEL process and Standalone subprocess appear as a standalone component which we later refer in our BPEL code.A subprocess allows BPEL code reusability , thus reducing the need to create the same activities again and again to perform the same task.Again from the code modularity point of view it again provides a much better way of code maintenance, there is less overhead to create multiple invoke activities and call the same process again and again. Rather one can have a subprocess a just call it as and when required. functionally both stanalone and inline subprocess are same but A stanalone sub process has an additonal advantage that it allows you to work parallely as sub process is defined on its own definition independent of the main BPEL process.
In this exercise we will try to create a standalone Sub process and see how it works , later we will just see how we can create an inline subprocess, Lets first create a BPEL process in an empty composite
Drag and drop a file adpater in the External REference and configure it to write in the local file location.Use the same schema what HelloWorld BPEL has created by default for you.
Finally drag and drop a subprocess in the external reference
Link your subprocess with the File adapter you have created, After linking up the process you can see following in your composite
Now go inside your Sub process and create a new variable.
Make this variable based on the input message you are getting from the HelloWorld BPEL process.
Drag and drop an assign acitivity and assing the data from input variable which you have created to the input of file adapter
This is how your subprocess should look like after completion
Now go inside your Hello World BPEL process -->Right click on it and select Insert AFter and select Call Subprocess-->Standalone-->SubProcess
Now double click on the Sub process you have just added and it will list down the variables for the Sub Process. Click on the Value section and it will open up a new gui that will allow you to search for the Variable, select the input variable from there..
Essentially what we are doing here is that we are copying the content of HelloWorld Bpel process (input Variable) to the input of Subprocess(Input Variable)
As you can observer the variable for Subprocess is now assigned with the value of Hello World input variable
Now go ahead and deploy the process to the server and test it.
You will find that once BPEL process receives the input , the BPEL calls the subprocess and completes the process
Just to ensure that the subprocess is linked to the BPEL process go back to your composite and you can see a dotted line joining the BPEL and the subprocess
Now we will just see how we can create an inline subprocess but we will not implement it as the implementation process will remain the same.
In order to create a inline sub process let drag and drop a scope and define some activities which could be a repeating section.
AS you can see i have define one such activity which has an assign and a call to an adapter. It is essentially the same which i have implemented using the standalone sub process.
Now in the scope in the third last activity if you will hover your mouse you will find that it allows you to convert the scope into a subprocess
give it some name and save it.
Now go inside the bpel process and you can see a subprocess getting attached to the bpel
Now if you will go to the main composite you can not find reference to the sub process
YOU can find the reference to the subprocess form the BPEL page as shown below
No comments:
Post a Comment