Avoiding Global Variables Wherever Possible

27-10 Developers Guide for Oracle Application Integration Architecture Foundation Pack In situations in which the while loop is being used to process repeating child instances maxOccurences is unbounded in an XML message, the BPEL activities in the while loop have to be designed keeping the possibility of large number of iterations in mind. For example, having 50 activities to process a single instance in a while loop will suddenly result in creation of 5000 activities at run time when an instance document having 100 repeating instances is processed.

27.2.2 Avoiding Global Variables Wherever Possible

Within the assign activity in BPEL, local variables should be used instead of process variables wherever possible. Local variables are limited to the scope in the BPEL process. These get deleted from memory and from the database after you close the scope. On the other hand, the life cycle of a global or process variable is tied to the instance life cycle. These variables stay in memory or disk until the instance finishes. Thus, local variables are preferred to process or global variables. However, if the same variable is being used either in every iteration in the while loop or throughout the entire process, creating one global variable and having that accessed by all iterations would be better. The BPEL fragment in Example 27–4 illustrates the use of local variables. Example 27–4 Using Local Variables scope name=Scope_1 variables variable name=Invoke_CallprocessBillingMove_InputVariable messageType= sordmovsubabcs:ProcessFulfillmentOrderBillingBRMCommsMoveAddSubProcessRequest Message variable name=Invoke_CallprocessBillingMove_OutputVariable messageType= sordmovsubabcs:ProcessFulfillmentOrderBillingBRMCommsMoveAddSubProcessResponse Message variables sequence name=Sequence_MoveAdd_SubProcess assign name=Assign_Variable_Invoke_CallMoveAdd copy from variable=inputSubProcess query=sordsubebo:ProcessFulfillmentOrderBillingBRMCommsSubprocessMessage to variable=Invoke_CallprocessBillingMove_InputVariable part=payload query=sordsubebo:ProcessFulfillmentOrderBillingBRMCommsSubprocessMessage copy assign invoke name=Invoke_CallMove-Add_Subprocess partnerLink=ProcessFulfillmentOrderBillingBRMCommsMoveAddSubProcess portType=sordmovsubabcs:ProcessFulfillmentOrderBillingBRMCommsMoveAddSubProcess operation=processBillingMove inputVariable=Invoke_CallprocessBillingMove_ InputVariable outputVariable=Invoke_CallprocessBillingMove_ OutputVariable sequence scope Best Practices for Designing and Building End-to-End Integration Flows 27-11

27.2.3 Avoiding Large FlowN