A note about Sitecore pipelines

My two previous posts both contained implementations  of custom processors for the httpRequestBegin pipeline.

Just a quick explanation about their structure and some absolute best practices when implementing your own Sitecore pipeline processors.

Check and exit fast

Since the httpRequestBegin pipeline handles all requests it is extremely important to check the context for validity before continuing processing. If a simple check fails then exit the processor right away.

Example

This rule applies for all pipeline processors, if the context is not valid for the operation exit immediately and let the rest of the pipeline continue on.

Make least expensive checks first

One check might be more expensive than the others and to prevent it from being unnecessary executed in a context where the pipeline processor should not run anyway, always perform the least expensive checks first.

Example

String comparison is cheaper than reading database values. The above example check is a very typical example checking if the current site context is the shell site.

That was it for this post.

Anders Laub

Anders Laub Christoffersen

Anders has been working with Sitecore for over a decade and has in this time been the lead developer and architect on several large scale enterprise solutions all around the world. Anders has been nominated a Sitecore Technical MVP three years in a row for 2014, 2015 and 2016. Anders is now working as a Sr. Solutions Architect at Sitecore in Copenhagen.

One thought on “A note about Sitecore pipelines

Leave a Reply

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

*
*
Website