Requirements - ryanrdl/NServicebus-Demo GitHub Wiki

Layers

Ordering

Ordering saga is responsible for releasing WIP to a route. Once release to a route it waits until the order is completed (packed out)

Events

  • OrderCreated
  • OrderCompleted (packed out? delivered? shipped?)

I don't I am going to worry about anything else here. I am just going to wait for the message that the order was complete to finalize the order. There is a lot more than happens here for sure, but I am trying to simplify this process.

Routing

Routing saga is the process manager that keeps track of where a wip is in the route.

  1. When wip is released to a route, then it is enqueued at the first route step(s) of the route
  2. When wip is arrived at a resource for the first time, nothing really seems to happen, it is purely historical
  3. When wip arrives at the same resource it just arrived at in the last step, then nothing happens. This should be an idempotent message that is discarded as a duplicate.
  4. When an operation is started, wip is dequeued from all route steps where it is enqueued
  5. When an operation passes, wip is enqueued at the next route step(s) based on the routing rules for pass. Note: Wip can be enqueued at 0-N route steps
  6. When an operation fails, wip is enqueued at the next route step(s) based on the routing rules for fail.
  7. When an operation aborts, wip is enqueued at the next route step(s) based on the routing rules for abort. In general this will be to re-enqueue at the same route step.

Events

  • WipReleased
  • WipEnqueued
  • WipDequeued
  • WipArrived
  • What is the final step? Delivered?

Operations

Before an operation can start it must pass all pre-start rules. Once it has started we are generally awaiting user input.

Events

  • OperationStarted
  • OperationPassed
  • OperaitonFailed
  • OperationAborted

Do we want to follow the pass/fail/abort paradigm if we are including post in process steps? How would would structure this otherwise? Maybe a single OperationComplete event with information about the result that we could use to determine the next route step.

Operation: Assemble

I don't think assemble is a saga. There may be an ancillary saga the completes the assemble operation but that seems like overkill and it is probably just better to handle that in the aggregate.

  1. When every item is assembled then the operation is successfully complete
  2. What condition causes a failure?
  3. What condition causes an abort? I would guess just someone saying to abort.

Events

  • Assembled
  • Disassembled

Operation: Inspection and Rework

Again, this is probably not a saga. There is a small set of operations you perform here and the routing saga just waits to respond to specific events that come out of this operation

  1. What condition causes a pass?
  2. What condition causes a failure?
  3. What condition causes an abort? I would guess just someone saying to abort.

Events

  • DefectFound

Operation: Scrap

Not a saga

  1. What condition causes a pass?
  2. What condition causes a failure?
  3. What condition causes an abort?

Events

  • Scraped
  • Unscraped (wtf? how do you unscrap something?)

Packout

Not a saga

Packout takes every WIP created as part of an order and "packs it". Additionally there is an unpack operation, but I am still not quite sure why you would do that. Also, this is not an "in process" step, so we don't have pass/fail/abort. Can you only pass? Or should this just be "complete"?

Events

  • Packed
  • Unpacked