Skip to content

Business Service API

πŸ’Ό

A comprehensive business operations and process management REST API built with Java, Spring Boot, and PostgreSQL. Manages business rules, workflows, configurations, and operational metrics.


Features

Feature Description Icon
Workflow Management Define and execute business workflows βš™οΈ
Business Rules Engine Configure and apply dynamic business rules πŸ“‹
Process Orchestration Coordinate multi-step business processes πŸ”„
Metrics & Analytics Track operational metrics and KPIs πŸ“Š
Configuration Management Manage business-level configurations βš™οΈ
Event-Driven Processing React to business events in real-time πŸ“’
Multi-Tenant Support Isolate business processes per tenant 🏒

Architecture Overview

flowchart TD
    A[Client] -->|REST API| B(BusinessController)
    B --> C[WorkflowService]
    C --> D[RuleEngineService]
    C --> E[ProcessRepository]
    D --> F[RuleRepository]
    E --> G[(PostgreSQL)]
    F --> G
    C --> H[Event Bus]
Hold "Alt" / "Option" to enable pan & zoom

API Endpoints

Note: Real API endpoints to be provided and included here.

Method Endpoint Description Notes/Parameters
POST /api/v1/workflows Create workflow definition tenantId header, workflow config
GET /api/v1/workflows/{id} Get workflow details
POST /api/v1/workflows/{id}/start Start workflow instance Input parameters
POST /api/v1/rules Create business rule Rule definition

Sequence: Execute Workflow

sequenceDiagram
    participant U as User
    participant API as BusinessController
    participant W as WorkflowService
    participant R as RuleEngineService
    participant Repo as ProcessRepository
    participant E as Event Bus
    U->>API: POST /workflows/{id}/start (params)
    API->>W: start workflow instance
    W->>Repo: save workflow execution
    Repo-->>W: instance created
    W->>R: evaluate business rules
    R-->>W: rule results
    W->>E: publish workflow started event
    E-->>W: event queued
    W-->>API: WorkflowExecutionResponse
    API-->>U: 201 Created + execution details
Hold "Alt" / "Option" to enable pan & zoom

Database Schema

erDiagram
    workflows {
        UUID id PK
        UUID tenant_id
        VARCHAR workflow_name
        TEXT workflow_definition
        VARCHAR status
        TIMESTAMP created
        TIMESTAMP updated
    }

    workflow_executions {
        UUID id PK
        UUID workflow_id FK
        UUID tenant_id
        VARCHAR execution_status
        JSON execution_context
        TIMESTAMP start_time
        TIMESTAMP end_time
        TIMESTAMP created
    }

    business_rules {
        UUID id PK
        UUID tenant_id
        VARCHAR rule_name
        TEXT rule_condition
        TEXT rule_action
        BOOLEAN active
        TIMESTAMP created
        TIMESTAMP updated
    }

    workflows ||--o{ workflow_executions : "executes"
    business_rules ||--o{ workflow_executions : "applied_in"
Hold "Alt" / "Option" to enable pan & zoom

Getting Started

Prerequisites

  • Java 17+
  • PostgreSQL
  • Gradle

Setup

git clone https://github.com/Olanna-tech/business-service-java.git
cd business-service-java
./gradlew build

Database

  • Configure your PostgreSQL credentials in src/main/resources/application.yml.
  • Run Flyway migrations (auto on startup).

Run

./gradlew bootRun

Configuration

Set the following environment variables in application.yml:

business:
  workflow-execution-timeout: 3600
  rule-engine-type: DROOLS
  event-processing: async
  metrics-collection-enabled: true


Contributing

Pull requests are welcome! For major changes, please open an issue first.


License

MIT


Contact