dotnet-templates icon indicating copy to clipboard operation
dotnet-templates copied to clipboard

eqxFc: Location with Long Running Inventory

Open bartelink opened this issue 4 years ago • 0 comments

The eqxfc template hosts aggregates based on some patterns relevant to Fulfilment Centers. The goal is more to illustrate techniques of unit, integration testing and decoupling than necessarily to represent the exact business logic one might need.

This PR (originally developed in https://github.com/jet/equinox/pull/181) illustrates an approach to deal with long-lived streams without having them actually be infinite, which involves:

  1. a LocationEpoch that maintains a rolling balance
  • each successor deterministically has the balance carried forward written as the first event of the stream
  • there's a Closed event, after which no writers are permitted to write
  1. a LocationSeries aggregate which holds a pointer to verified active epoch (competing readers/writers read this optimistically on a cached basis; in the event that they're behind, they'll compete to log the successful commencement of a new epoch, which cannot happen before the CarriedForward event for the successor epoch has been committed)
  2. an Inventory.Transaction aggregate that fulfills two purposes
  • holds state pertaining to in-flight work
  • the events mark staging points in the flow
  1. a set of coordinated streams: a) InventorySeries b) InventoryEpoch, which are used to (idempotently) record the conclusion of each transfer/adjustment on a global summary stream
  2. an Inventory.Process.Service which is a Process Manager that orchestrates the work involved in the transactions

~7. a Watchdog service that listens for stalled transactions, using the Inventory.Process.Service to drive a given flow to a conclusion if it has been determined to be stalled (open for 10s but not completed)~ /equinox-shipping bears a more complete version than that which existed here; the Drive member will remain here as a placeholder, but there's plenty interesting stuff in here without throwing yet another concept into the mix

See https://github.com/jet/dotnet-templates/pull/50 for a simplified edition which removes the LocationSeries and CarriedForward concepts in order to make it easier to inspect the mechanism

bartelink avatar Nov 29 '19 18:11 bartelink