davsclaus commented on code in PR #24320:
URL: https://github.com/apache/camel/pull/24320#discussion_r3602189572
##########
components/camel-opensearch/src/test/java/org/apache/camel/component/opensearch/integration/CustomOpensearchClientIndexIT.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
Review Comment:
`mockito-core` is not declared as an explicit test dependency in
`components/camel-opensearch/pom.xml`. It works today via transitive dependency
from `camel-test-infra-core`, but should be declared directly to avoid silent
breakage if that transitive path changes.
Please add to `pom.xml`:
```xml
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
```
##########
components/camel-opensearch/src/main/docs/opensearch-component.adoc:
##########
@@ -406,3 +406,32 @@ MsearchRequest.Builder builder = new
MsearchRequest.Builder().index("twitter").s
.body(new MultisearchBody.Builder().query(b -> b.matchAll(x ->
x)).build()).build());
List<MultiSearchResponseItem<?>> response =
template.requestBody("direct:multiSearch", builder, List.class);
----
+
+=== Custom OpenSearchClient Example
+
+DeleteIndex operation using a custom OpenSearchClient that uses AWS SDK
transport. When both restClient and openSearchClient are present in registry,
openSearchClient takes precedence over restClient.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+SdkHttpClient httpClient = ApacheHttpClient.builder().build();
+final ObjectMapper mapper = new ObjectMapper();
+mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+OpenSearchTransport transport = new AwsSdk2Transport(
+ httpClient, host, Region.of(region),
+ AwsSdk2TransportOptions.builder()
+ .setCredentials(buildCredentialsProvider())
+ .setMapper(new JacksonJsonpMapper(mapper))
+ .build());
+OpenSearchClient customClient = new OpenSearchClient(transport);
+
+getContext().getRegistry().bind("customClient", customClient);
+
+from("direct:deleteIndex")
+
.to("opensearch://foo?operation=DeleteIndex&indexName=twitter&openSearchClient=#customClient");
+
+----
+====
Review Comment:
Missing trailing newline at end of file. Please add a blank line after
`====` so the file ends with a newline character.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]