Multiple built-on application stack
When you design applications in Pega Platform™, you often build on existing applications to reuse functionality and accelerate development. However, this creates a hierarchical tree structure with your application at the top and built-on applications branching below it. At Runtime, Pega Platform automatically converts this hierarchical tree into a single, linear application stack that determines rule running order.
Application stacking algorithm
While creating the runtime application stack, Pega Platform applies the flattening algorithm following three key rules:
Depth-First Processing: The system processes each built-on application by exploring one branch in the hierarchy completely before moving to the next. This process is done from top to bottom, following each application completely until PegaRULES, before moving to the next.
Handling Duplicate Applications: When the same application appears multiple times in your hierarchy, the system applies specific logic. If the duplicates have the same version, Pega Platform keeps only the application at the lowest position in the tree and ignores the others. If the duplicates have different versions, the system uses the highest version number available.
PegaRULES Placement: PegaRULES always sits at the bottom of the linear application stack, providing the foundational Rules for your entire application.
The following figure represents the automatic conversion of a hierarchical application tree into a single linear application stack at run time:
Consider a slightly more advanced application stack, as shown in the example below, for the Hotel Booking application of an event management company named FSG.
Following the depth-first algorithm on the application tree hierarchy on the left, system arrives at the application stack on the right. However, there are duplicate applications in the flattened stack, such as FSG and PegaRULES. The duplicate handling algorithm is then applied, where the highest version of the duplicate application is placed in its lowest position in the stack. For example, highest version of FSG falls at the bottom-most position where the application appears in the stack. The following figure shows the resultant Ruleset stack in the operator profile:
Ruleset behavior at design time
Ruleset stack assembly for a specific Rule at design time is based only on the Rule's owning application. After determining a Rule's owning application, Pega Platform automatically creates the linear Ruleset stack for that specific Rule, starting with the Rule's owning application and working through the hierarchical application tree branch to PegaRULES.
Ruleset behavior at run time
At run time, Pega Platform creates the linear application stack for the entire tree of all built-on applications by following the same guidelines explained above. This application stack is the basis for application functionality in a live environment.
Understanding this linear stack conversion and ruleset precedence helps you predict which Rules will run and design your application architecture more effectively. Refer to the Application stack hierarchy for multiple built-on applications topic on the docs site for more details and examples.
Check your knowledge with the following interaction: