Promotion engine in detail

In contrast to the black box view of the promotion engine's architecture topic, this topic discusses the promotion engine at a lower level. The following diagram shows the flow of an invocation of the promotion engine.

First, the PromotionAgendaBuilder, registered with the promotion engine, is called to build an agenda for this invocation. An agenda functions similar to a table that contains a list of promotions to be evaluated, and all of the applicable policies for each promotion.

Once the agenda is built, the promotion engine calls the registered PromotionContextFactory to create a promotion context. Next, the promotion engine calls a registered PromotionSequenceBuilder to sort all of the promotions listed in the Agenda to decide the sequence in which to evaluate the promotions. After the sequence is determined, the initialization phase of a call to the promotion engine is finished.

In the next stage, the promotion engine iterates through the sequence built earlier and evaluates the promotions individually. When a promotion is evaluated and deemed applicable, the promotion engine looks up the promotion execution agenda and finds all of the application promotion policies for this promotion. It then initializes the promotion control block (PCB) and tentatively applies the promotion. After the promotion is tentatively applied, the promotion engine applies the applicable promotion policies individually. If a violation is detected, the PCB is rolled back, and the promotion is not applied. If no violation is found after all of the policies have been applied, the PCB is committed. This means that this promotion is now applied to the order. This process continues until all of the promotions in the sequence have been evaluated. Then, a PromotionArgument object is built based on the content of the Promotion Context and returned as the result of this invocation.

This following topics look at the different parts of the promotion engine:

All of these configurable components are specified in a configuration XML file. The Promotion engine is configured per WebSphere Commerce instance. It is not possible to have different configurations for stores in the same instance. A complete configuration file is given in the sample promotion engine configuration XML file topic. The configuration file can be found in WebSphere Commerce in the /WC_installDir/instances/instance/xml/PromotionEngineConfiguration/ directory.

Related concepts