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.
In the above given example, processor two is executed if the return value from processor one is two.
ATG pipeline framework static 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.
Calling commerce pipeline from a form handlers
Steps to inject a processor link to commerce pipeline
1.Write your processor class. Custom Processor class should be an implementation of PipelineProcessor.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
package com.ourownjava.atg.pipeline; /** * @author ourownjava.com */ import atg.nucleus.logging.ApplicationLoggingImpl; import atg.service.pipeline.PipelineProcessor; public class ProcCheckInventory extends ApplicationLoggingImpl implements PipelineProcessor { public int[] getRetCodes() { return new int{1,2}; } public int runProcess(final Object pParam, final PipelineResult pResult) throws Exception { // check inventory and return the status accordingly return 1; } } |
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.
3.Register the new processor class as a nucleus component.
1 2 3 4 |
#ProcCheckInventory.properties #/info/atgblog/inventory/processor/ProcCheckInventory $class=/info/atgblog/inventory/processor/ProcCheckInventory $scope=glboal |
4.Update the B2CCommerce/config/atg/commerce/commercepipeline.xml to add new processor class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<pipelinechain name="updateOrder" transaction="TX_REQUIRED" headlink="updateOrderObject"> <pipelinelink name="updateOrderObject" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/order/processor/SaveOrderObject"/> <transition returnvalue="1" link="checkInventoryObject"/> </pipelinelink> <pipelinelink name="checkInventoryObject" transaction="TX_MANDATORY"> <processor jndi="/info/atgblog/inventory/processor/ProcCheckInventory"/> <transition returnvalue="1" link="updateCommerceItemObjects"/> </pipelinelink> <pipelinelink name="updateCommerceItemObjects" transaction="TX_MANDATORY"> <processor jndi="/atg/commerce/order/processor/SaveCommerceItemObjects"/> <transition returnvalue="1" link="updateShippingGroupObjects"/> </pipelinelink> ........... </pipelinechain> |
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.
https://loomisgreene.com bankruptcy attorney Loveland: the 10 best bankruptcy. Difference between granite and quartz countertopscolumbia.com.
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
how to invoke it through formhandle