Skip to content

Used Producer Consumer And Observer pattern In Real life bank transactions.

Notifications You must be signed in to change notification settings

raj-mistry-01/Concurrent-Transaction-Processor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrent Transaction Processor

A concurrent banking system simulator written in modern C++17, designed to process financial transactions safely using multi-threading, mutex synchronization, and design patterns (Producer–Consumer + Observer).


Overview

This project simulates a real-world banking transaction processor where multiple threads handle deposits, withdrawals, and rollbacks concurrently.
It demonstrates key system design principles like thread synchronization, event-driven updates, and rollback recovery — all using pure C++ standard libraries.

Core Highlights

  • Multi-threaded transaction queue using the Producer–Consumer pattern
  • Automatic rollback handling using the Observer pattern
  • CSV-based persistence for transaction and account records
  • Thread-safe balance updates with std::mutex
  • Simulated concurrency delay and rollback synchronization
  • Clean modular structure (Header + Source separation)

Diagram

Blank board

đź§  Design Patterns Used

1. Producer–Consumer Pattern

  • The system uses a shared transaction queue.
  • Producers read and push transaction data from CSV.
  • Multiple consumer threads process transactions concurrently.

2. Observer Pattern

  • A dedicated rollback thread observes processed transactions.
  • On rollback-triggered events, it automatically adjusts account balances.

Usage

  • Scalable And Maintainable code
  • High performance systems
  • Real-time transaction monitoring and rollback recovery

How to Run

  • Your system must have C++ version >= 11 because of thread dependancy
  • Clone the repo , cd Concurrent Transaction Proccesor
  • run in windows powershell or equivalent terminal in linux or mac : g++ "src/Transaction.cpp" "src\Rollback.cpp" "src/main.cpp" -I "include" -o main
  • run main.exe

About

Used Producer Consumer And Observer pattern In Real life bank transactions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published