Syndicate
Bidirectional communication is crucial to keep Nacelle in sync with external data sources. As such, sending updates to Nacelle is just as important as syndicating data from Nacelle to your data sources. This process helps maintain the accuracy and consistency of data across both systems.
Just as with the ingestion process, syndication is facilitated by 'mappers' provided by the client. However, in this case, the mappers act as receivers, converting data from the Nacelle format into the format required by your specific systems. Given that each merchant might have unique customization needs, these mappers are essential to ensuring a seamless data flow.
Here's a deeper look into the syndication process:
Role of Mappers
The mappers for syndication act as intermediaries, translating the data structure from Nacelle to the format needed by your data sources, such as Fluent. Given the unique customizations of each merchant's backend, these mappers must be tailored to fit your specific requirements, ensuring data is accurately reflected in your systems.
Your team or your software vendor is responsible for developing these mappers. While Nacelle doesn't dictate the specific technology or language used to write these mappers, they should align with the Nacelle OpenAPI documentation and the specific needs of your data sources.
Mapper Implementation
-
Receiving the Data
Nacelle pushes the order data to your specified endpoint using a webhook. This data will be in the format defined by Nacelle. Upon receiving this data, your mapper should convert it into the format required by your data sources. -
Sending the Data
The mapper then sends the converted data to your data sources. Depending on your system's requirements, this could be done through various methods, such as API calls, database inserts, or message queues. -
Confirmation:
After successfully updating your data sources, the mapper should send an HTTP 200 OK response back to the Nacelle webhook. If there were any issues during the conversion or updating process, an appropriate error message and status code should be returned. -
Syncing the Data:
The mapper then sends the converted data from updates from the OMS to Nacelle. This can be done through aPATCH
request to the Nacelle update endpoint.
Fetching Data from Nacelle
Fetching data is done using the provided GraphQL endpoints. Nacelle provides separate endpoints for authenticated (admin) and unauthenticated (storefront) requests.
Authenticated Requests
For authenticated requests, you can use the Dashboard GraphQL endpoint. Here is an example of fetching orders using GraphQL:
query orders($filter: OrderItemFilter, $orderFilter: OrderFilter) {
orders(filter: $orderFilter) {
edges {
node {
id
status
modifiedAt
createdAt
items(filter: $filter) {
edges {
node {
id
status
quantity
sku
}
}
}
}
}
}
}
Unauthenticated Requests
For unauthenticated requests, you can use the Storefront GraphQL endpoint. Here is an example of fetching orders using GraphQL:
query {
order(id:"a9aebc7b-baa7-4ce1-8842-c514588c1525") {
status
id
}
}
Key Considerations
- Data Integrity:
Ensure your mappers accurately translate all necessary fields to maintain data integrity across systems. - Error Handling:
Your mappers should be robust and capable of handling any errors that may arise during the translation or updating process. It's recommended to log these errors for debugging and resolution. - Webhook Security:
Always validate the Nacelle webhook requests using the provided signatures to ensure they are genuinely originating from Nacelle. - Resiliency:
Implement mechanisms to handle cases where the OMS is down or unreachable. This could include retries, logging the failed attempts for manual processing, or using a message queue for asynchronous processing. - GraphQL Query Optimization:
Design your GraphQL queries to fetch only the necessary fields to optimize performance and minimize unnecessary data transfer.
By implementing these steps and considerations, you can ensure a seamless, secure, and efficient syndication process that keeps your Nacelle and OMS in sync, enhancing your overall order management workflow.
Updated about 1 year ago