Created
June 27, 2019 19:36
-
-
Save impactmass/b81347d1c680837105bc5a925a2bbb97 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 | |
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: Bulk write to SimpleInventory collection | |
MongoDB -> Simple-Inventory-Plugin: Returns result set | |
alt resulting inserts from batch operation | |
loop for Each inserted SimpleInventory Record | |
Simple-Inventory-Plugin -> MongoDB: 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: Reads from Products collection. | |
Inventory -> MongoDB: Reads from SimpleInventory collection. | |
Inventory -> MongoDB: 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