This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ed97bd4998e CAMEL-21518: Add capability to set 
elasticsearch-rest-client operation via a header
ed97bd4998e is described below

commit ed97bd4998e341db12009e2ccbcdf7b76f6dac31
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Mon Jan 6 13:54:22 2025 +0000

    CAMEL-21518: Add capability to set elasticsearch-rest-client operation via 
a header
---
 .../catalog/components/elasticsearch-rest-client.json  |  5 +++--
 .../rest/client/elasticsearch-rest-client.json         |  5 +++--
 .../main/docs/elasticsearch-rest-client-component.adoc |  2 +-
 .../rest/client/ElasticSearchRestClientConstant.java   |  4 ++++
 .../rest/client/ElasticsearchRestClientEndpoint.java   |  3 ---
 .../rest/client/ElasticsearchRestClientProducer.java   | 18 ++++++++++++++++--
 .../ElasticsearchRestClientComponentIT.java            | 16 +++++++++++++++-
 .../ElasticsearchRestClientEndpointBuilderFactory.java | 15 +++++++++++++--
 8 files changed, 55 insertions(+), 13 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json
index 765eab60e9a..f88188bed4e 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/elasticsearch-rest-client.json
@@ -41,14 +41,15 @@
     "ID": { "index": 0, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "ID of the object to index or retrieve or delete", 
"constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#ID"
 },
     "SEARCH_QUERY": { "index": 1, "kind": "header", "displayName": "", 
"group": "producer", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The JSON Query to perform for search", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#SEARCH_QUERY"
 },
     "INDEX_SETTINGS": { "index": 2, "kind": "header", "displayName": "", 
"group": "producer", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "Advanced - The JSON Index Settings and\/or Mappings 
Query to perform to create an index", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_SETTINGS"
 },
-    "INDEX_NAME": { "index": 3, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "The Index name", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME"
 }
+    "INDEX_NAME": { "index": 3, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "The Index name", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME"
 },
+    "OPERATION": { "index": 4, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation",
 "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", 
"DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The operation to perform", 
"constantName": "org.apache.camel.component.elasti [...]
   },
   "properties": {
     "clusterName": { "index": 0, "kind": "path", "displayName": "Cluster 
Name", "group": "producer", "label": "", "required": true, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "Cluster Name" },
     "connectionTimeout": { "index": 1, "kind": "parameter", "displayName": 
"Connection Timeout", "group": "producer", "label": "", "required": false, 
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 30000, "description": "Connection timeout" },
     "hostAddressesList": { "index": 2, "kind": "parameter", "displayName": 
"Host Addresses List", "group": "producer", "label": "", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "List of host Addresses, 
multiple hosts can be separated by comma." },
     "indexName": { "index": 3, "kind": "parameter", "displayName": "Index 
Name", "group": "producer", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Index Name" },
-    "operation": { "index": 4, "kind": "parameter", "displayName": 
"Operation", "group": "producer", "label": "", "required": true, "type": 
"object", "javaType": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation",
 "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", 
"DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "Operation" },
+    "operation": { "index": 4, "kind": "parameter", "displayName": 
"Operation", "group": "producer", "label": "", "required": false, "type": 
"object", "javaType": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation",
 "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", 
"DELETE_INDEX", "SEARCH" ], "deprecated": false, "autowired": false, "secret": 
false, "description": "Operation" },
     "socketTimeout": { "index": 5, "kind": "parameter", "displayName": "Socket 
Timeout", "group": "producer", "label": "", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 30000, "description": "Socket timeout" },
     "lazyStartProducer": { "index": 6, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produc [...]
     "enableSniffer": { "index": 7, "kind": "parameter", "displayName": "Enable 
Sniffer", "group": "advanced", "label": "advanced", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Enabling Sniffer" },
diff --git 
a/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json
 
b/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json
index 765eab60e9a..f88188bed4e 100644
--- 
a/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json
+++ 
b/components/camel-elasticsearch-rest-client/src/generated/resources/META-INF/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json
@@ -41,14 +41,15 @@
     "ID": { "index": 0, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "ID of the object to index or retrieve or delete", 
"constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#ID"
 },
     "SEARCH_QUERY": { "index": 1, "kind": "header", "displayName": "", 
"group": "producer", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "The JSON Query to perform for search", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#SEARCH_QUERY"
 },
     "INDEX_SETTINGS": { "index": 2, "kind": "header", "displayName": "", 
"group": "producer", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "deprecationNote": "", "autowired": false, "secret": 
false, "description": "Advanced - The JSON Index Settings and\/or Mappings 
Query to perform to create an index", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_SETTINGS"
 },
-    "INDEX_NAME": { "index": 3, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "The Index name", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME"
 }
+    "INDEX_NAME": { "index": 3, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": "String", "deprecated": 
false, "deprecationNote": "", "autowired": false, "secret": false, 
"description": "The Index name", "constantName": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant#INDEX_NAME"
 },
+    "OPERATION": { "index": 4, "kind": "header", "displayName": "", "group": 
"producer", "label": "", "required": false, "javaType": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation",
 "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", 
"DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "The operation to perform", 
"constantName": "org.apache.camel.component.elasti [...]
   },
   "properties": {
     "clusterName": { "index": 0, "kind": "path", "displayName": "Cluster 
Name", "group": "producer", "label": "", "required": true, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "Cluster Name" },
     "connectionTimeout": { "index": 1, "kind": "parameter", "displayName": 
"Connection Timeout", "group": "producer", "label": "", "required": false, 
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 30000, "description": "Connection timeout" },
     "hostAddressesList": { "index": 2, "kind": "parameter", "displayName": 
"Host Addresses List", "group": "producer", "label": "", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "List of host Addresses, 
multiple hosts can be separated by comma." },
     "indexName": { "index": 3, "kind": "parameter", "displayName": "Index 
Name", "group": "producer", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Index Name" },
-    "operation": { "index": 4, "kind": "parameter", "displayName": 
"Operation", "group": "producer", "label": "", "required": true, "type": 
"object", "javaType": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation",
 "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", 
"DELETE_INDEX", "SEARCH" ], "deprecated": false, "deprecationNote": "", 
"autowired": false, "secret": false, "description": "Operation" },
+    "operation": { "index": 4, "kind": "parameter", "displayName": 
"Operation", "group": "producer", "label": "", "required": false, "type": 
"object", "javaType": 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation",
 "enum": [ "INDEX_OR_UPDATE", "GET_BY_ID", "DELETE", "CREATE_INDEX", 
"DELETE_INDEX", "SEARCH" ], "deprecated": false, "autowired": false, "secret": 
false, "description": "Operation" },
     "socketTimeout": { "index": 5, "kind": "parameter", "displayName": "Socket 
Timeout", "group": "producer", "label": "", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 30000, "description": "Socket timeout" },
     "lazyStartProducer": { "index": 6, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produc [...]
     "enableSniffer": { "index": 7, "kind": "parameter", "displayName": "Enable 
Sniffer", "group": "advanced", "label": "advanced", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Enabling Sniffer" },
diff --git 
a/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc
 
b/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc
index 19470fcb83e..a5b73117b24 100644
--- 
a/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc
+++ 
b/components/camel-elasticsearch-rest-client/src/main/docs/elasticsearch-rest-client-component.adoc
@@ -55,7 +55,7 @@ include::partial$component-endpoint-headers.adoc[]
 
 == Elasticsearch Low level Rest Client Operations
 
-The following operations are currently supported.
+Set an endpoint URI option or exchange header with a name of `operation` and a 
value of one of the following supported options.
 
 [width="100%",cols="10%,10%,80%",options="header",]
 |===
diff --git 
a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java
 
b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java
index 9784e9a3583..c5a4623f316 100644
--- 
a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java
+++ 
b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticSearchRestClientConstant.java
@@ -33,6 +33,10 @@ public class ElasticSearchRestClientConstant {
     @Metadata(description = "The Index name", javaType = "String")
     public static final String INDEX_NAME = "INDEX_NAME";
 
+    @Metadata(description = "The operation to perform",
+              javaType = 
"org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation")
+    public static final String OPERATION = "OPERATION";
+
     public static final int SOCKET_CONNECTION_TIMEOUT = 30000;
     public static final int SNIFFER_INTERVAL_AND_FAILURE_DELAY = 60000;
 
diff --git 
a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java
 
b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java
index bff25f1b502..60a36ba8a59 100644
--- 
a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java
+++ 
b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpoint.java
@@ -26,7 +26,6 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
 import org.apache.camel.support.DefaultEndpoint;
-import org.apache.camel.util.ObjectHelper;
 import org.elasticsearch.client.RestClient;
 
 /**
@@ -42,7 +41,6 @@ public class ElasticsearchRestClientEndpoint extends 
DefaultEndpoint implements
     @Metadata(required = true)
     private String clusterName;
     @UriParam
-    @Metadata(required = true)
     ElasticsearchRestClientOperation operation;
 
     @UriParam(label = "advanced")
@@ -81,7 +79,6 @@ public class ElasticsearchRestClientEndpoint extends 
DefaultEndpoint implements
     @Override
     public void doInit() throws Exception {
         super.doInit();
-        ObjectHelper.notNull(operation, "operation");
     }
 
     public Producer createProducer() throws Exception {
diff --git 
a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientProducer.java
 
b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientProducer.java
index bb7781a12c2..dc9b82ee34b 100644
--- 
a/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientProducer.java
+++ 
b/components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientProducer.java
@@ -34,6 +34,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.camel.AsyncCallback;
+import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.InvalidPayloadException;
 import org.apache.camel.support.DefaultAsyncProducer;
@@ -57,6 +58,8 @@ import org.elasticsearch.client.RestClient;
 import org.elasticsearch.client.RestClientBuilder;
 import org.elasticsearch.client.sniff.Sniffer;
 
+import static 
org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant.OPERATION;
+
 public class ElasticsearchRestClientProducer extends DefaultAsyncProducer {
     public static final String PUT = "PUT";
     public static final String DELETE = "DELETE";
@@ -129,7 +132,8 @@ public class ElasticsearchRestClientProducer extends 
DefaultAsyncProducer {
      * Generate REST Request depending on content of Exchange
      */
     private Request generateRequest(Exchange exchange, String indexName) 
throws Exception {
-        return switch (this.endpoint.getOperation()) {
+        ElasticsearchRestClientOperation operation = 
resolveOperation(endpoint, exchange);
+        return switch (operation) {
             case CREATE_INDEX -> createIndexRequest(indexName, exchange);
             case DELETE_INDEX -> deleteIndexRequest(indexName);
             case INDEX_OR_UPDATE -> indexRequest(indexName, exchange);
@@ -177,7 +181,8 @@ public class ElasticsearchRestClientProducer extends 
DefaultAsyncProducer {
                      * Generate response Body of the Exchange, depending on 
operation Type
                      */
                     private void populateExchange(JsonObject doc) {
-                        switch (endpoint.getOperation()) {
+                        ElasticsearchRestClientOperation operation = 
resolveOperation(endpoint, exchange);
+                        switch (operation) {
                             case INDEX_OR_UPDATE -> 
exchange.getMessage().setBody(extractID(doc));
                             case CREATE_INDEX, DELETE_INDEX -> 
exchange.getMessage().setBody(extractAck(doc));
                             case DELETE -> 
exchange.getMessage().setBody(extractDeleted(doc));
@@ -440,4 +445,13 @@ public class ElasticsearchRestClientProducer extends 
DefaultAsyncProducer {
             throw new RuntimeException(e);
         }
     }
+
+    private ElasticsearchRestClientOperation 
resolveOperation(ElasticsearchRestClientEndpoint endpoint, Exchange exchange) {
+        ElasticsearchRestClientOperation operation
+                = exchange.getMessage().getHeader(OPERATION, 
endpoint.getOperation(), ElasticsearchRestClientOperation.class);
+        if (operation == null) {
+            throw new IllegalArgumentException("operation value is mandatory");
+        }
+        return operation;
+    }
 }
diff --git 
a/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
 
b/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
index 3b759d639fe..2739337598b 100644
--- 
a/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
+++ 
b/components/camel-elasticsearch-rest-client/src/test/java/org/apache/camel/component/elasticsearch/rest/client/integration/ElasticsearchRestClientComponentIT.java
@@ -22,13 +22,16 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import 
org.apache.camel.component.elasticsearch.rest.client.ElasticSearchRestClientConstant;
+import 
org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -66,7 +69,8 @@ public class ElasticsearchRestClientComponentIT extends 
ElasticsearchRestClientI
                             .handled(true) // Marks the exception as handled
                             .to("direct:errorHandler")
                         .end()
-                        
.to("elasticsearch-rest-client:my-cluster?operation=DELETE&restClient=#restClient&indexName=my_index");
+                        
.setHeader(ElasticSearchRestClientConstant.OPERATION).constant(ElasticsearchRestClientOperation.DELETE)
+                        
.to("elasticsearch-rest-client:my-cluster?restClient=#restClient&indexName=my_index");
 
                 from("direct:errorHandler")
                         .log("Handling exception: ${exception.message}")
@@ -251,4 +255,14 @@ public class ElasticsearchRestClientComponentIT extends 
ElasticsearchRestClientI
         assertTrue(ack.get());
     }
 
+    @Test
+    void operationUndefined() {
+        Exchange exchange = 
template.request("elasticsearch-rest-client:my-cluster?restClient=#restClient&indexName=my_index",
+                e -> e.getMessage().setBody("test"));
+        assertNotNull(exchange);
+
+        Exception exception = exchange.getException();
+        assertNotNull(exception);
+        assertInstanceOf(IllegalArgumentException.class, exception);
+    }
 }
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java
index 83c7535998c..7f20c6a328d 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java
@@ -109,7 +109,6 @@ public interface 
ElasticsearchRestClientEndpointBuilderFactory {
          * The option is a:
          * 
<code>org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation</code>
 type.
          * 
-         * Required: true
          * Group: producer
          * 
          * @param operation the value to set
@@ -125,7 +124,6 @@ public interface 
ElasticsearchRestClientEndpointBuilderFactory {
          * The option will be converted to a
          * 
<code>org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation</code>
 type.
          * 
-         * Required: true
          * Group: producer
          * 
          * @param operation the value to set
@@ -510,6 +508,19 @@ public interface 
ElasticsearchRestClientEndpointBuilderFactory {
         public String indexName() {
             return "INDEX_NAME";
         }
+        /**
+         * The operation to perform.
+         * 
+         * The option is a: {@code
+         * 
org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation}
 type.
+         * 
+         * Group: producer
+         * 
+         * @return the name of the header {@code OPERATION}.
+         */
+        public String oPERATION() {
+            return "OPERATION";
+        }
     }
     static ElasticsearchRestClientEndpointBuilder endpointBuilder(String 
componentName, String path) {
         class ElasticsearchRestClientEndpointBuilderImpl extends 
AbstractEndpointBuilder implements ElasticsearchRestClientEndpointBuilder, 
AdvancedElasticsearchRestClientEndpointBuilder {

Reply via email to