rss
SOATUBE
Oracle
Custom Search SOABYTE here

Friday, June 25, 2010

Looping and condition statements

















Wherever possible, use transformation for looping rather than using assign and while loop activities.
This is because:
a) XSL will execute faster for loops than a while loop.
b) There will be only one transform activity in your process (instead of having many activities like assigns and while activities).
Note:
 If you have an EBM/ABM that has multiple occurences of a Complex Type element in it and you need to process something for each occurence of the repeatable element, please refrain from using while loop activity in your BPEL to loop through each occurence. Instead, use an xsl:for-each and transform the whole EBO/ABM at one shot through an xsl transformation activity. You can use templates and xsl:if and/or xsl:choose in the templates thus created to achieve your conditional functionality within the xsl itself instead of using switch/case in BPEL if possible.





 You might have faced performance issues when processing huge files (of the order of 2 MB xml or 250KB csv) owing to the reason above. Apart from this, a very prominent yet possibly overlooked reason for performance degradation could be your Condition statement in the Switch activity. For example in case the EBM structure is as below:
CreateInvoiceListEBM
L CreateInvoiceList
L DateArea
L XXX elements
DateArea
L XXX elements
.
.
DateArea
L XXX elements


You want to continue with some processing if the input ListEBM had atleast one occurence of DataArea complexType. So the logical condition that you could opt for can be {if count (CreateInvoiceListEBM/CreateInvoiceList/DataArea) > 0 } then proceed inside the Case activities. But if the EBM under consideration has DataArea of the order of 200+ something it will wreak havoc on the processing engine time since it will be traversing the whole EBM to find the count of DataArea and then go inside the Case. But it would have just sufficed to know that atleast one DataArea exists. So you can have the condition as:
{if string-length(CreateInvoiceListEBM/CreateInvoiceList/DataArea) != 0 } then proceed into the Case. This would always check if the first DataArea has any elements inside it. If true you are good to go. So there is actually no need to know the count of such elements.

0 comments:

Post a Comment

 
Blogger Profile