-
-
Save ticean/9548e2eb32d5e5e506a2a4e52ea2d1db to your computer and use it in GitHub Desktop.
sequence diagram for reaction inventory data flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title Inventory Data Flow | |
participant Kafka Topic | |
participant Shippable-Inventory-Plugin | |
participant Simple-Inventory-Plugin | |
participant Inventory | |
participant MongoDB SimpleInventory | |
participant MongoDB Products | |
participant MongoDB Orders | |
Kafka Topic -> Shippable-Inventory-Plugin: | |
note over Shippable-Inventory-Plugin: | |
Consumer calls bulk-write mutation. | |
This function is not defined in "Inventory" plugin | |
end note | |
Shippable-Inventory-Plugin -> Simple-Inventory-Plugin: updateSimpleInventoryBulk() | |
Simple-Inventory-Plugin -> MongoDB SimpleInventory: Bulk write to SimpleInventory collection | |
MongoDB SimpleInventory -> Simple-Inventory-Plugin: Returns result set | |
alt resulting inserts from batch operation | |
loop for Each inserted SimpleInventory Record | |
Simple-Inventory-Plugin -> MongoDB Orders: Reads count of new/processing Orders per sku | |
note right of Simple-Inventory-Plugin: | |
Calls recalculateReservedSimpleInventory function, which | |
calculates the reserved inventory based on number | |
of product variants that are in Orders marked as "new" or "processing". | |
This is saved in the SimpleInventory collection as `inventoryReserved` | |
end note | |
note right of Simple-Inventory-Plugin | |
Emits "afterInventoryUpdate" event | |
end note | |
end | |
else resulting updates from batch operation | |
note right of Simple-Inventory-Plugin: | |
Emits "afterBulkInventoryUpdate" event | |
This contains all update records from the batch | |
end note | |
Simple-Inventory-Plugin -> Inventory: handles afterBulkInventoryUpdate event | |
opt afterBulkInventoryUpdate() | |
note left of Inventory | |
Dedupe by productId to avoid | |
multiple updates on the same | |
top-level product | |
end note | |
loop for Each Product | |
Inventory -> Inventory: updateInventoryBooleansInCatalog() | |
Inventory -> MongoDB Products: Reads from Products collection. | |
Inventory -> MongoDB SimpleInventory: Reads from SimpleInventory collection. | |
Inventory -> MongoDB Catalog: Writes to Catalog collection. | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment