How nitorcreations/nflow works
Main components
• nFlow Engine (nflow-engine): This is the core engine handling workflow definition, state machine logic, database operations (with many sub-packages for configuration, DAO, workflow execution, exception handling, and internal utilities). It is the heart of the orchestration system.
• Workflow Executor/Dispatcher: Within the engine you have components for executing workflows (e.g., dispatchers, state processors, lifecycle management).
• Database Layer: Since nFlow relies heavily on relational databases for atomic state updates and locking, include connections to multiple supported databases (PostgreSQL, MySQL/MariaDB, Oracle, SQL Server, DB2, and even H2 as demo).
• REST APIs and External Interfaces:
• nflow-rest-api-common, nflow-rest-api-jax-rs, and nflow-rest-api-spring-web expose the workflow and administrative functions over REST.
• nflow-server-common may contain shared server-side logic and static UI assets.
• Web UI / Explorer (nflow-explorer): A separate module providing visualization, configuration, and interactive documentation of workflows.
• Deployment Modules/Containers:
• nflow-jetty and nflow-netty: Provide embeddable web servers for running the engine in different container technologies.
• nflow-perf-test and nflow-tests: Indicate testing and load/performance testing framework for the engine.
• Examples (nflow-examples): Show how to integrate nFlow in different project setups (e.g., Spring Boot, full-stack examples with Maven and Gradle).
Relationships and Data Flow
• The engine module interfaces with the database layer for transactional state updates.
• The workflow dispatcher (inside the engine) takes in workflow definitions (which are coded as Java) and processes life cycle states.
• The REST API modules read from and write to the engine components, exposing workflows externally.
• The embeddable servers (Jetty, Netty) provide the HTTP container for REST and UI calls to the engine.
• Example projects illustrate how a client application embeds the engine and invokes the workflow definitions.
Architectural Patterns and Design Principles
• Integration via Microservices-like separation: Although nFlow is a library, its separate modules (REST, engine, server integrations) suggest a loose coupling where the core engine can be embedded into different container environments.
• Fault Tolerance & Recovery: Highlight the designs around atomic state updates, exception handling, and recovery mechanisms in the engine.
• Dependency Injection & Modular Configuration: The engine uses Guice (see the ‘guice’ directories in nflow-engine) for dependency management.
• Database Abstraction and Multi-dialect Support: The database packages show how different database configurations are handled.