quarkus: ElasticRestClient fails to load the provided custom configuration via @ElasticsearchClientConfig

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

About this issue

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

Commits related to this issue

Most upvoted comments

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