Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example: Circuit Breaker #60

Closed
tkohegyi opened this issue Aug 17, 2015 · 2 comments
Closed

Example: Circuit Breaker #60

tkohegyi opened this issue Aug 17, 2015 · 2 comments
Assignees

Comments

@tkohegyi
Copy link
Contributor

Need example solution for creating CircuitBreaker with Wilma.

Purpose: When we use Wilma in microservice environment, we might want to use it to act as circuit-breaker too. However it is possible, it is not offered by Wilma by default. Offering a default solution of circuit-breaker would be nice.

The Approach and Description below is just an initial idea, might be changed during the actual implementation

Approach: monitor req-res pairs, and if there is a problem, or it is requested, forward requests to its stub for a certain time.

Description:
Need interceptor that gets both request and response.
Req interceptor: adds special header with circuit-breaker-ID
Resp interceptor: evaluates if response is ok/not ok, and if not ok, turns on the circuit breaker
Class name: CircuitBreaker
Parameter list in XML:

  • circuitBreakerID - unique name/id of the circuit breaker, will be added by req interceptor
  • ServicePattern - pattern of target service url in order to identify the target service this circuitbreaker belongs to
  • timeout - defines how long the circuit break should be active after turned on, in msec
  • errorcodes - lit of Exxx codes when response should be considered as bad, and circuit breaker should be turned on - if empty nothing to do (response evaluation will be done externally)

Need API extension with:

  • CircuitBreakerDescriptor[] getCircuitBreakerDescriptorList() - get all circuit breakers
  • long (?) getCircuitBreakerStatus(CircuitBreakerDescriptor cb) - gets the remaining time (in msec) meanwhile the cbis turned on, or 0 if cbis off
  • setCircuitBreakerStatus(CircuitBreakerDescriptor cb, long(?) timeout) - turns on cb, with timeout, or turns cb off if timout is 0 or less - this can be used when cb should be turned on/off from external party

What circuitbreaker ON would mean: enable all dialogdescriptors where the name contains the circuitBreakerID at the end of its name, with timeout.

@tkohegyi tkohegyi changed the title Implement offer to have circuit-breaker Example: CircuitBreaker Jan 28, 2016
@tkohegyi tkohegyi changed the title Example: CircuitBreaker Example: Circuit Breaker Jan 28, 2016
@tkohegyi tkohegyi self-assigned this Jul 26, 2017
@tkohegyi
Copy link
Contributor Author

Branch "cb" is used to implement this.

tkohegyi added a commit that referenced this issue Oct 6, 2017
tkohegyi added a commit that referenced this issue Oct 15, 2017
* initial - NOT working version

* minor update only, example is still not working

* service part and main checker class is clarified - still not working

* experimental json based stub config is added

* lmost working, just the request interceptor part is missing

* preparing the trasfer of the cb logic to req interceptor - stubconfig part

* next phase, classes are there, still need fine tuning

* use 1.5.161 version of browsermob for wilma jar

* seems this is the first working version - need extensive testing, still

* minor update, fix issue at toString method - still not working

* fixed, first working version

* enhance the documentation - it is still not finalized

* updating readme file, finalizing the example
@tkohegyi
Copy link
Contributor Author

Done - see implemented solution and readme here: https://github.com/epam/Wilma/tree/master/wilma-extras/circuit.breaker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant