question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ElasticRestClient fails to load the provided custom configuration via @ElasticsearchClientConfig

See original GitHub issue

Describe the bug

The ElasticRestClient fails to load the provided custom configuration via @ElasticsearchClientConfig. I followed the documentation here https://quarkus.io/guides/elasticsearch#programmatically-configuring-elasticsearch to provide a custom configuration for elastic search.

In my case I am adding AWS signing interceptor to the httpClientBuilder.

Version 1.12.2.Final

Expected behavior

The custom configuration (signing interceptor) should get loaded up

Actual behavior

Fails to load the custom configuration.

To Reproduce

Add a new custom configuration based on the docs.

@ApplicationScoped
@ElasticsearchClientConfig
public class MyCustomConfig implements RestClientBuilder.HttpClientConfigCallback {

   @Override
    public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
             // log something here
   }

}

Then inject the REST client.

 @Inject
 RestClient lowLevelClient;

No logged message above

From the MR here: https://github.com/quarkusio/quarkus/commit/08df613dd1f989a96b2414755ddd1dbc1c8ec02b#diff-3530ce31269994606ad048f4d42f2fa57425d1fa08c6cf4ffb37980ee8dcbd5dR86

Iterable<InstanceHandle<RestClientBuilder.HttpClientConfigCallback>> handles = Arc.container()
                        .select(RestClientBuilder.HttpClientConfigCallback.class, new ElasticsearchClientConfig.Literal())
                        .handles();

I copied the above code to my unit tests and the size of the handles variable always seem to be 0.

Arc.container() does not seem to find the custom config.

Or is there another class registration step missed in the documentation ?

Any feedback is really appreciated. Thank you

Tagging original authors for help. @eAybars @gsmet

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
gsmetcommented, Mar 19, 2021

Yes, it’s going to be backported to 1.13.

0reactions
deepankarmalhancommented, Apr 21, 2021

Updating to 1.13.2.Final worked. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connecting to an Elasticsearch cluster - Quarkus
In this guide, we will see how you can get your REST services to use an Elasticsearch cluster. Quarkus provides two ways of...
Read more >
Cannot import io.quarkus.elasticsearch.restclient.lowlevel ...
I cannot import io.quarkus.elasticsearch.restclient.lowlevel.ElasticsearchClientConfig in my Java code. Cannot find it anywhere in local jar or ...
Read more >
Encrypted communication | Elasticsearch Java API Client [8.5]
When accessing an Elasticsearch cluster that is setup for TLS on the HTTP layer, the client needs to trust the certificate that Elasticsearch...
Read more >
Using Elasticsearch with Spring Boot - Reflectoring
searching the index with powerful queries to fetch those documents, and; run analytic functions on the data. Spring Data Elasticsearch provides ...
Read more >
RestClientBuilder.setRequestConfigCallback - Java - Tabnine
Creates an Elasticsearch client from settings provided via the global config. ... new RuntimeException("Failed to initialize Elasticsearch REST client.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found