Navigation Menu

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.
                   dispatcherServiceMap=\
                         /exittracking=ExitTracking,\
                         /cgi-bin=CgiServlet

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 :
$class=atg.commerce.PipelineManager

#definitionFile points to XML file that defines processor chain.
definitionFile=/atg/commerce/MyPipelineManager.xml

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

MyPipelineManager.xml

<?xml version="1.0"?>


<!DOCTYPE PipelineManager SYSTEM "PipelineManager.dtd">

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

PipelineRegistry

<pipeline-registry-configuration>

 <pipeline-manager-registry xml-combine="append-without-matching">
  <pipeline-manager>
      <nucleus-path>/atg/commerce/MyPipelineManager</nucleus-path>
  </pipeline-manager>
  </pipeline-manager-registry>

</pipeline-registry-configuration>