3 Replies Latest reply: Oct 12, 2012 4:10 AM by RMishra RSS

    Pipeline Chain

    966835
      What is pipeline chain and what is the advantages of using pipeline chain and when it will calll actually tell me with example
        • 1. Re: Pipeline Chain
          Gurvinder
          Pipeline chain is a set of modular code execution, where in each module does discrete independent operation and passes the control on to the next module or processor.

          So if you talk about commerce pipeline, it consists of a number of processors that do some logic and after successfully completing the logic passes the control to the next processor.

          So the request flows through the pipeline via processors defined in it.

          http://docs.oracle.com/cd/E23095_01/Platform.93/ATGCommProgGuide/html/s1201processorchainsandthepipelineman01.html
          • 2. Re: Pipeline Chain
            RMishra
            One of the most important tasks for an ATG server is handling HTTP requests. The ATG server extends the basic web server model with various Nucleus services that implement the Servlet interface, and which are linked in order to process HTTP requests. Each servlet performs a specialized function on a request, then relays the request—sometimes in modified form—to the next servlet in the chain. While each servlet performs a unique service, it often relies on changes that previous servlets made to the request. This chain of servlets is called a request handling pipeline.

            To use ATG platform functionality, a web application needs to start Nucleus by invoking NucleusServlet. This servlet does not need to have any paths mapped to it, but must have the loadon-startup flag set to 1 so that it runs before any other ATG component. The web.xml file in atg_bootstrap.war includes the following lines:
            <servlet>
            <servlet-name>NucleusServlet</servlet-name>
            <servlet-class>atg.nucleus.servlet.NucleusServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            </servlet>
            The NucleusServlet creates an instance of Nucleus and sets it as an attribute of the web application.

            After invoking NucleusServlet, the web container calls PageFilter filter, which starts execution of the request-handling pipeline for JSP requests by calling the pipeline’s first servlet, */atg/dynamo/servlet/dafpipeline/DynamoHandler* of class atg.servlet.pipeline.HeadPipelineServlet. This servlet generates a DynamoHTTPServletRequest that wraps the generic HTTPServletRequest so pipeline servlets can read information from the request and also modify it. A matching DynamoHTTPServletResponse is also generated. DynamoHandler passes the Dynamo request/response pair to the next servlet in the request handling pipeline.
            Its code is like. For example:
            <filter>
            <filter-name>PageFilter</filter-name>
            <filter-class>atg.filter.dspjsp.PageFilter</filter-class>
            </filter>
            <filter-mapping>
            <filter-name>PageFilter</filter-name>
            <url-pattern>*.jsp</url-pattern>
            </filter-mapping>

            Similarly when we call handleSetOrder() method to recalculate then updateOrder pipeline chain executed, which is part of commerce pipeline chains. For more detail you can refer to http://docs.oracle.com/cd/E23095_01/Platform.93/ATGCommProgGuide/html/s1209commerceprocessorchains01.html
            Basically pipeline chain is a set of processors, each processor is a servlet class. If any processor gives error then Nucleus will not proceeds other processors in pipeline chain.
            -RMishra
            • 3. Re: Pipeline Chain
              RMishra
              Example:
              When we use CartModifierFormHandler.handleAddItemToOrder() method, then handleAddItemToOrder will call CartModifierFormHandler.addItemToOrder. CartModifierFormHandler.addItemToOrder calls CartModifierFormHandler.doAddItemsToOrder. CartModifierFormHandler.doAddItemsToOrder calls PurchaseProcessHelper.addItemsToOrder. PurchaseProcessHelper.addItemsToOrder calls PurchaseProcessHelper.runProcessAddItemToOrder. PurchaseProcessHelper.runProcessAddItemToOrder calls PurchaseProcessHelper.runProcess. PurchaseProcessHelper.runProcess will finally call PipelineManager.runProcess method and this method call updateOrder pipeline chain.
              RMishra