ColdFusion Circuit Breaker Project On GitHub
Over the last month or two, I've been noodling quite heavily on the topic of Circuit Breakers in ColdFusion. Circuit Breakers are execution proxies that help a ColdFusion application deal with failure in a safer, more predictable way. Using a Circuit Breaker can help prevent upstream failures from causing subsequent failures in the downstream system. This programming pattern was popularized by Michael Nygard in his book, Release It!
While I've never actually used a Circuit Breaker in production (yet), I wanted to put my Circuit Breaker project up on GitHub so that I had a place to evolve the concept (or rather my understanding of the concept) over time. It also forced me to actually write some Unit Tests for my code (which is not something I do all that often).
View my ColdFusion Circuit Breaker project on GitHub.
In my implementation of the Circuit Breaker, the control flow logic is separate from the state management. This allows the Circuit Breaker to be generic and forces the state management implementations to remain decoupled. Different state management implementations can then be developed and tested independently and swapped in and out seamlessly.
Out of the box, my library ships with a Circuit Breaker State implementation can be configured for Failed Request thresholds and Concurrent Request thresholds. I believe that this will cover the majority of use-cases that ColdFusion developers will deal with.