What Are Order Processing Pipelines?
Imagine a company department charged with processing a large volume of daily orders. To deal with the volume, the department might divide order processing into a series of steps, assigning one person to calculate shipping, another to ensure that the items ordered are in inventory, and another to check prices.
For such an assembly-line approach to work, some level of coordination is essential among the people charged with order-related tasks. Thus, while dividing order processing into stages to make large-volume processing possible, this hypothetical processing department must also define the rules that coordinate the various tasks.
The Order Processing pipelines (OPPs) work in much the same way as this hypothetical department. The Order Processing pipelines divide order processing into stages that describe categories of work. Thus, a typical OPP might include a Shopper Information stage, a Payment stage, and a Shipping stage.
Each stage in a pipeline consists of zero or more components. The components are run in sequence. A component is a Component Object Model (COM) object designed to perform some operation on a dictionary -- a collection of name/value pairs -- that is a different representation of a runtime object. This can be a dictionary that represents an OrderForm object or a dictionary that represents another type of object. In many cases, this operation is small. For example, the DefaultShippingCy component, which runs in the Shipping stage, ensures that another component has not already calculated the shipping cost. If this cost has already been set, the DefaultShippingCy component overwrites the value with zero (0) to ensure that components later in the Shipping stage begin with a reliable value.
The OPP further coordinates the work of components by ensuring that every component in an OPP is reading from and writing to the same dictionary.
Although the Web site acts on objects, the pipeline components process dictionaries. Dictionaries are the link between the Web site and the pipeline. The OrderForm dictionary contains all the necessary information to process a purchase, including user, shipping, tax, and item price information. The dictionary and its runtime representation as an object are always kept in sync. For example, if a pipeline component adds information to a dictionary that represents an order, that new information is also added to the corresponding OrderForm object in the runtime. After each component in the OPP performs its work on the dictionary, the OPP passes the dictionary to the next component in the pipeline.
The designer of the pipelines for your site needs to take measures to ensure that the OPP functions correctly. First, configure the pipeline components so that they do not overwrite the work done by other components. (Components such as the DefaultShippingCy component are exceptions to this rule.) Second, define the conditions under which the OPP will stop processing. As each component runs, it returns a status value indicating success, a warning, or failure. If you configure a stage to tolerate warnings, the OPP continues to operate despite warnings. If you configure a stage to tolerate only success, and the component returns a warning, then the OPP stops processing and returns an error. The pipeline components do not retry the transaction. When the OPP stops processing, the pipeline process fails and the order is not processed.