How to use Preferences in SOA Composites and changing the preference values at runtime

In this post we will see how to create Preference variables in SOA composites and use them in BPEL process.

Oracle SOA suite has provided us the facility to add preferences in your composite process. These preferences are worked as variables which we can change at runtime from EM console.

By using these preferences we won’t require to update the code when we have to change this variable.

Ex:- We can use these variables for Email Addresses and File Locations(usually these values will get changed based on the environment).

Let’s see how to add Preferences to our composites.

Go to source of your composite.xml and add the property  “<property name=”bpel.preference.EmailVar”>testvar@email.com</property>” in component section.

Means we are setting the value for variable “EmailVar” which we will be using in our BPEL process.

pref1

Now open your bpel process and assign this to a variable using the function (getPreference). In my case whenever any error occurs in my bpel process I will send a mail to the user with details. So I have assigned this preference variable to my Email TO list.

Now deploy your composite on EM and test it .

Changing the Preference value from EM console

Right click on SOA-Infra –> Administration –> System MBean Browser.

Go to your composite using this path oracle.soa.config–>soa_server –> SCAComposite–>Project1–>SCacomponnt.SCAComposite–>BPELProcess1.

Click on the properties tab on the right hand side and expand properties tab to find out element contains your defined preference variable

Change its value and click “Apply”.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s