How to set up WebClient so that it makes multiple calls with a given buffer max limit instead of increasing the buffer max limit?

12 views Asked by At

To resolve the "max buffer limit reached" issue, we increased the buffer max limit and made it configurable. How can we set up webClient with a default buffer max limit to make multiple consecutive calls, given a default buffer limit, so that it can complete the webClient call?

i.e. Limit is reached when attempting to make a webClient call that returns 10k records given the bufferMaxLimit = 1. Ideally webClient would take 5k records first and then the next 5k instead of increasing the bufferMaxLimit to 2 in the properties file.

@Bean
public WebClient webClient(){
  return WebClient.builder()
         .filter()
         .exchangeStrategies(ExchangeStrategies
             .builder()
             .codecs(codecs -> codecsdefaultCodecs()
                 .maxInMemorySize(bufferMaxLimit * 1024 * 1024))
             .build())
         .build();
}
0

There are 0 answers