Skip to main content

Business Processes

Traditional business processes are modeled and implemented in NS applicationsNS Application (NSApplication). A pre-built software stack that provides common enterprise application functionality such as CRUD, search, authentication, and business process modeling out of the box. as state machines. We model each process as a workflow, conceived as a sequence of tasks, represented by TaskElements operating on a single DataElement.

Workflows​

A Workflow lists all transitions that are defined in the business process. Each transition is composed out of one begin state and one or more end states. During a transition, the actual business logic will be executed by a task implementation. At last, a trigger defines when a business process is started (e.g. a certain time, a data update, etc.)

A car booking flow example

Let's say, we have a booking flow that validates whether the selected car is available for rental in an external systemSystemA set of interconnected components that work together to achieve a specific purpose or function..

Zooming into a single transition, such as an invoice moving through its own send-pay-book process, shows the same structure at a smaller scale:

A Task embedded in a flow is executed whenever an instance of the target DataElement is in a particular state (the "begin state"). While the task is being executed, the state is set to a temporary busy state (the "interim state"). When the task has been completed, the state is altered again into an "end state" (in case the task was successfully executed) or a "failed state" (in all other cases).

Task Elements​

A TaskElement models the actual business logic that has to be performed within the business process (e.g. send email, validate availability) and is often named as a 'verb'. A task operates on a DataElement, and will execute some actions. These actions are not atomic by default, but can be configured as such. A Task will take the element it is working on, and return a task result. These results can be define as one or more task outcomes.

Linking tasks to a workflow​

While a task will mostly be used in workflows, it is important that tasks are implemented independent of the state of the DataElement it is working on.

To actually execute a business process with a workflow, a transition has to be linked to a task execution. The different task outcomes are then mapped to possible end states of a transition. The mapping is often a one on one match, but it is possible to map different outcomes to one transition end state.

By separating task and transition, they same task can be reused in multiple workflows (e.g. a send email implementation can be used in multiple processes)

Process flow​

The general idea of the component isn't very difficult. The image below depicts the process flow on a high level.

  • Change Driver refers to something which requires action from our applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution.. If nothing has changed, there is no reason for us to do any work. It is important to define what can drive change within our systemSystemA set of interconnected components that work together to achieve a specific purpose or function.. A few examples of this are time, user input, task execution or external messages.
  • Task Queue will be notified when one of our change drivers produces an event. This event may simply be time passing, but can also be the creation of a dataElement. In any case, we now have a change on which we can act. The task queue is used to collect all tasks which result from the events in our systemSystemA set of interconnected components that work together to achieve a specific purpose or function..
  • Processing is responsible for distributing the available work from the task queue onto the available resources. The applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution. may run in a limited environment with only one thread, but can also have many threads to execute work in parallel. Finally the work being executed can have side effects, which in turn can be its own change driver. This cycle will continue until the applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution. state is stable.