Friday, August 30, 2013

Skipping Activites Execution in BPEL

Hi Guys,
I have been away from the blog for quite some time due to work and all.Finally got time to post new blog here. Today I will be explaining the new feature that is available from onwards.Some of you may already knowing it but for those who dont let me tell. You can now skip activities in your BPEL flow without using any switch or if condition. Oracle provides an extension that enables you to specify an XPath expression in an activity in BPEL versions 1.1 and 2.0 that, when evaluated to true, causes that activity to be skipped. This functionality provides an alternative to using a switch activity for conditionally executing activities. The skip condition for activities is specified as follows:

<activity bpelx:skipCondition="boolean-expr"/>

The bpelx:skipCondition attribute causes an XPath expression to be evaluated immediately upon creation of the activity instance. If the skip expression returns a false boolean value, the activity is executed. If the skip expression returns a true boolean value, the activity is completed immediately and execution moves to the activity immediately following that one.

This construct is equivalent to a switch/case structured activity with a single case element with a condition that is the opposite of the skip condition.

I will be demonstrating how to use it.Suppose in my code whenever I pass the input as 5 , I want to skip this invoke activity. Means I dont want this activity to get executed.

How do we go about it.Double click the invoke activity. Go to "Skip Condition" tab. Click on expression and write out your expression as shown in the screenshot:
Now, whenever I will pass the input value as "5", this invoke activity wont be executed.In the flow trace you will see this activity as "Activity Skipped".
There you go.In this way you can skip any activity you intend to skip without coding switch/IF condition in your BPEL code.

Hope this helps.

Happy Learning,
Cheers !!!