ATG Pipeline

  • A pipeline is a series of action to be execute.
  • ATG Commerce has multiple pipeline chain
  • Each chain is made up of processor.
  • Pipeline are configured in xml file.

There are two types of pipeline in ATG.
  • Request Handling Pipeline
  • Processor Pipeline Or Commerce Pipeline

Servlet Pipeline

  • Creating request handling pipeline.
  • All servlet in pipeline should implements "atg.servlet.pipeline.pipelinableServlet".
  • Or extends "atg.servlet.pipeline.pipelinableServletImpl" and override service() method.
  • Set "nextServlet" property.

There are two sub interface to determine the next pipeline process -
  • InsertableServlet
  • DispatcherPipelineServlet

Insertable Servlet :

  • Servlet implements "InsertableServlet" having property "insertAfterServlet"
  • Advantage of using this is - We don't have to modify the previous servlet property.
  • For example : Request Handling pipeline having servlet1 and servlet2. We want to put our customServlet in between both of them. If we use "PipelinableServlet", we need to modify the servlet1 property. But in case of "InsertableServlet", there is no need to modify the servlet1 property. We only need to add "insertAfterServlet=servlet1" in customServlet component.

Process to create a Insertable Servlet -
  • Create a servlet by implementing InsertableServlet
  • Set insertAfterServlet property
  • Add component path to initalService property of /atg/dynamo/service/initial
  • initalServices+=/CustomServlet

Dispatcher Servlet :

  • Servlet should implements "DispatcherPipelineServlet".
  • It is used to provide conditional pipeline.
  • DispatcherServiceMap will be a map of servlet, that can be invoke according to condition.

Processor Pipeline / Commerce Pipeline :

  • Modify PipelineRegistry.xml add pipeline Manager
  • Create PipelineManager.xml and component
  • Create Processors
  • Create pipeline Definition files
  • Create Processor chains

Creating a custom commerce pipeline :

Steps to create custom commerce pipeline -
  • Create processor component by implementing atg.service.pipeline.PipelineProcessor interface.
  • Override the int runProcess() method. It returns an integer status code that the Pipeline Manager uses to determine the next processor to run. Return 0 will stop chain execution. In below example returning '1' will call the "proc2"
  • int[] getRetCodes() : Returns an array of all the return codes that could be returned by this PipelineProcessor.
  • Configure Pipeline Manager.
  • Register Pipeline Manager in /atg/registry/PipelineRegistry. 
Pipeline Manager Component :

#definitionFile points to XML file that defines processor chain.

#chainLockWaitTimeout is the amount of time processor will wait. default value is 15000ms


<?xml version="1.0"?>

<!DOCTYPE PipelineManager SYSTEM "PipelineManager.dtd">

    <pipelinechain name="MyPipelineChain" transaction="TX_REQUIRED" headlink="proc1">
        <pipelinelink name="proc1">
              <processor class="atg.commerce.addA"/>
              <transition returnvalue="1" link="proc2"/>
        <pipelinelink name="proc2" transaction="TX_REQUIRES_NEW">
              <processor class="atg.commerce.addB"/>       



 <pipeline-manager-registry xml-combine="append-without-matching">