Order Service
Requirements
- Orders completed should be sent to Narvar.
- Retries need to be performed if there is an error calling Narvar.
Proposal
Use the existing Hybris Api Gateway to create a new endpoint to receive order events.
The new endpoint will transform Hybris order data to the Rapha common order schema. The data following the common schema will be sent to the corresponding Eventbridge bus.
A new Narvar queue for orders will be created and subscribed to the new events.
A new lambda will be created to process the new queues and send the messages to Narvar.
Integration diagram

Components
Hybris API Gateway
Endpoint: POST /order
Request data is sent to hybris-order-transform lambda.
Hybris Api Gateway Gitlab project
Hybris Order transform lambda
Hybris Order transform lambda will transform Hybris order data into an object following our Common Order schema order.json and then validates it.
If the request data not match the schema, it will throw an error.
If the request is valid, it will publish an event with DetailType: OrderEvent on Transaction event bus.
Hybris Order Lambda Gitlab project
Eventbridge
Hybris Order events will be sent to Transaction event bus with DetailType: OrderEvent where they will be redirect to Narvar Order SQS.
Common Event Layer Gitlab project (Event rules)
Narvar Event Layer Gitlab project (Event targets)
Narvar Order SQS
Narvar Order SQS is in charge of process those order events that need to be sent to Narvar, currently: OrderEvent events.
Narvar Order SQS Deadletter
Contains the messages that had failed when being processed by Narvar Order process lambda.
Narvar Order Secondary SQS Deadletter
Narvar Order Secondary SQS Deadletter contains the messages that have failed after retrying them. The messages in this queue will need manual intervention, they are not automatically processed. One possibility to do this is using the redrive option available in AWS console where it is possible resend the messages in the deadletter queue to another queue.
Narvar Order SQS Gitlab project
Narvar Order process lambda
Narvar Order process lambda will process Narvar Order SQS messages. It transforms the order common data into an object following Narvar Order schema order_info.json and then validates it.
If the data not match the schema, the error is logged and the message is returned as successful to avoid it to be retried. In the case of validation errors, manual intervention is needed to fix wrong data.
If the data is valid is sent to Narvar Order API.
If the process fails, the message is sent to Narvar Order SQS Deadletter.
Narvar Order replay lambda
This lambda process Narvar Order SQS Deadletter messages and send them back into Narvar Order SQS if the amount of max retries is not reached. When a message reach the amount of max retries it is sent to Narvar Order Secondary SQS Deadletter.
Narvar Order Lambda Gitlab project