The IncludeWorkflow
operator works in exactly the same way as GroupWorkflow, with the difference that the nested workflow definition is stored externally in a file, rather than locally in the node itself. Include nodes are used to organize larger workflows into modular building blocks. They allow reusing functionality across different parts of a workflow, or even across different projects. Changing the definition of an included workflow will be automatically reflected in all places where that workflow is reused.
All observable sequences passed as arguments to the outer IncludeWorkflow
will be routed to the inner WorkflowInput nodes. Conversely, all notifications emitted by the sequence connected to the single WorkflowOutput node will be passed to any observers of the include workflow node. It is possible to subscribe multiple times to the same include workflow, in which case the nested workflow will run potentially in parallel and is considered to be reentrant.
Note
Externalized properties contained inside the included workflow will be exposed when selecting the IncludeWorkflow
node. Any changes to the values of these properties can be recovered, even if the included workflow is reused multiple times in different parts of the program. They can also be further externalized as part of other nested operators or dynamically assigned using PropertyMapping or InputMapping operators.
Warning
If the nested workflow is reentrant, properties of inner nodes are shared by all asynchronous operations which are running simultaneously. If the shared state never changes across reentrant operations (i.e. the state is immutable), this is not a problem. If shared state is changing dynamically, you should consider using synchronization primitives to make sure that state updates are coordinated across the different asynchronous operations.