Wednesday, 16 November 2016

Usage of Preferences Variable in Oracle SOA/BPM Suite 11G


Oracle has provided the functionality to add preference to your bpel/bpm process. Preference are like a variable from EM console requiring no code changes. For instance, consider one use case for File adapter. Suppose in test environment we are writing the files to /test/source location. Now once the code is moved to production environment, now you want to write the files to /prod/source location.


These types of properties can be set using preference, where you have to just update the value of preference variable for directory location on EM console and there you go. We do not have to explicit make changes in the code to point in to new location and deploy it again.


Depends upon requirement, what type of variable in BPEL/BPM can be declared as preference. I will be demonstrating how to set and get the values of these preference variables and how to change them using EM. 



Step 1: I will be using "HelloWorld" tutorial for this that we created in my first post.Open up your Hello World BPEL process.
Step 2: Got to source of composite.xml and add "<property name="bpel.preference.MyVar">Old Value in Response</property>" in component section.Here we are setting the value for variable "MyVar" which we will be using in our BPEL process.
Step 3: Now double click and open your BPEL process.Open the assign action.We will be populating the result of our BPEL process using this preference variable.Double click on result of our output variable to open up the expression window.Drill down to BPEL XPath Extension Functions and insert getPreference into expression field.Add the preference var in the function as ora:getPreference("MyVar").
Step 4: your assign action will look like this.Click OK.
Step 5: Now deploy your composite on EM and test it passing any random input and open the flow trace of invoke composite.In the assign action you will see value of result as "Old Value in Response".It is the same value that we set inside composite.xml. Click OK.
Step 6: Now we will change this value from EM to some other value.Right click on SOA-Infra --> Administration --> System MBean Browser.
Step 7: Drill down to your composie following this path oracle.soa.config-->Mgd Sever --> SCAComposite-->HeloWorld-->SCacomponnt.SCAComposite-->HelloWorldProcess.
Step 8: Click on the properties tab on the right hand side and expand properties tab to find out element containg your defined preference variable
Step 9: Change its value and click "Apply"
Step 10: Test your interface again and thsi time you will see the updated value in the result.
In this way you can define n number of preference variables in your composite.xml and use them in your BPEL/BPM process.

Note: Make sure you enclose your preference variable using double quotes.

Should you guys have any question, feel free to contact.

Thanks,
Prem Chavvakula.

6 comments: