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

Add customization hook for reactive WebClient [DATAES-719] #1292

Closed
spring-projects-issues opened this issue Dec 24, 2019 · 2 comments
Closed

Add customization hook for reactive WebClient [DATAES-719] #1292

spring-projects-issues opened this issue Dec 24, 2019 · 2 comments
Labels
in: core type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Dec 24, 2019

Takaaki Iida opened DATAES-719 and commented

When my app gets a large response from Elasticsearch by ReactiveElasticsearchClient, I will get below exception.

org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144

This exception can be solved if I change a value of maxInMemorySize in WebClient but I can't customize it now. (see details by spring-projects/spring-framework#23961)

WebClient of ReactiveRestClients is instanced by below method and there are no extension point to customize it.

https://github.com/spring-projects/spring-data-elasticsearch/blob/3.2.3.RELEASE/src/main/java/org/springframework/data/elasticsearch/client/reactive/DefaultWebClientProvider.java#L137

 

Could you expose some extension point to customize it?


Affects: 4.0 M1 (Neumann), 3.2.3 (Moore SR3)

Referenced from: pull request #363, and commits 5bf073b, b731b47, 283b27d, f7a14c1

Backported to: 3.2.4 (Moore SR4)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 25, 2019

sothawo commented

The WebClient can be now configured like this (setting maxInMemorySize to unlimited in this example):

@Configuration
public class ReactiveRestClientConfig extends AbstractReactiveElasticsearchConfiguration {
    @Override
    public ReactiveElasticsearchClient reactiveElasticsearchClient() {
        final ClientConfiguration clientConfiguration = ClientConfiguration.builder() //
            .connectedTo("localhost:9200") //
            .withWebClientConfigurer(webClient -> {
                ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
                    .codecs(configurer -> configurer.defaultCodecs()
                        .maxInMemorySize(-1))
                    .build();
                return webClient.mutate().exchangeStrategies(exchangeStrategies).build();
            })
            .build();
        return ReactiveRestClients.create(clientConfiguration);

    }
}

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 7, 2020

Vity commented

in 4.0.4 there is max-in-memory-size property

spring:
 data:
  elasticsearch:
    client:
      reactive:
        max-in-memory-size: 10MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

1 participant