# Content Diffuser

The Content Diffuser is primarily responsible for figuring out what Content needs to be sync between the Source and all Destinations.

**Responsibility 1:**\
Receives the **Local Ids** from the Source and Destinations, the Local Ids are sent to the Diffuser individually as kafka messages, meaning, a message per content.

When all the contents (Local Ids) are delivered for the Source and Destinations endpoints to the Content Diffuser, a comparison process starts to identify what contents need to be sync.

**Responsibility 2:** To check Contents and Dependencies if the element already have **Motations**, without a **Motation** it is not possible to deliver a content to the Destination.

If Impulse doesn’t have **Motations** for any of the Contents or Dependencies, it means this is the first time we are analyzing this content, Impulse publishes a message for each missing **Motation** to the pickup taxi so get the Raw Data and Transform it into a **Motation** file.\
Motations are stored in Diesel.

**Responsibility 3:** When the comparison process identifies a content has to be sync to a Destination endpoint, the Content Diffuser request the related content Dependencies and System objects.

**Responsibility 4:** Delivers to the Destination endpoint the **Motation Objects** related to the content to be sync, for this delivery process Impulse publishes a kafka message with the **Motation Objects** to deliver to the **Dropoff taxi**, the **Dropoff taxi** requests to the **Transformer out** to transform the given **Motation Objects** to Raw Data to finally deliver those Raw Data files to the Destination to sync those **Motation Objects**.

**Responsibility 5:** Delivers to the Destination endpoint the **Content Dependencies** related to the content to be sync, for this delivery process Impulse publishes a kafka message with the **Content Dependencies** to deliver to the **Dropoff taxi**, the **Dropoff taxi** requests to the **Transformer out** to transform the given **Content Dependencies** to Raw Data to finally deliver those Raw Data files to the Destination to sync those contents.

**Responsibility 6:** Delivers to the Destination endpoint the **System Objects** related to the content to be sync, for this delivery process Impulse publishes a kafka message with the **System Objects** to deliver to the **Dropoff taxi**, then as **System Objects** are always in Raw Data format the **Dropoff taxi** delivers directly those Raw Data files to the Destination to sync those elements.

**Responsibility 7:** Delivers to the Destination endpoint the main Content to be sync, for this delivery process Impulse publishes a kafka message with the **Content** to deliver to the **Dropoff taxi**, the **Dropoff taxi** requests to the **Transformer out** to transform the given **Content** to Raw Data to finally deliver the resulting Raw Data file to the Destination to sync the Content.

**Responsibility 8:** After the content is successfully synced, the Content Diffuser publishes a couple of kafka messages to **Kal-el** with the Source content **Motation** and the Destination Content **Motation** to allow the **Diffinator** service in a later process to generate Diff reports for the transaction and the synced contents.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://motivlabs.gitbook.io/impulse-dev-manual/services/content-diffuser.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
