Pipeline Execution Steps

To understand how a pipeline is processed, consider the steps involved in processing a hypothetical AddToBasket pipeline and the exchange of data between a pipelet and the Pipeline Dictionary.

Assume the URL triggering this pipeline is:

http://<host>/on/demandware.store/<Site>/default/USD/AddToBasket-Add?UserID=123&ProductID=456

Where:

  • <host>/on/demandware.store/<Site> is the storefront URL
  • default is the locale
  • USD is the directory that contains the pipeline
  • AddToBasket is the name of the pipeline
  • Add is the start node
  • UserID=123, ProductID=456 are parameters with their respective values.

Assuming that the request handler servlet has appropriately analyzed the request (identifying which pipeline needs to be triggered), the pipeline behaves as follows:

  1. The Pipeline Processor initializes the Pipeline Dictionary.

    Any parameters passed to the start of the pipeline by the current request are stored as key-value pairs in the Pipeline Dictionary. The parameter name is the key and has an associated value. The data are maintained in the Pipeline Dictionary until the pipeline ends and clears the dictionary.

    (In this example, UserID is a key and "123" is its value. ProductID is a key and "456" is its value.)

  2. The Pipeline Processor executes each pipelet and flow control action in sequential order.
    1. Pipelets are executed by calling a method of each pipelet class and passing the Pipeline Dictionary as an argument.

      Each pipelet might require a key-value pair (or pairs) to be available in the Pipeline Dictionary.

    2. The pipelet checks the Pipeline Dictionary. If it finds the necessary keys, it executes its business function.
    3. As a result of executing, the pipelet might add other key-value pairs to the Pipeline Dictionary.

      The Pipeline Dictionary cumulatively stores all key-value pairs from all preceding pipelet activity until it reaches an end point. The Pipeline Dictionary reference is passed to any subpipeline called, and is returned to the calling pipeline after the subpipeline has executed.

  3. The pipeline processes the interaction end node, calling a template.

    Using data stored in the Pipeline Dictionary, a response is generated from the template to be sent back to the client as an HTML page. Serving a request might include more than one pipeline. Due to the separation of presentation and processing pipelines, it typically includes subpipelines that are called into a process with a call node.

    Note: Many pipelines, in particular processing pipelines, do not terminate in an interaction node.