Magento Implementation
2 min
When we trigger a sync from Magento, whether via cron or CLI, Klevu\Indexing\Service\EntitySyncOrchestratorService::execute is executed.
This loops through all entityIndexerServices.
These entityIndexerServices are injected via di.xml from each entity indexing module (module-m2-indexing-categories, module-m2-indexing-cms, module-ms-indexing-products).
e.g. from module-ms-indexing-products/etc/di.xml
<type name="Klevu\Indexing\Service\EntitySyncOrchestratorService">
<arguments>
<argument name="entityIndexerServices" xsi:type="array">
<item name="KLEVU_PRODUCT" xsi:type="array">
<item name="add"
xsi:type="object">Klevu\IndexingProducts\Service\EntityIndexerService\Add</item>
...
</item>
</argument>
</arguments>
</type> The injected EntityIndexerService is a virtual type, into which we pass an EntityIndexingRecordProvider and a pipeline YAML file.
<virtualType name="Klevu\IndexingProducts\Service\EntityIndexerService\Add"
type="Klevu\IndexingProducts\Service\EntityIndexerService">
<arguments>
<argument name="entityIndexingRecordProvider"
xsi:type="object">Klevu\IndexingProducts\Service\Provider\Sync\EntityIndexingRecordProvider\Add</argument>
<argument name="pipelineConfigurationFilepath"
xsi:type="string">Klevu_IndexingProducts::etc/pipeline/add_update.yml</argument>
</arguments>
</virtualType> The EntityIndexingRecordProvider will provide the records to index. The pipelineConfigurationFilepath contains the default yaml file containing instructions on how to process those records.