EventHub-triggered Azure Function for Reliable Data Sync
⚡ This Azure Function listens to OrderCloud events via EventHub and syncs product data to Sitecore Search for fast, scalable, and production-ready indexing.
This project hosts SearchSync as an Azure Function with an EventHub trigger, designed for:
| Capability | Description |
|---|---|
| 🔁 Syncing | Pushes product data from OrderCloud to Sitecore Search |
| ⚡ Scalable | Handles high-volume events reliably |
| 🛠️ Extensible | Add custom mappings for XP and other properties |
✅ Recommended for production environments as it offers greater reliability and scalability than the HTTP method.
Important: The provided code syncs only the minimum properties required by OrderCloud’s search proxy. Extend the mappers in SearchSync.Common/Mappers to include additional fields or XP as needed for your Sitecore Search configuration.
- Azure Subscription with:
- Azure Functions
- Azure Event Hub
- Azure Storage Account
- OrderCloud Marketplace
- Sitecore Search instance with Push API source
Create a local.settings.json at the project root:
⚠️ Do not commit secrets to source control.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"EventHubConnectionString": "",
"APPLICATIONINSIGHTS_CONNECTION_STRING": "",
"SearchSettings__IngestionEndpointUrl": "",
"SearchSettings__IngestionApiKey": "",
"SearchSettings__DomainID": "",
"SearchSettings__SourceID": "",
"SearchSettings__EntityProduct": "",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}
}| Key | Purpose | Where To Find | Example |
|---|---|---|---|
AzureWebJobsStorage |
Connection string for Azure Storage | Azure Portal → Storage Accounts → [Account] → Access Keys | DefaultEndpointsProtocol=https;AccountName=youraccount;AccountKey=***;EndpointSuffix=core.windows.net |
EventHubConnectionString |
Connection string for EventHub | Azure Portal → Event Hubs → [Namespace] → Shared Access Policies | Endpoint=sb://your-namespace.servicebus.windows.net/... |
APPLICATIONINSIGHTS_CONNECTION_STRING |
(Optional) App Insights connection string | Azure Portal → Application Insights → Overview | InstrumentationKey=xxxx;IngestionEndpoint=https://yourregion.applicationinsights.azure.com/ |
SearchSettings__DomainID |
Sitecore Search domain ID | CEC → Administration → Domain Settings | 111111111 |
SearchSettings__SourceID |
ID of Push API source | CEC → Sources → [Source] → Source Information | 1111111 |
SearchSettings__IngestionEndpointUrl |
Ingestion endpoint URL | CEC → Sources → [Source] → Endpoint URL | https://discover.sitecorecloud.io/ingestion/v1 |
SearchSettings__IngestionApiKey |
API key for ingestion | CEC → Sources → [Source] → API Key | 01-xxxxxxxx... |
SearchSettings__EntityProduct |
Name of product entity | CEC → Administration → Domain Settings → Entities | product |
FUNCTIONS_WORKER_RUNTIME |
Azure Functions runtime identifier | Not applicable | dotnet-isolated |
- Ensure
local.settings.jsonexists at the project root and includes the configuration shown above. - Run the project:
- IDE: Use Run / Debug in Visual Studio or VS Code
- Core Tools: From the project root, run:
func start
ℹ️ When using Azure Functions Core Tools, ensure
local.settings.jsonexists and is not excluded from your local environment.
To receive events from OrderCloud, configure Delivery Configurations and associate them with sync jobs:
POST /integrations/deliveryconfig
{
"ID": "sitecore-search-eventhub",
"Name": "Sitecore Search EventHub",
"Enabled": true,
"DeliveryTargets": {
"EventHub": {
"EventHubName": "YOUR_EVENTHUB_NAME",
"ConnectionString": "YOUR_CONNECTION_STRING"
}
}
}EventHubNamemust match the one in SearchSyncFunction.csConnectionStringmust include the Send claim
{
"SyncProductDeleted": true,
"SyncProductChanged": true,
"DeliveryConfigID": "sitecore-search-eventhub"
}This ensures product events are delivered to your EventHub for processing.