Soumya C
Soumya C

Reputation: 129

Class anonymous class derived from HttpClientConfigCallback() must be declared abstract or implement abstract method

I am trying to set up an Elasticsearch high level rest client to connect with an already set up ES cluster via Http Host setup and regular credential authentication. I am setting this up to ingest data from my local system to the central cluster, periodically. My code snippet for that looks something like the following :

    final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
    credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
    RestClientBuilder builder = RestClient.builder(new HttpHost(host, port, "https"))
        .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
            @Override
            public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
                return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
            }
        });

Howver, I seem to be facing the Error : "Class anonymous class derived from HttpClientConfigCallback() must be declared abstract or implement abstract method customizeHttpClient(HttpAsyncClientBuilder) in HttpClientConfigCallback" and also an error on the @Override method following it, stating "Method does not override method from it's superclass".

Can anyone tell me how should I implement that abstract method or do I need to import anything else?

Upvotes: 0

Views: 193

Answers (0)

Related Questions