Intercept an ATG pipeline.

ATG pipeline allows developers to write modular code and inject the same in an execution path based on the result from another processor in pipeline chain. Nucleus component /atg/commerce/PipelineManager implement the commerce pipeline loading, execution and reloading logic. Commerce pipeline is defined in an xml file located in /B2CCommerce/config/atg/commerce/commercepipeline.xml.

What is a pipeline?

Pipeline is a collection of processors which executes sequentially. You can decide the branch to execute based on a return value from a processor.

ATG Pipeline

In the above given example, processor two is executed if the return value from processor one is two.

ATG pipeline framework static design

ATG Pipeline Design

Initialize the commerce pipeline chain

PipeLine manager is responsible load the pipeline definition xml and initialize the pipeline chains. Below given sequence diagram will help you to understand the flow of execution.

ATG Pipeline Sequence Diagram

Calling commerce pipeline from a form handlers

ATG Pipeline Sequance Diagram

Steps to inject a processor link to commerce pipeline

1.Write your processor class. Custom Processor class should be an implementation of PipelineProcessor.

ATG Pipeline

2.Identify the correct location to inject the new processor class in pipeline chain.
In this example we will inject new processor class as the second processor in the updateOrder chain.
ATG Pipeline
3.Register the new processor class as a nucleus component.

4.Update the B2CCommerce/config/atg/commerce/commercepipeline.xml to add new processor class.

5.Restart your ATG application server. You are done. You have added pipeline link in the commerce pipeline. Alternatively commerce pipeline can be edited using acc pipeline editor.

3 thoughts on “Intercept an ATG pipeline.

  1. hi nice explanation for extending commerce pipeline. can you tell me how to create a a new pipeline chain and how to invoke it through formhandler.

    • Hi Raghu,

      Below I listed the steps needed to make your class as Pipeline Servlet.

      1. Create a Srvlet that extends PipelineInsertableImpl class.
      2. Define a properties file for this as global component.
      3. reset the previous servlet’s nextServlet property.
      4. set the new servlet’s nextServlet property.
      5. add this servlet entry to atg/dynamo/servlet/Initial.properties.

      Hope this helps.

      Regards
      Sachin

Leave a Reply to sachin Cancel reply

Your email address will not be published. Required fields are marked *