0

I am building a webclient with custom exchangefilter. This custom exchangefilter use reselience4j for load balancing stuff. I want to add webflux spring integration outbound gateway to send request and receive http response. Is there a way i can inject my custom webclient in spring webflux integration without impacting the functionality of exchangefilter?

ProblemSolver
  • 161
  • 1
  • 1
  • 10

1 Answers1

1

The gateway has several constructors that take a WebClient.

https://github.com/spring-projects/spring-integration/blob/2217cb4f90a722fdfd5868cfc376809b7eb7da31/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandler.java#L103-L116

e.g.

/**
 * Create a handler that will send requests to the provided URI using a provided WebClient.
 * @param uri The URI.
 * @param webClient The WebClient to use.
 */
public WebFluxRequestExecutingMessageHandler(String uri, @Nullable WebClient webClient) {

And, with the DSL

        .handle(WebFlux.outboundGateway(uri, webCLient))
        . ...
        .get();
Gary Russell
  • 166,535
  • 14
  • 146
  • 179