Modelling order processing use cases

We are investigating to use camunda for our order fulfilment orchestration. Order may contains multiple order items (One or more) and they need to be fulfilled in particular order which means they must be fulfilled sequentially. That is order item 1 should be completed only then order item2 could be fulfilled and so on.

Our plan is to have a main camunda workflow to orchestrate order fulfilment, which basically receive complete order and then tries to fulfil each order. Each order item has separate camunda workflow to fulfil that item (From main order orchestrator workflow we were hoping to call these item workflows through call activity)

During fulfilling these item cancel order even could also be received and we should even honor that. So if an item is already fulfilled when cancel order is received we should execute cancel order for that item and if an item is being fulfilled and an cancel order is received then fulfilment should be rolled back and if an item is not started to get fulfilled then don’t fulfil order item

Example:

  • An order container item-C, item-A and item-B in input json and we would sort them to correct order item-A, item-B and item-C and then call individual item workflow to fulfil in sequence while item-B only gets fulfilled once item-A is fulfilled and item-C is fulfilled only when item-B is fulfilled
  • An order containers only one item which is item-C and since item-A and B are not available fulfil item-C.

Right now we are struggling to understand how to perform order item fulfilment. How to model sequential execution and fulfilling an item only when its predecessor is completed