In the Sitecore configuration, I see a lot of different nodes under the <pipelines> element. I have been through the Sitecore Certification course and don't recall us covering these in detail?

What is a pipeline?

Specifically:

  • What is a pipeline and how do I use one?
  • What are the elements of a pipeline that I need in order to create a pipeline?
  • 2
    Historical side-note: Pipelines are an implementation of the original GoF Chain-of-Responsibility pattern, whereby a data object (command) is separated from the methods that act upon it (handlers or processors). This is an elegant mechanism for facilitating extensible and/or customisable processing in a system. It's my favourite thing about Sitecore. :P – Richard Hauer Oct 27 '16 at 13:04
  • 2
    Mine too, secretly. don't tell anyone. =) – Pete Navarra Oct 27 '16 at 13:25
up vote 4 down vote accepted

Pipelines are defined in config. Sitecore's pipelines exist under:

<sitecore>
   <configuration>
      <pipelines> 

Within a pipeline, handlers are processed in the order they are defined in config, the order and position of a handler is relevant.

Here is a list of available pipelines

The <httpRequest> pipeline is perhaps one of the most common to modify. Several of the steps there build the context information (item, site, language etc) that are then available under Sitecore.Context

Usage of a pipeline involves inserting a handler at an appropriate point in the chain of handlers defined in config. A pipeline handler typically inherits a base class for that pipeline, overrides a method, and interacts with the pipeline args or other classes. In the case of the httprequest pipeline a processor would inherit from the abstract class HttpRequestProcessor and override the method public override void Process(HttpRequestArgs args)

For example if you wanted to store the original request url before any possible modification by the LanguageResolver pipeline step, you could add the following, which stores the url in the Context.Items[] dictionary. Within config this handler would be added before LanguageResolver.

public override void Process(HttpRequestArgs args)
{
    args.Context.Items["OriginalRequestUrl"] = args.Context.Request.RawUrl;
    return;
}

It is also possible to build your own entire pipeline using the same framework for your own purposes, this is well described by Anders Laub in this blog post.

You can also view active pipelines via the special admin page /sitecore/admin/pipelines.aspx

  • 1
    Can you add into your answer how pipeline arguments come into play? – Pete Navarra Oct 28 '16 at 5:31
  • Sure @PeteNavarra – Paul George Oct 28 '16 at 6:37

You can read about Pipelines on the Sitecore community docs website: http://sitecore-community.github.io/docs/pipelines-and-events/pipelines/

Pipelines are one of Sitecore’s essential integration concepts. They are used to extend existing functionality, and to allow custom functionality to be extended in the future. They also provide a level of documentation and transparency by virtue of how they are configured.

A pipeline is basically a method whose flow is defined using XML.

A pipeline consists of a sequence of processors. A processor is a .NET class that implements a method. When a pipeline is invoked, the processors are run in order.

Pipelines are used to control most of Sitecore’s functionality. Processes ranging from authentication to request handling to publishing to indexing are all controlled through pipelines.

Pipelines are defined in Sitecore.config and in Sitecore patch files.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.