Skip to content

mizbamd/pricing-orchestration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pricing-orchestration

CI

Reference implementation of a governed pricing platform built on MACH principles and Domain-Driven Design. Demonstrates a pluggable rules engine, workflow orchestration for the price-approval lifecycle (Camunda/Temporal-style state machine) with human-in-the-loop, and a choreography-based SAGA with compensation across bounded contexts -- a deliberate contrast to the orchestration SAGA in payments-modernization-platform.

Part of the Enterprise Platform Reference Architecture. Models the merchandising / pricing domain. See docs/INDUSTRY-APPLICABILITY.md.

Architecture

flowchart TB
  api["POST /api/price-changes (API-first, headless)"] --> wf
  subgraph pricing [Pricing context]
    wf["PriceApprovalWorkflow (ORCHESTRATION state machine)"] --> rules["RuleEngine: margin / increase / competitive"]
  end
  wf -->|"clean"| pub["publish"]
  wf -->|"soft violation"| hitl["PENDING_APPROVAL -> human approve"]
  wf -->|"hard violation"| rej["REJECTED"]
  hitl --> pub
  pub -->|"PriceChangePublished event"| choreo
  subgraph choreo [CHOREOGRAPHY across contexts]
    cat["Catalog context updates read model"] -->|"CatalogUpdated"| search["Search context indexes"]
    cat -->|"on failure: PriceChangeRollbackRequested"| comp["Compensation -> ROLLED_BACK"]
  end
Loading

Two coordination styles, on purpose

Style Where Why
Orchestration PriceApprovalWorkflow lifecycle Complex decisioning + human approval needs one owner of the flow (Camunda/Temporal)
Choreography Post-publish catalog/search reactions Loosely-coupled contexts react to events independently; scales org-wide

Rules engine

Each rule is a Spring @Component implementing PricingRule, so adding governance is open/closed:

  • MinMarginRule (HARD: block below margin floor)
  • MaxIncreaseRule (SOFT: large jump needs approval)
  • CompetitiveRule (SOFT: materially above competitor needs approval)

Run

mvn test                       # unit/integration tests
mvn spring-boot:run            # http://localhost:8083
./scripts/demo.sh              # walk the four scenarios
docker compose up --build

Documentation

Tech

Java 21, Spring Boot 3.3, JPA/H2, Spring application events (choreography), Argo Rollouts (canary).

About

MACH + DDD pricing platform: pluggable rules engine, approval workflow orchestration, and a choreography SAGA with compensation/rollback. Java/Spring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors