Skip to content

Latest commit

 

History

History
68 lines (43 loc) · 1.38 KB

README.md

File metadata and controls

68 lines (43 loc) · 1.38 KB

Microservices with Circuit Breaker

This repository contains two APIs, one built with Python (Flask) and the other with Node.js (TypeScript and Express). Both APIs are configured with Docker Compose to restart every 10 seconds, simulating timeouts or data loss scenarios. Circuit Breaker patterns are implemented to handle failures gracefully.

Setup

Prerequisites

  • Docker
  • Docker Compose

Installation

  1. Clone the repository:
git clone https://github.com/pazfelipe/circuit-broker.git
cd circuit-broker
docker-compose up --build -d
  1. Build and start the services:
docker-compose up --build -d

Endpoints

Python API

• /status - Returns the status of the Python API. • /data - Returns a sample data from the Python API. • /node-data - Fetches data from the Node.js API using a Circuit Breaker.

Node.js API

• /status - Returns the status of the Node.js API. • /data - Returns a sample data from the Node.js API. • /python-data - Fetches data from the Python API using a Circuit Breaker.

Testing

Python API

cd python_api
pytest

Node.js API

cd node_api
npm test

Circuit Breaker

Both APIs implement the Circuit Breaker pattern to handle failures gracefully and prevent cascading failures across services.

Python API

Uses the pybreaker library.

Node.js API

Uses the opossum library.