spiff-arena/doc/bpmn/gateways.rst
Dan fec5934d38 Squashed 'SpiffWorkflow/' changes from 0e61be85c..11e4b4f96
11e4b4f96 fix two incorrectly names attributes in node parser
abec918a8 Merge pull request #291 from rachfop/fix-grammar
a597f9ce9 Fixes grammar, typos, and spellings
00ffaf067 Assure that when something goes wrong calling a service task that we get as much good information about the problem as possible.
c044b5646 Fix that dreadful unknown "KeyError" exception that was cropping up. Adding a bit of detail to the spiffworkflow exceptions when a duplicate process model is found. Disable the submit button on tasks after you click submit (avoid the double click and give users a better experience)

git-subtree-dir: SpiffWorkflow
git-subtree-split: 11e4b4f96f03a036bd29632f1560e347a4e69aae
2023-02-14 16:51:09 -05:00

74 lines
2.5 KiB
ReStructuredText

Gateways
========
BPMN Model
----------
In this section, we'll expand our model by creating alternate paths through the
workflow depending on the current workflow state, in this case, answers provided
by the user through forms.
We've also added a second DMN table to find the cost of the selected shipping
method, and we updated our order total calculations to incorporate that cost.
We'll be using the following files from `spiff-example-cli <https://github.com/sartography/spiff-example-cli>`_.
- `gateway_types <https://github.com/sartography/spiff-example-cli/blob/master/bpmn/gateway_types.bpmn>`_ workflow
- `product_prices <https://github.com/sartography/spiff-example-cli/blob/master/bpmn/product_prices.dmn>`_ DMN table
- `shipping_costs <https://github.com/sartography/spiff-example-cli/blob/master/bpmn/shipping_costs.dmn>`_ DMN table
Exclusive Gateway
^^^^^^^^^^^^^^^^^
Exclusive gateways are used when exactly one alternative can be selected.
Suppose our products are T-shirts and we offer product C in several colors. After
the user selects a product, we check to see it if is customizable. Our default
branch will be 'Not Customizable', but we'll direct the user to a second form
if they select 'C'; our condition for choosing this branch is a simple python
expression.
.. figure:: figures/exclusive_gateway.png
:scale: 30%
:align: center
Flow configuration
Parallel Gateway
^^^^^^^^^^^^^^^^
.. sidebar:: IDs vs Names
We've assigned descriptive names to all our tasks so far. Text added to
the Name field will appear in the diagram, so sometimes it's better to
leave it blank to avoid visual clutter. I've put a description of the
gateway into the ID field instead.
Parallel gateways are used when the subsequent tasks do not need to be completed
in any particular order. The user can complete them in any sequence and the
workflow will wait for all tasks to be finished before advancing.
We do not care whether the user chooses a shipping method or enters their
address first, but they'll need to complete both tasks before continuing.
We don't need to do any particular configuration for this gateway type.
.. figure:: figures/parallel_gateway.png
:scale: 30%
:align: center
Parallel Gateway example
Running The Model
^^^^^^^^^^^^^^^^^
If you have set up our example repository, this model can be run with the
following command:
.. code-block:: console
./run.py -p order_product \
-d bpmn/product_prices.dmn bpmn/shipping_costs.dmn \
-b bpmn/gateway_types.bpmn