The business process framework

The business domain

  • Your service domain has logical blocks of business logic that needs to be tied together in a control flow. building blocks logo
  • Each of these logical blocks can be either automated or manually executed.
  • These logical blocks could be running into transitive errors, waiting for external input etc.

Examples

Let us see how we can logically group several domain's business logic into logical groups and then define control flow among these groups

Review Board Workflow

review board workflow

Billing Workflow

billing workflow

Workflow Requirements

  • The workflow definition (graph declaration) is explicit and separate from the business logic (activities) implementation. billing workflow snippet
  • The business logic unit will be retried automatically if they fail. billing workflow snippet
  • Control flow (transitions) between the business logic units may depend on previous business logic unit's result. billing workflow snippet

Workflow architecture

workflow architecture

Workflow Concepts

Workflow Definition
  • A workflow definition is the specification of a workflow.
Workflow Activity Definition
  • An activity is the business logic unit that belongs to a workflow definition.
  • The business logic unit/activity is retriable.
  • There are different variants of an activity based on some real world use cases we observe:
    • System activity
    • External activity
    • Condition activity
    • Start/Stop activity
Workflow Entity
  • Every workflow instance is tied to an entity. The entity uniquely represents a particular run of a workflow definition.
  • For example, in the review board workflow, the review board id can be used as the workflow entity.
Workflow Engine
  • This is the brain, the command centre of the workflow framework.
  • Workflow engine manages the lifecycle of the workflow. It maintains a set of workflow definitions which are passed to it at boot up time

Implementing Workflow

  • Define workflow entity
  • Define workflow definition
  • Define workflow activity definition
  • Create workflow activities
  • Define workflow activity transitions
  • Define workflow activity action results
  • Implement workflow activity actions
  • Implement workflow engine

Code Implementation

Dependencies

						
						
						

Define workflow entity

					
					
					

Define workflow definition

						
						
						

Define workflow activity definitions

						
						
						

Define workflow activity definitions

						
						
						

Code Gen

Dependencies

						
						
						
					

Gradle

						
						
						
					

Workflow Engine

						
						
						
					

Workflow & Activity Definition

						
						
						
					

Generate Code

						
						
						
					

Resources

Questions

There are 54 unique workflows in production today across 17 multi products!