---
title: "CMP pipelines"
slug: "cmp-pipelines"
abstract: "Learn more about the CMP pipelines and their processors."
---
# CMP pipelines

The Sitecore Content Marketing Platform (CMP) connector adds one new processor to the `<initialize>` pipeline, and one new `<cmp.importEntity>` pipeline, including three new processors. The pipelines are defined in the `App_Config/Modules/Sitecore.Connector.CMP/Sitecore.Connector.CMP.config` file.

<details>
<summary><h2>The initialize pipeline</h2></summary>

The `<initialize>` pipeline is used to initialize the Azure Service Bus listener. For CMP, the following processor is added:

- Processor: Description
- `InitializeServiceBus`: Initializes the Azure Service Bus listener that runs the <cmp.importEntity> pipeline when a new message appears in the topic’s subscription.The InitializeServiceBus processor does the following:Gets the config item, reads the connection information, and initializes a topic client and a subscription client.If a message is triggered, the ProcessMessagesAsync action is run:It runs the <cmp.importEntity> pipeline.Then, it checks the ImportEntityPipelineArgs pipeline and sends a message back to the Bus. For example:Writes to the log file. For example:

```csharp
{

"input_message_id": "1174",

"item_id": "{D071EDAF-55A4-4CB0-9ED3-6AAB6288ECA5}",

"target_id": 10436,

"target_identifier": "Iqa356VYWEe-PsBiEcAgPg"

"inputMessageId": "2446", "itemId": "{CD41DE03-1169-493C-A138-B7DD4722EBB8}" }

```
```csharp
17580 `11:48`:16 INFO  Sitecore Connect for Sitecore CMP: Sending a message: {
  "input_message_id": "1174",
  "item_id": "{D071EDAF-55A4-4CB0-9ED3-6AAB6288ECA5}",
  "target_id": 10436,
  "target_identifier": "Iqa356VYWEe-PsBiEcAgPg"
}
24428 `14:49`:58 INFO Sitecore Connect for Sitecore CMP: Sending a message: { "inputMessageId": "2446", "itemId": "{CD41DE03-1169-493C-A138-B7DD4722EBB8}"
}

```

</details>

<details>
<summary><h2>The cmp.importEntity pipeline</h2></summary>

The `<cmp.importEntity>` pipeline is used to import entities. It includes the following processors:

| Processor | Description |
| --- | --- |
| `FetchEntity` | Gets an entity by ID.<br><br>The `FetchEntity` processor does the following:<br><br><ol><li>Creates the Content Hub client and gets the entity by ID (the target_id in the bus message) and puts it in the args to make it available to the next processors.</li><li>Checks for the `ContentToContentLocalization` relation. If there is a parent entity, its identifier will be used, otherwise, the current entity’s identifier will be added to the args.</li><li>Checks for the `LocalizationToContent` relation. If there is a parent entity, the processor will try to parse the parent’s `ValueName` property to a language. If there is no parent, the default language will be used. The language will be added to args to be available for the next processors. An exception is thrown if the processor fails to parse the language. If there is no `LocalizationToContent` parent, the exception will not be thrown.</li><li>Checks for the `ContentTypeToContent` parent and puts its identifier to the args.</li></ol> |
| `EnsureItem` | Gets the entity mapping item and finds the `EntityIdentifier` field.<br><br>The `EnsureItem` processor does the following:<br><br><ol><li>Enumerates the children of the config item to find the entity mapping item that matches the content type identifier from the args.</li><li>If the entity mapping item is found, it gets the corresponding item bucket item (it is configured in the entity mapping item).</li><li>Tries to find an item that contains the `EntityIdentifier` field (Content Hub template)) equal to the `EntityIdentifier` in the args (it could be either the current M-entity identifier or its `ContentToContentLocalization` parent’s identifier). If there is already an item with such an `EntityIdentifier`, the processor gets it (a language version based on the `args.Language`) and put it into the args. If there is no such item, the processor creates it with a version in a given language (`args.Language`) and puts the item in the args.</li></ol> |
| `SaveItem` | Saves the item to Sitecore.<br><br>The `SaveItem` processor does the following:<br><br><ol><li>In a given language context (`args.Language`), it goes through field mapping items of the entity mapping item, and for each field mapping it gets a property value from the Content Hub entity and sets the value to the Sitecore item.</li><li>Sets the publish date on a current version (if the date is not null).</li></ol> |

</details>