Add WebFlux WebClient Support #20
Comments
Would be nice to add a link and some non feign usage examples. |
This is the same as the reactive support. WebFlux is Spring's reactive HTTP Client. For now, you can write your own In short, core Feign will need to be updated to support this. |
@kdavisk6 Thank you, I see it. What is the progress now for the reactive support. Can you give me some examples? |
@SnowZhouJ Sure. You can find a lot of examples here |
@kptfh Are declarative annotations now supported? Like @FeignClient |
Yes. Spring auto configuration is fully supported. Check tests for examples. |
@kptfh Application run Failed , Error info: |
Take the last version of https://github.com/Playtika/feign-reactive |
I tried to create a new project,Use Hoxton.RELEASE and 2.2.2.RELEASE Spring boot ,But Still failed to start,this is error info |
@SnowZhouJ Can you update or close this issue as it's already fixed in |
@ReactiveFeignClient (name="customer-service")
public interface CustomerClient {
@GetMapping("/service/department/{departmentId}")
Flux<Customer> findByDepartment(@PathVariable("departmentId") Long departmentId);
} and injecting it in constructor in another class (Service layer) as: private CustomerClient customerClient;
@Autowired
public DepartmentService (CustomerClient customerClient) {
this.customerClient=customerClient;
}
@FeignClient(name = "department-service", fallbackFactory = CustomerClientFallbackFactory.class) if not how can fallback classes be written? |
|
@SpringBootApplication
@EnableDiscoveryClient
@EnableReactiveFeignClients
@EnableHystrix
public class DepartmentServiceApplication {
public static void main(String[] args) {
SpringApplication.run(DepartmentServiceApplication.class, args);
}
} The warning disappears only when interface is annotated with @ Component annotation. |
@kptfh @FeignClient(name = "service_statistics", fallbackFactory = StatisticFallbackFactory.class)
public interface ServiceFeignClient {
@GetMapping("/users/{id}/statistics")
public List<UserModel> getStatistics(@PathVariable String id);
} where in OpenFeign FallbackFactory comes from feign.hystrix import feign.hystrix.FallbackFactory;
@Component
public class StatisticFallbackFactory implements FallbackFactory<ServiceFeignClient> {
@Override
public ServiceFeignClient create(Throwable cause) {
return new ServiceFeignClientFallback(cause);
}
} but in Reactive one, it comes from reactivefeign.FallbackFactory. Maybe there is some Hystrix support problem or bean conflict that causes that error. |
@paro87 please, create the issue in the reactive feign repo. I would appreciate if you create not working example (you may use fork of the sample project) |
@paro87 Hi paro! I will close this issue, please create new issue in the reactive feign repo( feign-reactive). |
No description provided.
The text was updated successfully, but these errors were encountered: