7

Or is it like the difference between hooks and processors? (where a hook is executed by a specific processor)

Or are processors used for non-visual/http process and are instead used for things like commands or background actions?

For clarity, both <pipelines> and <processors> are composed of sub-elements.

Pipelines

<sitecore>
  <pipelines>
    <httpRequestBegin> <!-- pipeline name -->
      <processor type="class, assembly" /> <!-- 1 or more sub-elements -->

Processors

<sitecore>
  <processors>
    <uiAddFromTemplate> <!-- processor name -->
      <processor type="class, assembly" /> <!-- 1 or more sub-elements -->

Is there any real difference between them?

5

From Sitecore documentation:

Pipelines define a sequence of processors that implement a function, such as defining the Sitecore context for an HTTP request or generating a list of messages in the Content Editor. Pipelines assist with encapsulation, flexible configuration, separation of concerns, testability and other objectives.

Each processor in a pipeline contains a method named Process() that accepts a single argument and returns void. A processor can abort the pipeline, preventing Sitecore from invoking subsequent processors.

The argument that is passed to the Process() method must be of a type that is specific to the pipeline or be the default argument —Sitecore.Pipelines.PipelineArgs. To create a pipeline processor, create a class that implements a method named Process() with the same signature as the other processors in the pipeline. This processor can inherit from an existing processor, and you can add, remove, replace, and rearrange processors in the pipelines to suit your requirements.

Read more in Sitecore Pipelines document. It's for Sitecore 6.5 but the concept is still the same.


EDIT

Both <processors> and <pipelines> nodes in Sitecore configuration are used for defining pipelines.

There are few differences I know about:

  1. Processors processors should have parameterless constructors
  2. When defining a processor inside <processors> node, you can specify method name different from Process, e.g.:
<processors>
  <uiAddFromTemplate>
    <processor mode="on" type="Sitecore.Shell.Framework.Pipelines.AddFromTemplate,Sitecore.Kernel" 
      method="GetTemplate" />
    <processor mode="on" type="Sitecore.Shell.Framework.Pipelines.AddFromTemplate,Sitecore.Kernel" 
      method="Execute" />
  </uiAddFromTemplate>
</processors>
  1. When defining <pipelines> pipeline, you can group pipelines (see second <pipelines> tag inside the group), e.g.:
<pipelines>
  <group name="itemProvider" groupName="itemProvider">
    <pipelines>
      <addFromTemplate help="Processors should derive from Sitecore.Pipelines.ItemProvider.AddFromTemplate.AddFromTemplateProcessor.">
      </addFromTemplate>
    </pipelines>
  </group>
</pipelines>

In background Sitecore uses different methods for creation of the pipelines defined in <processors> and in <pipelines> config nodes.

It looks like <processors> are mostly used for UI related stuff.

I would recommend to use always <pipelines> if you want to build any custom funcionality for consistency and transparency.

|improve this answer|||||
  • Whats the difference between <processors> and <pipelines> is what I'm getting at. They are BOTH composed of processors. – Adam Hess Aug 6 '19 at 16:32
  • @AdamHess sorry, I misunderstood your question. Answer updated. – Marek Musielak Aug 6 '19 at 17:04
  • thanks for the response. The terminology can get a bit confusing as the semantic saturation of the word "processor" can muddy the two up. – Adam Hess Aug 6 '19 at 17:39
  • I do agree with you – Marek Musielak Aug 6 '19 at 17:45
4

As has been pointed out in other answers, <processors> are used primarily for UI-related activities. They must be executed via Sitecore.Pipelines.PipelineFactory and Sitecore.Pipelines.Pipeline instead of Sitecore.Pipelines.CorePipeline.

Functionally, the main difference appears to be that these UI pipelines have the ability to suspend while waiting for user input, and resume on Sheer UI postback. The Pipeline class has an ID property which is used for storing it in session. Thus the Pipeline itself and its args need to be [Serializable]. You can see some of this suspend/resume logic in Sitecore.Web.UI.Sheer.ClientPage.

Practically, unless you are doing Sheer UI customization, you should stick with use of <pipelines> / CorePipeline.

|improve this answer|||||
  • the uiUpload processor does not work with sheer ui components at all. I've been fighting to get it to render anything and the best solution thus far is to get javascript to trigger an "alert()" – Adam Hess Aug 6 '19 at 18:54
  • Yes it looks like that one is used within a SPEAK dialog? Possibly for similar reasons, possibly because the dialog used to be Sheer? ¯\_(ツ)_/¯ ... if you have a specific issue with that pipeline might be worth posting a separate Q. – techphoria414 Aug 6 '19 at 18:58
  • Its come up in other places, the uiUpload process doesn't work with speak/sheer. – Adam Hess Aug 6 '19 at 19:08
4

Sitecore separates the pipelines into two groups:
1. Those defined within the /configuration/sitecore/pipelines- [These pipelines tend to define system processes.]

Examples: <initialize>:Initializes the Sitecore application.
<preprocessRequest>: This is invoked for each HTTP request managed by ASP.NET. It is more common to use the pipeline for request processing logic.

2. Those defined within the /configuration/sitecore/processors – [define pipelines that operate for sitecore client UI requests and can interact with the sitecore logged in user]

Examples:

<uiAddFromTemplate>: Add an item based on a data template, branch template or command template.
<uiCopyItems>: Copy an item and its descendants.
<uiCloneItems>: Clone an item and its descendants.
<uiDeleteItems>: Delete an item and its descendants.
<loggingin>: When logging in.
<loggedin>: After login. : Implements logout.
<saveUI>: When a CMS user saves an item. : Upload a media item.

If you see Sitecore.config Processors classes must have parameterless constructor.

<!-- PROCESSORS
         Classes must have parameterless constructor.
         Supported attributes:
           mode=[on|off]
           type=name of class (case-sensitive).
           namespace=namespace containing class. If no namespace is included, it is assumed that the namespace is the same as the assembly name.
           assembly=name of dll containing the class (case-sensitive)
    -->
  <processors>
   <dispatch>
      <!-- This pipeline has been deprecated - try using the CommandManager object instead -->
    </dispatch>
|improve this answer|||||
-1

In few words :

Processors provide the logic that is used when a pipeline is invoked.

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.

More informations you can find here:

https://sitecorespark.com/article/introduction-to-pipelines

http://www.coreworks.co/sitecore-pipelines-overview

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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