StorePick HFSS Adapter Lambda

Overview

Lambda poll events from Range SQS and Product SQS.

Once messages arrived in SQS then this lambda will get trigger.

Read SQS messages, and call product V1 elastic search POST API /product/v1/items/@search

to get details in bulk where we can pass list of item ids in request body

to get productComplianceInfo.hfssInScope, productComplianceInfo.hfssLessHealthy,productComplianceInfo.foodDrink to calculate restricted value and productComplianceInfo.hfssCategory

to send to Ocean and status to check whether product is active or not.

Process only range/CREATE, product/CREATE, product/UPDATE and hfss/UPDATE  eventEntity/eventType records else ignore others.

All MINS will be checked in the Payload Dedup DB to reduce the duplicate data being sent to Ocado HFSS API.

This lambda will send all received events to HFSS OSP PUT API /v1/products/hfss.

Also, these events will be written in the Payload Dedup DB with an Expiration Time based from the setting of OCADO_PUT_PAYLOAD_DEDUP_EXPIRY_TIME in the Config Service.

Insert or Update record in BigQuery Table on the bases of BQ_SINK_ENABLED field mentioned in storepick-hfss-products.json config file.

For any exception send received SQS message to DLQ.

Account Needed

AWS accounts will be required for DEV/SIT/PROD.

References

  1. Python Service with infrastructure as code.

  2. Unit tests & code coverage at about 90%+

  3. Configuration for multiple environments, DEV/SIT/PRD

Document

Ref

Architecture Document

Solution Architecture.

Jira Story

Technical Elaboration - SPDP-7787.

Bitbucket repository

storepick-hfss-adapter-lambda.

Testing Approach

We will be using a BDD approach where the behaviour will be tested first the code will be developed to match the tested behaviour.

Deployment strategy

The deployment is handled by a jenkins pipeline, https://jenkins.p.morconnect.com/digital/job/storepick-hfss-adapter-lambda/.

The commit in the develop branch will automatically deploy the application to the aws environments.

The release is done by standard process of tagging the release branch, and by building and deploying

from the tags. The tag format is sit-v*-<commit> for nonprod and prd-v*-<commit> for the production

release. These tags are manually built on jenkins after the change request has been approved. The

release branch is merged to the stable master branch after the successful production deployment.

Diagrams

HFSS Adapter Lambda work flow diagram

_images/diagram.png

A slightly more detailed view of the lambda.

_images/diagram2.png