Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

[FEAT] Be able to get information about the exception thrown in case of failure #62

Merged
merged 4 commits into from
Jan 24, 2022

Conversation

mickaelandrieu
Copy link
Contributor

As point in https://github.com/loveOSS/resiliency/issues/61, we are not able to know which exception is responsible of a failure and so on we are not able to open/close manually our circuit breaker according to the exception.

As the current architecture doesn't allows to setup the related exception of a circuit breaker, the only chance we get is to add a new event and allow developer to manually setup new conditions of open/close decision.

// ThrowableEvent
function listener(Failed $event) {
    $exception = $event->getException();

   if ($exception->getException() instanceof HttpNotFoundOrWhatever) {
       $uri = $event->getService()->getURI();
       $circuitBreaker = $event->getCircuitBreaker();
       $circuitBreaker ->isolate($uri);
       // OR
       $circuitBreaker ->reset($uri);
   }
};

This could be improved but I don't see how without introducing a big breaking change, what I don't want as I'm not involved in PHP projects anymore.

@mickaelandrieu mickaelandrieu changed the title [FEAT] Be able to handle exception [FEAT] Be able to get information about the exception thrown in case of failure Jan 24, 2022
@mickaelandrieu mickaelandrieu merged commit 8fbf09e into main Jan 24, 2022
@mickaelandrieu mickaelandrieu deleted the added-failed-event branch January 24, 2022 15:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant