diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opensearch.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opensearch.json index aaed7be13a867..518cf8f81a574 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opensearch.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/opensearch.json @@ -32,13 +32,14 @@ "autowiredEnabled": { "index": 5, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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." }, "client": { "index": 6, "kind": "property", "displayName": "Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.opensearch.client.RestClient", "deprecated": false, "autowired": true, "secret": false, "description": "To use an existing configured OpenSearch client, instead of creating a client per endpoint. This allows customizing the client with specific settings." }, "enableSniffer": { "index": 7, "kind": "property", "displayName": "Enable Sniffer", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable automatically discover nodes from a running OpenSearch cluster. If this option is used in conjunction with Spring Boot, then it's managed by the Spring Boot configuration (see: Disable Sniffer in Spring Boot)." }, - "sniffAfterFailureDelay": { "index": 8, "kind": "property", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, - "snifferInterval": { "index": 9, "kind": "property", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, - "enableSSL": { "index": 10, "kind": "property", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable SSL" }, - "password": { "index": 11, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Password for authenticating" }, - "sslContextParameters": { "index": 12, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option." }, - "useGlobalSslContextParameters": { "index": 13, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "user": { "index": 14, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Basic authenticate user" } + "openSearchClient": { "index": 8, "kind": "property", "displayName": "Open Search Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.opensearch.client.opensearch.OpenSearchClient", "deprecated": false, "autowired": true, "secret": false, "description": "To use a custom configured OpenSearchClient instance" }, + "sniffAfterFailureDelay": { "index": 9, "kind": "property", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, + "snifferInterval": { "index": 10, "kind": "property", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, + "enableSSL": { "index": 11, "kind": "property", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable SSL" }, + "password": { "index": 12, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Password for authenticating" }, + "sslContextParameters": { "index": 13, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option." }, + "useGlobalSslContextParameters": { "index": 14, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, + "user": { "index": 15, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Basic authenticate user" } }, "headers": { "CamelOpensearchOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.opensearch.OpensearchOperation", "enum": [ "Index", "Update", "Bulk", "GetById", "MultiGet", "MultiSearch", "Delete", "DeleteIndex", "Search", "Exists", "Ping" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.camel.component.opensearch.OpensearchConstants#PARAM_OPERATION" }, @@ -69,10 +70,11 @@ "documentClass": { "index": 14, "kind": "parameter", "displayName": "Document Class", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.Class", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ObjectNode", "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The class to use when deserializing the documents." }, "enableSniffer": { "index": 15, "kind": "parameter", "displayName": "Enable Sniffer", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "Enable automatically discover nodes from a running OpenSearch cluster. If this option is used in conjunction with Spring Boot, then it's managed by the Spring Boot configuration (see: Disable Sniffer in Spring Boot)." }, "hostnameVerifier": { "index": 16, "kind": "parameter", "displayName": "Hostname Verifier", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "javax.net.ssl.HostnameVerifier", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The class to use as HostnameVerifier. By default there is no HostnameVerifier." }, - "sniffAfterFailureDelay": { "index": 17, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, - "snifferInterval": { "index": 18, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, - "certificatePath": { "index": 19, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The certificate that can be used to access the ES Cluster. It can be loaded by default from classpath, but you can prefix with classpath:, file:, or http: to load the resource from different systems." }, - "enableSSL": { "index": 20, "kind": "parameter", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "Enable SSL" }, - "sslContextParameters": { "index": 21, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option. This allows configuring named groups, signature schemes, cipher suites, and protocols for the TLS connection." } + "openSearchClient": { "index": 17, "kind": "parameter", "displayName": "Open Search Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.opensearch.client.opensearch.OpenSearchClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "description": "To use a custom configured OpenSearchClient instance" }, + "sniffAfterFailureDelay": { "index": 18, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, + "snifferInterval": { "index": 19, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, + "certificatePath": { "index": 20, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The certificate that can be used to access the ES Cluster. It can be loaded by default from classpath, but you can prefix with classpath:, file:, or http: to load the resource from different systems." }, + "enableSSL": { "index": 21, "kind": "parameter", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "Enable SSL" }, + "sslContextParameters": { "index": 22, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option. This allows configuring named groups, signature schemes, cipher suites, and protocols for the TLS connection." } } } diff --git a/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchComponentConfigurer.java b/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchComponentConfigurer.java index 17188936c36b9..a586671bd3d6b 100644 --- a/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchComponentConfigurer.java +++ b/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchComponentConfigurer.java @@ -38,6 +38,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "maxretrytimeout": case "maxRetryTimeout": target.setMaxRetryTimeout(property(camelContext, int.class, value)); return true; + case "opensearchclient": + case "openSearchClient": target.setOpenSearchClient(property(camelContext, org.opensearch.client.opensearch.OpenSearchClient.class, value)); return true; case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true; case "sniffafterfailuredelay": case "sniffAfterFailureDelay": target.setSniffAfterFailureDelay(property(camelContext, int.class, value)); return true; @@ -56,7 +58,7 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj @Override public String[] getAutowiredNames() { - return new String[]{"client"}; + return new String[]{"client", "openSearchClient"}; } @Override @@ -77,6 +79,8 @@ public Class getOptionType(String name, boolean ignoreCase) { case "lazyStartProducer": return boolean.class; case "maxretrytimeout": case "maxRetryTimeout": return int.class; + case "opensearchclient": + case "openSearchClient": return org.opensearch.client.opensearch.OpenSearchClient.class; case "password": return java.lang.String.class; case "sniffafterfailuredelay": case "sniffAfterFailureDelay": return int.class; @@ -112,6 +116,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "lazyStartProducer": return target.isLazyStartProducer(); case "maxretrytimeout": case "maxRetryTimeout": return target.getMaxRetryTimeout(); + case "opensearchclient": + case "openSearchClient": return target.getOpenSearchClient(); case "password": return target.getPassword(); case "sniffafterfailuredelay": case "sniffAfterFailureDelay": return target.getSniffAfterFailureDelay(); diff --git a/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointConfigurer.java b/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointConfigurer.java index 354e1b33d7ad1..2c26d1d182b02 100644 --- a/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointConfigurer.java +++ b/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointConfigurer.java @@ -45,6 +45,8 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; case "maxretrytimeout": case "maxRetryTimeout": target.getConfiguration().setMaxRetryTimeout(property(camelContext, int.class, value)); return true; + case "opensearchclient": + case "openSearchClient": target.setOpenSearchClient(property(camelContext, org.opensearch.client.opensearch.OpenSearchClient.class, value)); return true; case "operation": target.getConfiguration().setOperation(property(camelContext, org.apache.camel.component.opensearch.OpensearchOperation.class, value)); return true; case "scrollkeepalivems": case "scrollKeepAliveMs": target.getConfiguration().setScrollKeepAliveMs(property(camelContext, int.class, value)); return true; @@ -65,6 +67,11 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj } } + @Override + public String[] getAutowiredNames() { + return new String[]{"openSearchClient"}; + } + @Override public Class getOptionType(String name, boolean ignoreCase) { switch (ignoreCase ? name.toLowerCase() : name) { @@ -90,6 +97,8 @@ public Class getOptionType(String name, boolean ignoreCase) { case "lazyStartProducer": return boolean.class; case "maxretrytimeout": case "maxRetryTimeout": return int.class; + case "opensearchclient": + case "openSearchClient": return org.opensearch.client.opensearch.OpenSearchClient.class; case "operation": return org.apache.camel.component.opensearch.OpensearchOperation.class; case "scrollkeepalivems": case "scrollKeepAliveMs": return int.class; @@ -136,6 +145,8 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "lazyStartProducer": return target.isLazyStartProducer(); case "maxretrytimeout": case "maxRetryTimeout": return target.getConfiguration().getMaxRetryTimeout(); + case "opensearchclient": + case "openSearchClient": return target.getOpenSearchClient(); case "operation": return target.getConfiguration().getOperation(); case "scrollkeepalivems": case "scrollKeepAliveMs": return target.getConfiguration().getScrollKeepAliveMs(); diff --git a/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointUriFactory.java b/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointUriFactory.java index fab4bb4b3bbc4..eefb1f166d90d 100644 --- a/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointUriFactory.java +++ b/components/camel-opensearch/src/generated/java/org/apache/camel/component/opensearch/OpensearchEndpointUriFactory.java @@ -24,7 +24,7 @@ public class OpensearchEndpointUriFactory extends org.apache.camel.support.compo private static final Set ENDPOINT_IDENTITY_PROPERTY_NAMES; private static final Map MULTI_VALUE_PREFIXES; static { - Set props = new HashSet<>(22); + Set props = new HashSet<>(23); props.add("certificatePath"); props.add("clusterName"); props.add("connectionTimeout"); @@ -38,6 +38,7 @@ public class OpensearchEndpointUriFactory extends org.apache.camel.support.compo props.add("indexName"); props.add("lazyStartProducer"); props.add("maxRetryTimeout"); + props.add("openSearchClient"); props.add("operation"); props.add("scrollKeepAliveMs"); props.add("size"); diff --git a/components/camel-opensearch/src/generated/resources/META-INF/org/apache/camel/component/opensearch/opensearch.json b/components/camel-opensearch/src/generated/resources/META-INF/org/apache/camel/component/opensearch/opensearch.json index aaed7be13a867..518cf8f81a574 100644 --- a/components/camel-opensearch/src/generated/resources/META-INF/org/apache/camel/component/opensearch/opensearch.json +++ b/components/camel-opensearch/src/generated/resources/META-INF/org/apache/camel/component/opensearch/opensearch.json @@ -32,13 +32,14 @@ "autowiredEnabled": { "index": 5, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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." }, "client": { "index": 6, "kind": "property", "displayName": "Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.opensearch.client.RestClient", "deprecated": false, "autowired": true, "secret": false, "description": "To use an existing configured OpenSearch client, instead of creating a client per endpoint. This allows customizing the client with specific settings." }, "enableSniffer": { "index": 7, "kind": "property", "displayName": "Enable Sniffer", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable automatically discover nodes from a running OpenSearch cluster. If this option is used in conjunction with Spring Boot, then it's managed by the Spring Boot configuration (see: Disable Sniffer in Spring Boot)." }, - "sniffAfterFailureDelay": { "index": 8, "kind": "property", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, - "snifferInterval": { "index": 9, "kind": "property", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, - "enableSSL": { "index": 10, "kind": "property", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable SSL" }, - "password": { "index": 11, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Password for authenticating" }, - "sslContextParameters": { "index": 12, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option." }, - "useGlobalSslContextParameters": { "index": 13, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, - "user": { "index": 14, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Basic authenticate user" } + "openSearchClient": { "index": 8, "kind": "property", "displayName": "Open Search Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.opensearch.client.opensearch.OpenSearchClient", "deprecated": false, "autowired": true, "secret": false, "description": "To use a custom configured OpenSearchClient instance" }, + "sniffAfterFailureDelay": { "index": 9, "kind": "property", "displayName": "Sniff After Failure Delay", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, + "snifferInterval": { "index": 10, "kind": "property", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, + "enableSSL": { "index": 11, "kind": "property", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable SSL" }, + "password": { "index": 12, "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Password for authenticating" }, + "sslContextParameters": { "index": 13, "kind": "property", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option." }, + "useGlobalSslContextParameters": { "index": 14, "kind": "property", "displayName": "Use Global Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Enable usage of global SSL context parameters." }, + "user": { "index": 15, "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "security": "secret", "description": "Basic authenticate user" } }, "headers": { "CamelOpensearchOperation": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.opensearch.OpensearchOperation", "enum": [ "Index", "Update", "Bulk", "GetById", "MultiGet", "MultiSearch", "Delete", "DeleteIndex", "Search", "Exists", "Ping" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform", "constantName": "org.apache.camel.component.opensearch.OpensearchConstants#PARAM_OPERATION" }, @@ -69,10 +70,11 @@ "documentClass": { "index": 14, "kind": "parameter", "displayName": "Document Class", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.Class", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "ObjectNode", "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The class to use when deserializing the documents." }, "enableSniffer": { "index": 15, "kind": "parameter", "displayName": "Enable Sniffer", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "Enable automatically discover nodes from a running OpenSearch cluster. If this option is used in conjunction with Spring Boot, then it's managed by the Spring Boot configuration (see: Disable Sniffer in Spring Boot)." }, "hostnameVerifier": { "index": 16, "kind": "parameter", "displayName": "Hostname Verifier", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "javax.net.ssl.HostnameVerifier", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The class to use as HostnameVerifier. By default there is no HostnameVerifier." }, - "sniffAfterFailureDelay": { "index": 17, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, - "snifferInterval": { "index": 18, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, - "certificatePath": { "index": 19, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The certificate that can be used to access the ES Cluster. It can be loaded by default from classpath, but you can prefix with classpath:, file:, or http: to load the resource from different systems." }, - "enableSSL": { "index": 20, "kind": "parameter", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "Enable SSL" }, - "sslContextParameters": { "index": 21, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option. This allows configuring named groups, signature schemes, cipher suites, and protocols for the TLS connection." } + "openSearchClient": { "index": 17, "kind": "parameter", "displayName": "Open Search Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.opensearch.client.opensearch.OpenSearchClient", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "description": "To use a custom configured OpenSearchClient instance" }, + "sniffAfterFailureDelay": { "index": 18, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The delay of a sniff execution scheduled after a failure (in milliseconds)" }, + "snifferInterval": { "index": 19, "kind": "parameter", "displayName": "Sniffer Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 300000, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The interval between consecutive ordinary sniff executions in milliseconds. Will be honoured when sniffOnFailure is disabled or when there are no failures between consecutive sniff executions" }, + "certificatePath": { "index": 20, "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, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "The certificate that can be used to access the ES Cluster. It can be loaded by default from classpath, but you can prefix with classpath:, file:, or http: to load the resource from different systems." }, + "enableSSL": { "index": 21, "kind": "parameter", "displayName": "Enable SSL", "group": "security", "label": "security", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "Enable SSL" }, + "sslContextParameters": { "index": 22, "kind": "parameter", "displayName": "Ssl Context Parameters", "group": "security", "label": "security", "required": false, "type": "object", "javaType": "org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.opensearch.OpensearchConfiguration", "configurationField": "configuration", "description": "To configure security using SSLContextParameters. When configured, this takes precedence over the certificatePath option. This allows configuring named groups, signature schemes, cipher suites, and protocols for the TLS connection." } } } diff --git a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchComponent.java b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchComponent.java index e4e69240c5a5a..95b4db18004e1 100644 --- a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchComponent.java +++ b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchComponent.java @@ -30,6 +30,7 @@ import org.apache.camel.support.jsse.SSLContextParameters; import org.apache.hc.core5.http.HttpHost; import org.opensearch.client.RestClient; +import org.opensearch.client.opensearch.OpenSearchClient; /** * Represents the component that manages {@link OpensearchEndpoint}. @@ -39,6 +40,8 @@ public class OpensearchComponent extends DefaultComponent implements SSLContextP @Metadata(label = "advanced", autowired = true) private RestClient client; + @Metadata(label = "advanced", autowired = true) + private OpenSearchClient openSearchClient; @Metadata private String hostAddresses; @Metadata(defaultValue = "" + OpensearchConstants.DEFAULT_SOCKET_TIMEOUT) @@ -268,4 +271,17 @@ public void setUseGlobalSslContextParameters(boolean useGlobalSslContextParamete this.useGlobalSslContextParameters = useGlobalSslContextParameters; } + /** + * Returns configured OpenSearchClient instance + */ + public OpenSearchClient getOpenSearchClient() { + return openSearchClient; + } + + /** + * To use a custom configured OpenSearchClient instance + */ + public void setOpenSearchClient(OpenSearchClient openSearchClient) { + this.openSearchClient = openSearchClient; + } } diff --git a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java index f1fbc1d20125b..3c3bd2406b203 100644 --- a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java +++ b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchEndpoint.java @@ -21,10 +21,12 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.spi.EndpointServiceLocation; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.support.DefaultEndpoint; import org.opensearch.client.RestClient; +import org.opensearch.client.opensearch.OpenSearchClient; /** * Send requests to OpenSearch via Java Client API. @@ -39,11 +41,16 @@ public class OpensearchEndpoint extends DefaultEndpoint implements EndpointServi private final RestClient client; + @UriParam(label = "advanced", description = "To use a custom configured OpenSearchClient instance") + @Metadata(autowired = true) + private OpenSearchClient openSearchClient; + public OpensearchEndpoint(String uri, OpensearchComponent component, OpensearchConfiguration config, RestClient client) { super(uri, component); this.configuration = config; this.client = client; + this.openSearchClient = component.getOpenSearchClient(); } public OpensearchConfiguration getConfiguration() { @@ -73,4 +80,12 @@ public String getServiceUrl() { public String getServiceProtocol() { return "opensearch"; } + + public OpenSearchClient getOpenSearchClient() { + return openSearchClient; + } + + public void setOpenSearchClient(OpenSearchClient openSearchClient) { + this.openSearchClient = openSearchClient; + } } diff --git a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java index f3570d6cb9fb6..b388c2e7416f9 100644 --- a/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java +++ b/components/camel-opensearch/src/main/java/org/apache/camel/component/opensearch/OpensearchProducer.java @@ -91,11 +91,26 @@ class OpensearchProducer extends DefaultAsyncProducer { protected final OpensearchConfiguration configuration; private volatile RestClient client; private Sniffer sniffer; + private final OpenSearchClient openSearchClient; public OpensearchProducer(OpensearchEndpoint endpoint, OpensearchConfiguration configuration) { super(endpoint); this.configuration = configuration; this.client = endpoint.getClient(); + if (endpoint.getOpenSearchClient() == null) { + this.openSearchClient = createDefaultOpenSearchClient(); + } else { + this.openSearchClient = endpoint.getOpenSearchClient(); + } + } + + private OpenSearchClient createDefaultOpenSearchClient() { + if (configuration.isDisconnect() && client == null) { + startClient(); + } + final ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + return new OpenSearchClient(new RestClientTransport(client, new JacksonJsonpMapper(mapper))); } private OpensearchOperation resolveOperation(Exchange exchange) { @@ -154,12 +169,7 @@ private OpensearchOperation resolveOperation(Exchange exchange) { @Override public boolean process(Exchange exchange, AsyncCallback callback) { try { - if (configuration.isDisconnect() && client == null) { - startClient(); - } - final ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - OpenSearchTransport transport = new RestClientTransport(client, new JacksonJsonpMapper(mapper)); + OpenSearchTransport transport = openSearchClient._transport(); // 2. Index and type will be set by: // a. If the incoming body is already an action request // b. If the body is not an action request we will use headers if they @@ -188,6 +198,7 @@ public boolean process(Exchange exchange, AsyncCallback callback) { } Integer from = message.getHeader(OpensearchConstants.PARAM_FROM, Integer.class); + if (from == null) { message.setHeader(OpensearchConstants.PARAM_FROM, configuration.getFrom()); } diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpensearchComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpensearchComponentBuilderFactory.java index 081561ea90ac5..aa61dc73641cd 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpensearchComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/OpensearchComponentBuilderFactory.java @@ -203,6 +203,22 @@ default OpensearchComponentBuilder enableSniffer(boolean enableSniffer) { return this; } + /** + * To use a custom configured OpenSearchClient instance. + * + * The option is a: + * <code>org.opensearch.client.opensearch.OpenSearchClient</code> type. + * + * Group: advanced + * + * @param openSearchClient the value to set + * @return the dsl builder + */ + default OpensearchComponentBuilder openSearchClient(org.opensearch.client.opensearch.OpenSearchClient openSearchClient) { + doSetProperty("openSearchClient", openSearchClient); + return this; + } + /** * The delay of a sniff execution scheduled after a failure (in @@ -343,6 +359,7 @@ protected boolean setPropertyOnComponent( case "autowiredEnabled": ((OpensearchComponent) component).setAutowiredEnabled((boolean) value); return true; case "client": ((OpensearchComponent) component).setClient((org.opensearch.client.RestClient) value); return true; case "enableSniffer": ((OpensearchComponent) component).setEnableSniffer((boolean) value); return true; + case "openSearchClient": ((OpensearchComponent) component).setOpenSearchClient((org.opensearch.client.opensearch.OpenSearchClient) value); return true; case "sniffAfterFailureDelay": ((OpensearchComponent) component).setSniffAfterFailureDelay((int) value); return true; case "snifferInterval": ((OpensearchComponent) component).setSnifferInterval((int) value); return true; case "enableSSL": ((OpensearchComponent) component).setEnableSSL((boolean) value); return true; diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpensearchEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpensearchEndpointBuilderFactory.java index 28c3cd1ab9592..9b545fe22e4b3 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpensearchEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpensearchEndpointBuilderFactory.java @@ -615,6 +615,36 @@ default AdvancedOpensearchEndpointBuilder hostnameVerifier(String hostnameVerifi doSetProperty("hostnameVerifier", hostnameVerifier); return this; } + /** + * To use a custom configured OpenSearchClient instance. + * + * The option is a: + * org.opensearch.client.opensearch.OpenSearchClient type. + * + * Group: advanced + * + * @param openSearchClient the value to set + * @return the dsl builder + */ + default AdvancedOpensearchEndpointBuilder openSearchClient(org.opensearch.client.opensearch.OpenSearchClient openSearchClient) { + doSetProperty("openSearchClient", openSearchClient); + return this; + } + /** + * To use a custom configured OpenSearchClient instance. + * + * The option will be converted to a + * org.opensearch.client.opensearch.OpenSearchClient type. + * + * Group: advanced + * + * @param openSearchClient the value to set + * @return the dsl builder + */ + default AdvancedOpensearchEndpointBuilder openSearchClient(String openSearchClient) { + doSetProperty("openSearchClient", openSearchClient); + return this; + } /** * The delay of a sniff execution scheduled after a failure (in * milliseconds).