Skip to content

Create delivery-data-to-sf #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions design-documents/storefront/delivery-data-to-sf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
The goal of this document is to describe how to deliver data from the Magento Monolith to the StoreFront service.

The desired state is to have Storage(s) on the SF side which should have all needed data to perform data for requested fields. (see https://github.com/magento/architecture/blob/master/design-documents/graph-ql/storefront-api.md)

We will use Catalog SF as an example.

1. How can data be added to the Storage?

Storage (in the first iteration - just an MySQL table/mongodb db) will be fullfilled by Data Providers that can fetch information by "entity_id" and "scope_id"
Data Providers will "live" on monolith side, so they can use Service Contracts to fetch the data

2. Who is repsonsible for "fullfill" storage?
Let's name it "Indexer" for now. Indexer is responsible to call Data Providers and put data to Storage.

3. How can "Indexer" know that need to add data to Storage.

There are 2 approaches to do it.
3.1. Queue framework.
Add message to queue {"products_ids": [...], "scopes", "attributes": []}

Pors.
- Easier to decouple from monolith in future (in case we stop using Service Contracts in Data Providers)
- Message already contains all needed information to call Data Proivider (entity_id/scopes)

Cons.
- Need to mannualy take care about adding message to the Queue
-- create plugins/event listeners
-- "parse" default scope to several scopes (E.g. Save product in "Default" scope)
Cons. Quedstions
-- How to handler events, that not passed from "product_model_save"? E.g. product import, catalog rule,...
-- Price for composite product. How to update configuralbe price after simple price changed?


3.2. MView mechanism
We can create intermediate Magento Indexer and add listeners to all tables, that we want to take care

Pors.
- Easier to implement

Cons.
- Message do not contains scopes. Need to call DataProviders with all scopes in system (just store?)
- How to handler "create new store"


4. Open questions
How to display price? (configuration issue)
- we have configuiration "include tax"/"exclude tax"
Init storage.
Do we need full reindex for specific cases?

How Storage schema should looks like?
E.g. For Catalog service. How can we handle staging ?
... TBD

![Storage filling diagram](https://github.com/magento-performance/architecture/blob/master/design-documents/storefront/storefront-api/fill-sf-storage.png?raw=true)