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

Extend FeignCircuitBreaker builder #624

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joaoqalves
Copy link

Background

In December 2020, this project got support for
Spring Cloud CircuitBreaker.

At the same time, Hystrix support
was removed.

Problem

In cases where people were creating the HystrixFeignClient manually
using the HystrixFeignBuilder, and overriding properties such as
encoder(Encoder encoder), the new alternative does not support it.

Example of the code working before:

HystrixFeign.builder()
            .encoder(jacksonEncoder)
            .decoder(jacksonDecoder)
            .target(MyClient.class, "https://api.my-url.com/", myFallback);

Currently, this is not supported, as the FeignCircuitBreaker does
not override encoder, decoder, among others.

Goal

To reestablish the previous functionality, so users can still create
the Feign clients programmatically, while using custom encoders, and
benefit from the circuit breaker.

Background
=====

In December 2020, this project got support for
[Spring Cloud CircuitBreaker](spring-cloud@63a5248).

At the same time, [Hystrix support](spring-cloud@63a5248#diff-c296f2567f513e037087d5f9d6f44acf6752e6b066088447d99fccde837fb0cfL53-L57)
was removed.

Problem
=====

In cases where people were creating the `HystrixFeignClient` manually
using the `HystrixFeignBuilder`, and overriding properties such as
`encoder(Encoder encoder)`, the new alternative does not support it.

Example of the code working before:

```java
HystrixFeign.builder()
            .encoder(jacksonEncoder)
            .decoder(jacksonDecoder)
            .target(MyClient.class, "https://api.my-url.com/", myFallback);
```

Currently, this is not supported, as the `FeignCircuitBreaker` does
not override `encoder`, `decoder`, among others.

Goal
======

To reestablish the previous functionality, so users can still create
the Feign clients programmatically, while using custom encoders, and
benefit from the circuit breaker.
@pivotal-cla
Copy link

@joaoqalves Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@joaoqalves Thank you for signing the Contributor License Agreement!

Copy link
Collaborator

@OlgaMaciaszek OlgaMaciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaoqalves thanks for submitting the PR. Please add tests and document your change (in spring-cloud-openfeign.adoc). Also, please add your full name and surname with @author tag to the javadocs of all the classes you've changed.

@OlgaMaciaszek OlgaMaciaszek added in progress enhancement New feature or request and removed waiting-for-triage labels Nov 23, 2021
@codecov
Copy link

codecov bot commented Nov 23, 2021

Codecov Report

Merging #624 (3e4bec7) into main (4e23e0c) will decrease coverage by 0.26%.
The diff coverage is 50.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #624      +/-   ##
============================================
- Coverage     78.87%   78.61%   -0.27%     
  Complexity      535      535              
============================================
  Files            65       65              
  Lines          1955     1973      +18     
  Branches        271      271              
============================================
+ Hits           1542     1551       +9     
- Misses          264      273       +9     
  Partials        149      149              
Impacted Files Coverage Δ
...framework/cloud/openfeign/FeignCircuitBreaker.java 65.71% <50.00%> (-16.64%) ⬇️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants