This is an automated email from the ASF dual-hosted git repository. davsclaus 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 ab6f7914ef7 CAMEL-20166: Polished ab6f7914ef7 is described below commit ab6f7914ef72aa365bacd345fd9c62b28bc82a60 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Dec 11 07:23:42 2023 +0100 CAMEL-20166: Polished --- .../components/elasticsearch-rest-client.json | 14 +- .../ElasticsearchRestClientEndpointUriFactory.java | 3 +- .../rest/client/elasticsearch-rest-client.json | 14 +- .../docs/elasticsearch-rest-client-component.adoc | 2 +- .../client/ElasticSearchRestClientConstant.java | 4 - .../client/ElasticsearchRestClientEndpoint.java | 45 +- .../client/ElasticsearchRestClientProducer.java | 84 +--- .../src/test/resources/log4j2.properties | 16 +- .../component/ComponentsBuilderFactory.java | 14 + ...ticsearchRestClientComponentBuilderFactory.java | 123 ++++++ .../src/generated/resources/metadata.json | 22 + .../builder/endpoint/EndpointBuilderFactory.java | 1 + .../camel/builder/endpoint/EndpointBuilders.java | 1 + .../builder/endpoint/StaticEndpointBuilders.java | 45 ++ ...sticsearchRestClientEndpointBuilderFactory.java | 471 +++++++++++++++++++++ 15 files changed, 731 insertions(+), 128 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 423d67dd692..23bf39a30ca 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 @@ -3,7 +3,7 @@ "kind": "component", "name": "elasticsearch-rest-client", "title": "Elasticsearch Low level Rest Client", - "description": "ElasticsearchRestClient component which allows you to interface with Elasticsearch or OpenSearch using the Java Low level Rest Client", + "description": "Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client).", "deprecated": false, "firstVersion": "4.3.0", "label": "search", @@ -28,17 +28,17 @@ "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 Adresses, separeted by comma" }, + "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": 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" }, + "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": true, "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" }, "restClient": { "index": 8, "kind": "parameter", "displayName": "Rest Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.elasticsearch.client.RestClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "description": "Rest Client of type org.elasticsearch.client.RestClient. This is only for advanced usage" }, - "sniffAfterFailureDelay": { "index": 9, "kind": "parameter", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer After Failure Delay" }, - "snifferInterval": { "index": 10, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer Interval" }, - "certificatePath": { "index": 11, "kind": "parameter", "displayName": "Certificate Path", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Certifcate Path" }, + "sniffAfterFailureDelay": { "index": 9, "kind": "parameter", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer after failure delay (in millis)" }, + "snifferInterval": { "index": 10, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer interval (in millis)" }, + "certificatePath": { "index": 11, "kind": "parameter", "displayName": "Certificate Path", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Certificate Path" }, "password": { "index": 12, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Password" }, - "user": { "index": 13, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "User" } + "user": { "index": 13, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Username" } } } diff --git a/components/camel-elasticsearch-rest-client/src/generated/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpointUriFactory.java b/components/camel-elasticsearch-rest-client/src/generated/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpointUriFactory.java index 3aa525691a4..f4c1fa1feda 100644 --- a/components/camel-elasticsearch-rest-client/src/generated/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpointUriFactory.java +++ b/components/camel-elasticsearch-rest-client/src/generated/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientEndpointUriFactory.java @@ -37,7 +37,8 @@ public class ElasticsearchRestClientEndpointUriFactory extends org.apache.camel. props.add("socketTimeout"); props.add("user"); PROPERTY_NAMES = Collections.unmodifiableSet(props); - Set<String> secretProps = new HashSet<>(2); + Set<String> secretProps = new HashSet<>(3); + secretProps.add("operation"); secretProps.add("password"); secretProps.add("user"); SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps); diff --git a/components/camel-elasticsearch-rest-client/src/generated/resources/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json b/components/camel-elasticsearch-rest-client/src/generated/resources/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json index 423d67dd692..23bf39a30ca 100644 --- a/components/camel-elasticsearch-rest-client/src/generated/resources/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json +++ b/components/camel-elasticsearch-rest-client/src/generated/resources/org/apache/camel/component/elasticsearch/rest/client/elasticsearch-rest-client.json @@ -3,7 +3,7 @@ "kind": "component", "name": "elasticsearch-rest-client", "title": "Elasticsearch Low level Rest Client", - "description": "ElasticsearchRestClient component which allows you to interface with Elasticsearch or OpenSearch using the Java Low level Rest Client", + "description": "Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client).", "deprecated": false, "firstVersion": "4.3.0", "label": "search", @@ -28,17 +28,17 @@ "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 Adresses, separeted by comma" }, + "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": 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" }, + "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": true, "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" }, "restClient": { "index": 8, "kind": "parameter", "displayName": "Rest Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.elasticsearch.client.RestClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "description": "Rest Client of type org.elasticsearch.client.RestClient. This is only for advanced usage" }, - "sniffAfterFailureDelay": { "index": 9, "kind": "parameter", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer After Failure Delay" }, - "snifferInterval": { "index": 10, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer Interval" }, - "certificatePath": { "index": 11, "kind": "parameter", "displayName": "Certificate Path", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Certifcate Path" }, + "sniffAfterFailureDelay": { "index": 9, "kind": "parameter", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer after failure delay (in millis)" }, + "snifferInterval": { "index": 10, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Sniffer interval (in millis)" }, + "certificatePath": { "index": 11, "kind": "parameter", "displayName": "Certificate Path", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "supportFileReference": true, "description": "Certificate Path" }, "password": { "index": 12, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Password" }, - "user": { "index": 13, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "User" } + "user": { "index": 13, "kind": "parameter", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Username" } } } 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 40a63725936..dd8d647b05f 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 @@ -2,7 +2,7 @@ :doctitle: Elasticsearch Low level Rest Client :shortname: elasticsearch-rest-client :artifactid: camel-elasticsearch-rest-client -:description: ElasticsearchRestClient component which allows you to interface with Elasticsearch or OpenSearch using the Java Low level Rest Client +:description: Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client). :since: 4.3 :supportlevel: Preview :tabs-sync-option: 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 cf96401e26e..9784e9a3583 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 @@ -21,20 +21,16 @@ import org.apache.camel.spi.Metadata; public class ElasticSearchRestClientConstant { @Metadata(description = " ID of the object to index or retrieve or delete", javaType = "String") - public static final String ID = "ID"; @Metadata(description = "The JSON Query to perform for search", javaType = "String") - public static final String SEARCH_QUERY = "SEARCH_QUERY"; @Metadata(description = "Advanced - The JSON Index Settings and/or Mappings Query to perform to create an index", javaType = "String") - public static final String INDEX_SETTINGS = "INDEX_SETTINGS"; @Metadata(description = "The Index name", javaType = "String") - public static final String INDEX_NAME = "INDEX_NAME"; public static final int SOCKET_CONNECTION_TIMEOUT = 30000; 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 246c1ffab2a..c39d9c49759 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 @@ -16,8 +16,6 @@ */ package org.apache.camel.component.elasticsearch.rest.client; -import java.util.List; - import org.apache.camel.Category; import org.apache.camel.Consumer; import org.apache.camel.Processor; @@ -31,9 +29,7 @@ import org.apache.camel.util.ObjectHelper; import org.elasticsearch.client.RestClient; /** - * ElasticsearchRestClient component which allows you to interface with Elasticsearch or OpenSearch using the Java Low - * level Rest Client - * <p> + * Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client). */ @UriEndpoint(firstVersion = "4.3.0", scheme = "elasticsearch-rest-client", title = "Elasticsearch Low level Rest Client", @@ -43,7 +39,7 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { @UriPath @Metadata(required = true) private String clusterName; - @UriParam + @UriParam(secret = true) ElasticsearchRestClientOperation operation; @UriParam(label = "advanced") @@ -52,13 +48,11 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { @UriParam String indexName; - @UriParam String hostAddressesList; @UriParam(defaultValue = "" + ElasticSearchRestClientConstant.SOCKET_CONNECTION_TIMEOUT) private int connectionTimeout = ElasticSearchRestClientConstant.SOCKET_CONNECTION_TIMEOUT; - @UriParam(defaultValue = "" + ElasticSearchRestClientConstant.SOCKET_CONNECTION_TIMEOUT) private int socketTimeout = ElasticSearchRestClientConstant.SOCKET_CONNECTION_TIMEOUT; @@ -72,7 +66,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { @UriParam(label = "advanced") private boolean enableSniffer; - @UriParam(label = "advanced", defaultValue = "" + ElasticSearchRestClientConstant.SNIFFER_INTERVAL_AND_FAILURE_DELAY) private int snifferInterval = ElasticSearchRestClientConstant.SNIFFER_INTERVAL_AND_FAILURE_DELAY; @UriParam(label = "advanced", defaultValue = "" + ElasticSearchRestClientConstant.SNIFFER_INTERVAL_AND_FAILURE_DELAY) @@ -109,8 +102,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Operation - * - * @return */ public ElasticsearchRestClientOperation getOperation() { return operation; @@ -122,8 +113,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Rest Client of type org.elasticsearch.client.RestClient. This is only for advanced usage - * - * @return */ public RestClient getRestClient() { return restClient; @@ -135,8 +124,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Index Name - * - * @return */ public String getIndexName() { return indexName; @@ -147,9 +134,7 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { } /** - * List of host Adresses, separeted by comma - * - * @return + * List of host Addresses, multiple hosts can be separated by comma. */ public String getHostAddressesList() { return hostAddressesList; @@ -161,8 +146,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Connection timeout - * - * @return */ public int getConnectionTimeout() { return connectionTimeout; @@ -174,8 +157,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Socket timeout - * - * @return */ public int getSocketTimeout() { return socketTimeout; @@ -186,9 +167,7 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { } /** - * User - * - * @return + * Username */ public String getUser() { return user; @@ -200,8 +179,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Password - * - * @return */ public String getPassword() { return password; @@ -212,9 +189,7 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { } /** - * Certifcate Path - * - * @return + * Certificate Path */ public String getCertificatePath() { return certificatePath; @@ -226,8 +201,6 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { /** * Enabling Sniffer - * - * @return */ public boolean isEnableSniffer() { return enableSniffer; @@ -238,9 +211,7 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { } /** - * Sniffer Interval - * - * @return + * Sniffer interval (in millis) */ public int getSnifferInterval() { return snifferInterval; @@ -251,9 +222,7 @@ public class ElasticsearchRestClientEndpoint extends DefaultEndpoint { } /** - * Sniffer After Failure Delay - * - * @return + * Sniffer after failure delay (in millis) */ public int getSniffAfterFailureDelay() { return sniffAfterFailureDelay; 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 4bf7042130d..053e734df32 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 @@ -35,8 +35,10 @@ import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.camel.AsyncCallback; import org.apache.camel.Exchange; +import org.apache.camel.InvalidPayloadException; import org.apache.camel.support.DefaultAsyncProducer; import org.apache.camel.support.ResourceHelper; +import org.apache.camel.util.IOHelper; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.json.JsonArray; import org.apache.camel.util.json.JsonObject; @@ -62,8 +64,8 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { public static final String GET = "GET"; private ElasticsearchRestClientEndpoint endpoint; - private RestClient restClient; + private boolean createdRestClient; public ElasticsearchRestClientProducer(ElasticsearchRestClientEndpoint endpoint) { super(endpoint); @@ -93,28 +95,34 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { } Request request = generateRequest(exchange, indexName); - performRequest(exchange, callback, request); } @Override protected void doStart() throws Exception { - // create RestClient + super.doStart(); + restClient = this.endpoint.getRestClient(); if (restClient == null) { - createClient(); + restClient = createClient(); + createdRestClient = true; } + } + @Override + protected void doStop() throws Exception { + super.doStop(); + + if (createdRestClient && restClient != null) { + IOHelper.close(restClient); + restClient = null; + } } /** * Generate REST Request depending on content of Exchange - * - * @param exchange - * @param indexName - * @return */ - private Request generateRequest(Exchange exchange, String indexName) { + private Request generateRequest(Exchange exchange, String indexName) throws Exception { return switch (this.endpoint.getOperation()) { case CREATE_INDEX -> createIndexRequest(indexName, exchange); case DELETE_INDEX -> deleteIndexRequest(indexName); @@ -127,10 +135,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Async request to Elasticsearch or equivalent Server - * - * @param exchange - * @param callback - * @param request */ private void performRequest( Exchange exchange, AsyncCallback callback, Request request) { @@ -165,8 +169,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Generate response Body of the Exchange, depending on operation Type - * - * @param doc */ private void populateExchange(JsonObject doc) { switch (endpoint.getOperation()) { @@ -188,9 +190,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /*** * Generate the Request for operation CREATE_INDEX - * - * @param indexName - * @return */ private Request createIndexRequest(String indexName, Exchange exchange) { var endpoint = String.format("/%s", indexName); @@ -205,29 +204,17 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /*** * Generate the Request for operation DELETE_INDEX - * - * @param indexName - * @return */ private Request deleteIndexRequest(String indexName) { var endpoint = String.format("/%s", indexName); return new Request(DELETE, endpoint); - } /** * Generate the Request for operation INDEX_OR_UPDATE - * - * @param indexName - * @param exchange - * @return */ - private Request indexRequest(String indexName, Exchange exchange) { - var jsonBody = exchange.getMessage().getBody(String.class); - if (jsonBody == null) { - throw new IllegalArgumentException( - "Document is mandatory"); - } + private Request indexRequest(String indexName, Exchange exchange) throws InvalidPayloadException { + var jsonBody = exchange.getMessage().getMandatoryBody(String.class); var endpoint = String.format("/%s/_doc", indexName); @@ -245,10 +232,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Generate the Request for operation GET_BY_ID - * - * @param indexName - * @param exchange - * @return */ private Request getById(String indexName, Exchange exchange) { var id = exchange.getMessage().getBody(String.class); @@ -265,10 +248,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Generate the Request for DELETE - * - * @param indexName - * @param exchange - * @return */ private Request delete(String indexName, Exchange exchange) { var id = exchange.getMessage().getBody(String.class); @@ -285,10 +264,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Generate the Request for operation SEARCH - * - * @param indexName - * @param exchange - * @return */ private Request search(String indexName, Exchange exchange) { var endpoint = String.format("/%s/_search", indexName); @@ -313,9 +288,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * creates an Elasticsearch Json Query based on matches - * - * @param queryParameters - * @return */ private String createQueryFromMap(Map<String, String> queryParameters) { ObjectMapper objectMapper = new ObjectMapper(); @@ -339,8 +311,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /*** * Extract ACK value from Response Body from API server - * - * @return */ boolean extractAck(JsonObject doc) { return doc.getBoolean("acknowledged"); @@ -348,9 +318,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Extract Deleted from Response Body from API Server - * - * @param doc - * @return */ boolean extractDeleted(JsonObject doc) { return "deleted".equals(doc.getString("result")); @@ -358,9 +325,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Extract ID value from Response Body from API server - * - * @param doc - * @return */ String extractID(JsonObject doc) { return doc.getString("_id"); @@ -368,9 +332,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Extract Document from response - * - * @param doc - * @return */ String extractDocument(JsonObject doc) { // check if document exists @@ -387,9 +348,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Extract Document from response - * - * @param doc - * @return */ String extractSearch(JsonObject doc) { Map<String, Object> hitsLevel1 = doc.getMap("hits"); @@ -404,9 +362,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { /** * Creates Rest Client from information in the Endpoint - * - * @return - * @throws Exception */ private RestClient createClient() throws Exception { final RestClientBuilder builder = RestClient.builder(getHttpHosts()); @@ -430,7 +385,6 @@ public class ElasticsearchRestClientProducer extends DefaultAsyncProducer { // initiate Sniffer if (this.endpoint.isEnableSniffer()) { - Sniffer.builder(restClient) .setSniffIntervalMillis(this.endpoint.getSnifferInterval()) .setSniffAfterFailureDelayMillis(this.endpoint.getSniffAfterFailureDelay()) diff --git a/components/camel-elasticsearch-rest-client/src/test/resources/log4j2.properties b/components/camel-elasticsearch-rest-client/src/test/resources/log4j2.properties index d9f0508a6ff..c0ebd070182 100644 --- a/components/camel-elasticsearch-rest-client/src/test/resources/log4j2.properties +++ b/components/camel-elasticsearch-rest-client/src/test/resources/log4j2.properties @@ -15,9 +15,15 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -appender.out.type = Console -appender.out.name = out -appender.out.layout.type = PatternLayout -appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n +appender.file.type = File +appender.file.name = file +appender.file.fileName = target/camel-elasticsearch-rest-client-test.log +appender.file.layout.type = PatternLayout +appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.stdout.type = Console +appender.stdout.name = stdout +appender.stdout.layout.type = PatternLayout +appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n rootLogger.level = INFO -rootLogger.appenderRef.out.ref = out +rootLogger.appenderRef.file.ref = file + diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index f419b69c24a..67c0fa65e68 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -1259,6 +1259,20 @@ public interface ComponentsBuilderFactory { static org.apache.camel.builder.component.dsl.ElasticsearchComponentBuilderFactory.ElasticsearchComponentBuilder elasticsearch() { return org.apache.camel.builder.component.dsl.ElasticsearchComponentBuilderFactory.elasticsearch(); } + /** + * Elasticsearch Low level Rest Client (camel-elasticsearch-rest-client) + * Perform queries and other operations on Elasticsearch or OpenSearch (uses + * low-level client). + * + * Category: search + * Since: 4.3 + * Maven coordinates: org.apache.camel:camel-elasticsearch-rest-client + * + * @return the dsl builder + */ + static org.apache.camel.builder.component.dsl.ElasticsearchRestClientComponentBuilderFactory.ElasticsearchRestClientComponentBuilder elasticsearchRestClient() { + return org.apache.camel.builder.component.dsl.ElasticsearchRestClientComponentBuilderFactory.elasticsearchRestClient(); + } /** * Etcd v3 (camel-etcd3) * Get, set, delete or watch keys in etcd key-value store. diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElasticsearchRestClientComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElasticsearchRestClientComponentBuilderFactory.java new file mode 100644 index 00000000000..fa2b84f8813 --- /dev/null +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ElasticsearchRestClientComponentBuilderFactory.java @@ -0,0 +1,123 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.builder.component.dsl; + +import javax.annotation.processing.Generated; +import org.apache.camel.Component; +import org.apache.camel.builder.component.AbstractComponentBuilder; +import org.apache.camel.builder.component.ComponentBuilder; +import org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientComponent; + +/** + * Perform queries and other operations on Elasticsearch or OpenSearch (uses + * low-level client). + * + * Generated by camel-package-maven-plugin - do not edit this file! + */ +@Generated("org.apache.camel.maven.packaging.ComponentDslMojo") +public interface ElasticsearchRestClientComponentBuilderFactory { + + /** + * Elasticsearch Low level Rest Client (camel-elasticsearch-rest-client) + * Perform queries and other operations on Elasticsearch or OpenSearch (uses + * low-level client). + * + * Category: search + * Since: 4.3 + * Maven coordinates: org.apache.camel:camel-elasticsearch-rest-client + * + * @return the dsl builder + */ + static ElasticsearchRestClientComponentBuilder elasticsearchRestClient() { + return new ElasticsearchRestClientComponentBuilderImpl(); + } + + /** + * Builder for the Elasticsearch Low level Rest Client component. + */ + interface ElasticsearchRestClientComponentBuilder + extends + ComponentBuilder<ElasticsearchRestClientComponent> { + /** + * 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 producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientComponentBuilder lazyStartProducer( + boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * Whether autowiring is enabled. This is used for automatic autowiring + * options (the option must be marked as autowired) by looking up in the + * registry to find if there is a single instance of matching type, + * which then gets configured on the component. This can be used for + * automatic configuring JDBC data sources, JMS connection factories, + * AWS Clients, etc. + * + * The option is a: <code>boolean</code> type. + * + * Default: true + * Group: advanced + * + * @param autowiredEnabled the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientComponentBuilder autowiredEnabled( + boolean autowiredEnabled) { + doSetProperty("autowiredEnabled", autowiredEnabled); + return this; + } + } + + class ElasticsearchRestClientComponentBuilderImpl + extends + AbstractComponentBuilder<ElasticsearchRestClientComponent> + implements + ElasticsearchRestClientComponentBuilder { + @Override + protected ElasticsearchRestClientComponent buildConcreteComponent() { + return new ElasticsearchRestClientComponent(); + } + @Override + protected boolean setPropertyOnComponent( + Component component, + String name, + Object value) { + switch (name) { + case "lazyStartProducer": ((ElasticsearchRestClientComponent) component).setLazyStartProducer((boolean) value); return true; + case "autowiredEnabled": ((ElasticsearchRestClientComponent) component).setAutowiredEnabled((boolean) value); return true; + default: return false; + } + } + } +} \ No newline at end of file diff --git a/dsl/camel-componentdsl/src/generated/resources/metadata.json b/dsl/camel-componentdsl/src/generated/resources/metadata.json index fa05780da7f..e0f91340a49 100644 --- a/dsl/camel-componentdsl/src/generated/resources/metadata.json +++ b/dsl/camel-componentdsl/src/generated/resources/metadata.json @@ -2036,6 +2036,28 @@ "producerOnly": true, "lenientProperties": false }, + "ElasticsearchRestClientComponentBuilderFactory": { + "kind": "component", + "name": "elasticsearch-rest-client", + "title": "Elasticsearch Low level Rest Client", + "description": "Perform queries and other operations on Elasticsearch or OpenSearch (uses low-level client).", + "deprecated": false, + "firstVersion": "4.3.0", + "label": "search", + "javaType": "org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-elasticsearch-rest-client", + "version": "4.3.0-SNAPSHOT", + "scheme": "elasticsearch-rest-client", + "extendsScheme": "", + "syntax": "elasticsearch-rest-client:clusterName", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false + }, "Etcd3ComponentBuilderFactory": { "kind": "component", "name": "etcd3", diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java index 83664133d54..6253eacabd7 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java @@ -96,6 +96,7 @@ public interface EndpointBuilderFactory org.apache.camel.builder.endpoint.dsl.EKS2EndpointBuilderFactory.EKS2Builders, org.apache.camel.builder.endpoint.dsl.EhcacheEndpointBuilderFactory.EhcacheBuilders, org.apache.camel.builder.endpoint.dsl.ElasticsearchEndpointBuilderFactory.ElasticsearchBuilders, + org.apache.camel.builder.endpoint.dsl.ElasticsearchRestClientEndpointBuilderFactory.ElasticsearchRestClientBuilders, org.apache.camel.builder.endpoint.dsl.Etcd3EndpointBuilderFactory.Etcd3Builders, org.apache.camel.builder.endpoint.dsl.EventEndpointBuilderFactory.EventBuilders, org.apache.camel.builder.endpoint.dsl.EventHubsEndpointBuilderFactory.EventHubsBuilders, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java index 497aa5f1a81..6853aeae15e 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java @@ -93,6 +93,7 @@ public interface EndpointBuilders org.apache.camel.builder.endpoint.dsl.EKS2EndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.EhcacheEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.ElasticsearchEndpointBuilderFactory, + org.apache.camel.builder.endpoint.dsl.ElasticsearchRestClientEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.Etcd3EndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.EventEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.EventHubsEndpointBuilderFactory, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index ac2197a8196..ae31400d075 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -4326,6 +4326,51 @@ public class StaticEndpointBuilders { String path) { return org.apache.camel.builder.endpoint.dsl.ElasticsearchEndpointBuilderFactory.endpointBuilder(componentName, path); } + /** + * Elasticsearch Low level Rest Client (camel-elasticsearch-rest-client) + * Perform queries and other operations on Elasticsearch or OpenSearch (uses + * low-level client). + * + * Category: search + * Since: 4.3 + * Maven coordinates: org.apache.camel:camel-elasticsearch-rest-client + * + * Syntax: <code>elasticsearch-rest-client:clusterName</code> + * + * Path parameter: clusterName (required) + * Cluster Name + * + * @param path clusterName + * @return the dsl builder + */ + public static org.apache.camel.builder.endpoint.dsl.ElasticsearchRestClientEndpointBuilderFactory.ElasticsearchRestClientEndpointBuilder elasticsearchRestClient( + String path) { + return org.apache.camel.builder.endpoint.dsl.ElasticsearchRestClientEndpointBuilderFactory.endpointBuilder("elasticsearch-rest-client", path); + } + /** + * Elasticsearch Low level Rest Client (camel-elasticsearch-rest-client) + * Perform queries and other operations on Elasticsearch or OpenSearch (uses + * low-level client). + * + * Category: search + * Since: 4.3 + * Maven coordinates: org.apache.camel:camel-elasticsearch-rest-client + * + * Syntax: <code>elasticsearch-rest-client:clusterName</code> + * + * Path parameter: clusterName (required) + * Cluster Name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path clusterName + * @return the dsl builder + */ + public static org.apache.camel.builder.endpoint.dsl.ElasticsearchRestClientEndpointBuilderFactory.ElasticsearchRestClientEndpointBuilder elasticsearchRestClient( + String componentName, + String path) { + return org.apache.camel.builder.endpoint.dsl.ElasticsearchRestClientEndpointBuilderFactory.endpointBuilder(componentName, path); + } /** * Etcd v3 (camel-etcd3) * Get, set, delete or watch keys in etcd key-value store. 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 new file mode 100644 index 00000000000..e45cb7b92e3 --- /dev/null +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ElasticsearchRestClientEndpointBuilderFactory.java @@ -0,0 +1,471 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.builder.endpoint.dsl; + +import java.util.*; +import java.util.concurrent.*; +import java.util.function.*; +import java.util.stream.*; +import javax.annotation.processing.Generated; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; + +/** + * Perform queries and other operations on Elasticsearch or OpenSearch (uses + * low-level client). + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface ElasticsearchRestClientEndpointBuilderFactory { + + + /** + * Builder for endpoint for the Elasticsearch Low level Rest Client + * component. + */ + public interface ElasticsearchRestClientEndpointBuilder + extends + EndpointProducerBuilder { + default AdvancedElasticsearchRestClientEndpointBuilder advanced() { + return (AdvancedElasticsearchRestClientEndpointBuilder) this; + } + /** + * Connection timeout. + * + * The option is a: <code>int</code> type. + * + * Default: 30000 + * Group: producer + * + * @param connectionTimeout the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder connectionTimeout( + int connectionTimeout) { + doSetProperty("connectionTimeout", connectionTimeout); + return this; + } + /** + * Connection timeout. + * + * The option will be converted to a <code>int</code> type. + * + * Default: 30000 + * Group: producer + * + * @param connectionTimeout the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder connectionTimeout( + String connectionTimeout) { + doSetProperty("connectionTimeout", connectionTimeout); + return this; + } + /** + * List of host Addresses, multiple hosts can be separated by comma. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param hostAddressesList the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder hostAddressesList( + String hostAddressesList) { + doSetProperty("hostAddressesList", hostAddressesList); + return this; + } + /** + * Index Name. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param indexName the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder indexName( + String indexName) { + doSetProperty("indexName", indexName); + return this; + } + /** + * Operation. + * + * The option is a: + * <code>org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation</code> type. + * + * Group: producer + * + * @param operation the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder operation( + org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation operation) { + doSetProperty("operation", operation); + return this; + } + /** + * Operation. + * + * The option will be converted to a + * <code>org.apache.camel.component.elasticsearch.rest.client.ElasticsearchRestClientOperation</code> type. + * + * Group: producer + * + * @param operation the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder operation( + String operation) { + doSetProperty("operation", operation); + return this; + } + /** + * Socket timeout. + * + * The option is a: <code>int</code> type. + * + * Default: 30000 + * Group: producer + * + * @param socketTimeout the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder socketTimeout( + int socketTimeout) { + doSetProperty("socketTimeout", socketTimeout); + return this; + } + /** + * Socket timeout. + * + * The option will be converted to a <code>int</code> type. + * + * Default: 30000 + * Group: producer + * + * @param socketTimeout the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder socketTimeout( + String socketTimeout) { + doSetProperty("socketTimeout", socketTimeout); + return this; + } + /** + * Certificate Path. + * + * This option can also be loaded from an existing file, by prefixing + * with file: or classpath: followed by the location of the file. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param certificatePath the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder certificatePath( + String certificatePath) { + doSetProperty("certificatePath", certificatePath); + return this; + } + /** + * Password. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param password the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder password(String password) { + doSetProperty("password", password); + return this; + } + /** + * Username. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: security + * + * @param user the value to set + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder user(String user) { + doSetProperty("user", user); + return this; + } + } + + /** + * Advanced builder for endpoint for the Elasticsearch Low level Rest Client + * component. + */ + public interface AdvancedElasticsearchRestClientEndpointBuilder + extends + EndpointProducerBuilder { + default ElasticsearchRestClientEndpointBuilder basic() { + return (ElasticsearchRestClientEndpointBuilder) this; + } + /** + * 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 producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder lazyStartProducer( + boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * 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 producer may otherwise fail during + * starting and cause the route to fail being started. By deferring this + * startup to be lazy then the startup failure can be handled during + * routing messages via Camel's routing error handlers. Beware that when + * the first message is processed then creating and starting the + * producer may take a little time and prolong the total processing time + * of the processing. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder lazyStartProducer( + String lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * Enabling Sniffer. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: advanced + * + * @param enableSniffer the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder enableSniffer( + boolean enableSniffer) { + doSetProperty("enableSniffer", enableSniffer); + return this; + } + /** + * Enabling Sniffer. + * + * The option will be converted to a <code>boolean</code> + * type. + * + * Default: false + * Group: advanced + * + * @param enableSniffer the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder enableSniffer( + String enableSniffer) { + doSetProperty("enableSniffer", enableSniffer); + return this; + } + /** + * Rest Client of type org.elasticsearch.client.RestClient. This is only + * for advanced usage. + * + * The option is a: + * <code>org.elasticsearch.client.RestClient</code> type. + * + * Group: advanced + * + * @param restClient the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder restClient( + org.elasticsearch.client.RestClient restClient) { + doSetProperty("restClient", restClient); + return this; + } + /** + * Rest Client of type org.elasticsearch.client.RestClient. This is only + * for advanced usage. + * + * The option will be converted to a + * <code>org.elasticsearch.client.RestClient</code> type. + * + * Group: advanced + * + * @param restClient the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder restClient( + String restClient) { + doSetProperty("restClient", restClient); + return this; + } + /** + * Sniffer after failure delay (in millis). + * + * The option is a: <code>int</code> type. + * + * Default: 60000 + * Group: advanced + * + * @param sniffAfterFailureDelay the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder sniffAfterFailureDelay( + int sniffAfterFailureDelay) { + doSetProperty("sniffAfterFailureDelay", sniffAfterFailureDelay); + return this; + } + /** + * Sniffer after failure delay (in millis). + * + * The option will be converted to a <code>int</code> type. + * + * Default: 60000 + * Group: advanced + * + * @param sniffAfterFailureDelay the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder sniffAfterFailureDelay( + String sniffAfterFailureDelay) { + doSetProperty("sniffAfterFailureDelay", sniffAfterFailureDelay); + return this; + } + /** + * Sniffer interval (in millis). + * + * The option is a: <code>int</code> type. + * + * Default: 60000 + * Group: advanced + * + * @param snifferInterval the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder snifferInterval( + int snifferInterval) { + doSetProperty("snifferInterval", snifferInterval); + return this; + } + /** + * Sniffer interval (in millis). + * + * The option will be converted to a <code>int</code> type. + * + * Default: 60000 + * Group: advanced + * + * @param snifferInterval the value to set + * @return the dsl builder + */ + default AdvancedElasticsearchRestClientEndpointBuilder snifferInterval( + String snifferInterval) { + doSetProperty("snifferInterval", snifferInterval); + return this; + } + } + + public interface ElasticsearchRestClientBuilders { + /** + * Elasticsearch Low level Rest Client (camel-elasticsearch-rest-client) + * Perform queries and other operations on Elasticsearch or OpenSearch + * (uses low-level client). + * + * Category: search + * Since: 4.3 + * Maven coordinates: org.apache.camel:camel-elasticsearch-rest-client + * + * Syntax: <code>elasticsearch-rest-client:clusterName</code> + * + * Path parameter: clusterName (required) + * Cluster Name + * + * @param path clusterName + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder elasticsearchRestClient( + String path) { + return ElasticsearchRestClientEndpointBuilderFactory.endpointBuilder("elasticsearch-rest-client", path); + } + /** + * Elasticsearch Low level Rest Client (camel-elasticsearch-rest-client) + * Perform queries and other operations on Elasticsearch or OpenSearch + * (uses low-level client). + * + * Category: search + * Since: 4.3 + * Maven coordinates: org.apache.camel:camel-elasticsearch-rest-client + * + * Syntax: <code>elasticsearch-rest-client:clusterName</code> + * + * Path parameter: clusterName (required) + * Cluster Name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path clusterName + * @return the dsl builder + */ + default ElasticsearchRestClientEndpointBuilder elasticsearchRestClient( + String componentName, + String path) { + return ElasticsearchRestClientEndpointBuilderFactory.endpointBuilder(componentName, path); + } + } + static ElasticsearchRestClientEndpointBuilder endpointBuilder( + String componentName, + String path) { + class ElasticsearchRestClientEndpointBuilderImpl extends AbstractEndpointBuilder implements ElasticsearchRestClientEndpointBuilder, AdvancedElasticsearchRestClientEndpointBuilder { + public ElasticsearchRestClientEndpointBuilderImpl(String path) { + super(componentName, path); + } + } + return new ElasticsearchRestClientEndpointBuilderImpl(path); + } +} \ No newline at end of file