top of page

Bounded Context & Microservices

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • 10 hours ago
  • 2 min read

Use Case: Loan Application Processing

A legacy system has PL/SQL packages and Oracle Forms handling:

  • Customer KYC

  • Credit Score Evaluation

  • Loan Eligibility Calculation

  • Loan Disbursement

After running VFunction, it suggests candidate service boundaries. SMEs validate these against real business rules.

1️⃣ Define Aggregates (root entities)

Aggregates are clusters of entities that must be treated as a single unit for consistency.

Example:

Aggregate

Description

Root Entity

LoanApplication

Tracks the full loan request

LoanApplication

Customer

KYC, contact info, documents

Customer

CreditEvaluation

Credit checks & score

CreditScoreReport

2️⃣ Define Entities & Value Objects

Entities have identity, Value Objects are immutable and describe attributes.

Example:

Customer Aggregate

  • Entity: Customer (has customerId)

  • Value Objects:

    • Address (street, city, state, zip)

    • Document (type, number, expiration)

LoanApplication Aggregate

  • Entity: LoanApplication (loanId)

  • Value Objects:

    • LoanAmount

    • InterestRate

    • Tenure

CreditEvaluation Aggregate

  • Entity: CreditScoreReport (reportId)

  • Value Objects:

    • Score

    • Rating

3️⃣ Define Bounded Contexts

Bounded Context = a self-contained domain area where entities and rules apply consistently.

Example Bounded Contexts:

Bounded Context

Aggregates

Responsibilities

KYC Context

Customer

Collect & validate customer documents

Credit Context

CreditScoreReport

Call credit bureau, evaluate score

Loan Processing Context

LoanApplication

Calculate eligibility, track loan lifecycle

Disbursement Context

LoanApplication

Approve and disburse loan, generate agreement

4️⃣ Map Bounded Context → Microservice

After defining bounded contexts, each can become a microservice:

Microservice

Bounded Context

Technology / DB

CustomerService

KYC Context

Spring Boot + PostgreSQL / Cosmos DB

CreditService

Credit Context

Spring Boot + Kafka for events

LoanService

Loan Processing Context

Spring Boot + PostgreSQL

DisbursementService

Disbursement Context

Spring Boot + Batch Jobs (EOD), Kafka for events

Event Flow Example:

  1. Customer submits KYC → CustomerService validates → publishes KYCCompletedEvent.

  2. CreditService consumes event → checks credit score → publishes CreditScoreReadyEvent.

  3. LoanService consumes both KYC & CreditScore → calculates eligibility → triggers LoanApprovedEvent.

  4. DisbursementService listens → disburses loan → triggers LoanDisbursedEvent.

✅ Key Points

  • VFunction gives initial technical boundaries, SMEs validate for business logic.

  • DDD ensures aggregates, entities, bounded contexts map to meaningful microservices.

  • This approach reduces coupling, improves maintainability, and aligns microservices with real business capabilities.


 
 
 

Recent Posts

See All
EA Day to Day Activity

🔹 Typical Day-to-Day Activities (Enterprise Architect – Digital Lending Program) 1. Start of Day – Communication & Prioritization Read &...

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page