#Sitecore’s Data Exchange Framework Reddit Style Part 4

In part 1 you saw what Sitecore items were created to for the data exchange process. In part 2 you saw how the backend was connected and the classes defined in the Converters section. In part 3 you saw how the item models are used. In this part I wanted to talk about the pipeline step processor. The method that brings it all together. You can find the source code here for reference.

This is a snapshot of each folder that was created and the corresponding class file. You can see there is a Processors\PipelineSteps folder that contains the process class.

RedditItemsProcessor.cs

In Sitecore under Pipelines\Reddit Pipeline\Reddit Pipeline Step you will see under Processor Type the RedditItemsProcessor defined.

Below is the code for the processor. You will see that the Required EndpointPlugin is defined for RedditSettings. Endpoint, PipelineStep and PipelineContext should all have values at this point. As you will notice the pipelineContext.PipelineBatchContext.Logger.Info is used to set up any custom logging. This will be outputted in the batch window when the processor runs. See example below.

If you look at the method RedditFeed. What that does is create a new Reddit class using RedditSharp. It then uses the blogpath setting from the endpoint to retrieve the blog feed. The redditfeedresults gets set to a collection of Reddit blogs. From there that collection is passed to the DEF which will use everything we setup to map and process each of the records. It will use fieldnames we defined earlier to match the Reddit feed fields to the fields defined for the new Reddit Sitecore item.

Outputted to the batch window:

Hopefully now you are getting the big picture on how all this stuff pieces together. In part 5 I will get into the part of running the DEF process and different options you can do. Let me know if you have any questions.

Leave a comment