Skip to content

Christopher-Barham-AKQA/ThirtyPercentFailService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This project provides a 'service' for testing an implementation of the Circuit Breaker pattern as described in the book "ReleaseIt!" by the pragmatic programmers: http://pragprog.com/book/mnee/release-it

The relevant extract from the book describing the pattern as a PDF is in the docs folder.

Functionality

The service object provides a method called serviceCall that 75% of the time returns true (to denote success), and the remaining 25% of the time false, to denote failure.

Service has a constructor that allows the limit to be set as an Integer, so 75% of this limit the calls succeed, the following 25% fail.

Unit tests show examples of how to use it. There is also a concurrent unit test to show this is thread safe.

#Circuit Breaker# Based roughly on the following logic:

When Circuit is Closed:
on call = pass through
call succeeds = reset count
call fails = count failure
threshold reached = trip breaker. Open State

when Circuit is Half-Open
on call = pass through
call succeeds = reset go. Close State
call fails = trip breaker. Open State

when Circuit is Open
on call = return/fail
on timeout = attempt reset. Half-Open State

#Links#

theory

implementations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages