[Open Source] A lightweight and flexible business process orchestration framework that can generate workflow engine structure diagrams in real time
![[Open Source] A lightweight and flexible business process orchestration framework that can generate workflow engine structure diagrams in real time](https://yy123.ink/api/img/1782587497008-kk6oli.jpg)
1. Project Overview
Smart-flow is a lightweight and flexible business process orchestration framework that supports conditional branching control, sub-processes, business component asynchronous and degradation, etc. in business processes
2. Open Source License
Licensed under Apache-2.0
3. Screenshots


4. Feature Overview
Project background
As a business system evolves, its business logic becomes increasingly complex. Simply breaking down logic into steps can no longer keep up with changing business requirements. In most cases, business support is implemented by adding patches to the main workflow.
Furthermore, a large amount of business logic is hidden within implementation details, making it difficult to understand the overall business process from a global perspective. Against this background, a business orchestration framework is needed to help us organize code logic in a component-based manner, enabling rapid configuration and a clear understanding of the entire business workflow.
Terminology
- Engine: The object that manages the smart-flow pipeline and serves as the entry point for invocation by the workflow engine.
- Pipeline: A linear pipeline composed of components. The workflow engine executes components sequentially according to the pipeline configuration.
- Component: A wrapper layer for business logic, collectively referred to as a component. smart-flow provides various capabilities at the component layer, such as branch selection, fallback, and asynchronous execution.
- Context: The execution context, used to store intermediate information generated during workflow engine execution.
- Condition: A component used for branch evaluation and routing within a workflow.
- Executable: A developer-facing component. Developers must implement this interface to write business logic.
Functional characteristics
Core Function
- Supports linear workflow orchestration based on Java code or XML configuration.
- Supports IF and CHOOSE conditional branches.
- Supports asynchronous component execution.
- Supports component fallback and fallback callbacks.
- Supports nested sub-workflows using IF, CHOOSE, and PIPELINE.
- Supports component rollback.
- Supports component adaptation to reuse sub-workflows.
- Generates an execution path tree.
Advanced Features
- Supports XML configuration integration in Spring environments.
- Supports real-time generation of workflow engine structure diagrams.
- Supports multiple conditional expression languages (Groovy, OGNL, JavaScript, etc.).
- Spring Boot integration.
Management Features
- Supports custom execution data collection.
- Supports HTTP-based engine data reporting (including execution data).
- Supports dynamic component management (including dynamic fallback and component activation).
Provides a simple management console.Supports reloading from storage media such as databases.
5. Tech Stack
Quick Start
Adding Dependencies
lastest.version = 1.0.3
<dependency>
<groupId>org.smartboot.flow</groupId>
<artifactId>smart-flow-core</artifactId>
<version>${lastest.version}</version>
</dependency>
Implementing Executable
Implement Executable or extend AbstractExecutable and implement the execute method.
public class ExampleExecutable<Integer, String> extends AbstractExecutable<Integer, String> {
@Override
public void execute(Integer request, String result) {
// Execute business logic
}
}
The Executable interface comes with generics representing the input and output parameters of the workflow engine, respectively.
Orchestrating Business Workflows
smart-flow supports Builder-style workflow engine orchestration, as shown in the following example:
// Create a workflow engine named defaultEngine
EngineBuilder<Integer, String> builder = new EngineBuilder<>("defaultEngine");
// Create a pipeline named main process containing two steps
builder.pipeline(new PipelineBuilder<>("main process")
.next(new ExampleExecutable())
.next(new ExampleExecutable()).build());
// Create the engine named defaultEngine
FlowEngine<Integer, String> engine = builder.build();
Workflow Engine Execution
Workflow engine execution requires an input parameter (which can be null). The return value can be specified at the invocation entry point or by a component within the workflow engine.
FlowEngine<Integer, String> engine = builder.build(); engine.execute(1); // Specify the input parameter engine.execute(1, ""); // Specify both the input and output parameters engine.execute((Integer)null); // Do not specify an input parameter
After the workflow engine is executed, it returns a context. You can retrieve the result using getResult.
EngineContext<Integer, String> context = engine.execute(1); String result = context.getResult();