This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new b84db97df62 CAMEL-20901: Add an option to provide a custom Vertx
instance to ArangoDB
b84db97df62 is described below
commit b84db97df627b924e635f3212e4117aa18c8ed01
Author: James Netherton <[email protected]>
AuthorDate: Mon Jun 24 07:47:34 2024 +0100
CAMEL-20901: Add an option to provide a custom Vertx instance to ArangoDB
---
.../apache/camel/catalog/components/arangodb.json | 10 +-
.../arangodb/ArangoDbComponentConfigurer.java | 5 +-
.../arangodb/ArangoDbEndpointConfigurer.java | 3 +
.../arangodb/ArangoDbEndpointUriFactory.java | 3 +-
.../apache/camel/component/arangodb/arangodb.json | 10 +-
.../component/arangodb/ArangoDbComponent.java | 15 +++
.../camel/component/arangodb/ArangoDbEndpoint.java | 20 +++-
.../arangodb/integration/ArangoCustomVertxIT.java | 110 +++++++++++++++++++++
.../dsl/ArangodbComponentBuilderFactory.java | 16 +++
.../dsl/ArangoDbEndpointBuilderFactory.java | 29 ++++++
.../camel/kotlin/components/ArangodbUriDsl.kt | 7 ++
11 files changed, 217 insertions(+), 11 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
index 999eeab6954..2345a553778 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/arangodb.json
@@ -34,8 +34,9 @@
"vertexCollection": { "index": 8, "kind": "property", "displayName":
"Vertex Collection", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Collection name of
vertices, when using ArangoDb as a Graph Database. Set the vertexCollect [...]
"arangoDB": { "index": 9, "kind": "property", "displayName": "Arango DB",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": true,
"secret": false, "description": "To use an existing ArangDB client." },
"autowiredEnabled": { "index": 10, "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 [...]
- "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, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
- "user": { "index": 12, "kind": "property", "displayName": "User", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
+ "vertx": { "index": 11, "kind": "property", "displayName": "Vertx",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "io.vertx.core.Vertx", "deprecated": false, "autowired": true,
"secret": false, "description": "To use an existing Vertx in the ArangoDB
client." },
+ "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, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
+ "user": { "index": 13, "kind": "property", "displayName": "User", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
},
"headers": {
"CamelArangoDbMultiUpdate": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType":
"java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "defaultValue": "false", "description": "Indicates if
there are multiple documents to update. If set to true, the body of the message
must be a Collection of documents to update.", "constantName":
"org.apache.camel.component.arangodb.ArangoDb [...]
@@ -58,7 +59,8 @@
"vertexCollection": { "index": 7, "kind": "parameter", "displayName":
"Vertex Collection", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Collection name of
vertices, when using ArangoDb as a Graph Database. Set the vertexCollec [...]
"lazyStartProducer": { "index": 8, "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 [...]
"arangoDB": { "index": 9, "kind": "parameter", "displayName": "Arango DB",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": false,
"secret": false, "description": "To use an existing ArangDB client." },
- "password": { "index": 10, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
- "user": { "index": 11, "kind": "parameter", "displayName": "User",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
+ "vertx": { "index": 10, "kind": "parameter", "displayName": "Vertx",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "io.vertx.core.Vertx", "deprecated": false, "autowired": false,
"secret": false, "description": "To use an existing Vertx instance in the
ArangoDB client." },
+ "password": { "index": 11, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
+ "user": { "index": 12, "kind": "parameter", "displayName": "User",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
}
}
diff --git
a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
index 0eaa973210f..abd6679698c 100644
---
a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
+++
b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbComponentConfigurer.java
@@ -49,13 +49,14 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
case "user":
getOrCreateConfiguration(target).setUser(property(camelContext,
java.lang.String.class, value)); return true;
case "vertexcollection":
case "vertexCollection":
getOrCreateConfiguration(target).setVertexCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "vertx": target.setVertx(property(camelContext,
io.vertx.core.Vertx.class, value)); return true;
default: return false;
}
}
@Override
public String[] getAutowiredNames() {
- return new String[]{"arangoDB"};
+ return new String[]{"arangoDB", "vertx"};
}
@Override
@@ -80,6 +81,7 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
case "user": return java.lang.String.class;
case "vertexcollection":
case "vertexCollection": return java.lang.String.class;
+ case "vertx": return io.vertx.core.Vertx.class;
default: return null;
}
}
@@ -107,6 +109,7 @@ public class ArangoDbComponentConfigurer extends
PropertyConfigurerSupport imple
case "user": return getOrCreateConfiguration(target).getUser();
case "vertexcollection":
case "vertexCollection": return
getOrCreateConfiguration(target).getVertexCollection();
+ case "vertx": return target.getVertx();
default: return null;
}
}
diff --git
a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
index a3e234620a9..a89f14fa098 100644
---
a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
+++
b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointConfigurer.java
@@ -39,6 +39,7 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
case "user": target.getConfiguration().setUser(property(camelContext,
java.lang.String.class, value)); return true;
case "vertexcollection":
case "vertexCollection":
target.getConfiguration().setVertexCollection(property(camelContext,
java.lang.String.class, value)); return true;
+ case "vertx": target.setVertx(property(camelContext,
io.vertx.core.Vertx.class, value)); return true;
default: return false;
}
}
@@ -62,6 +63,7 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
case "user": return java.lang.String.class;
case "vertexcollection":
case "vertexCollection": return java.lang.String.class;
+ case "vertx": return io.vertx.core.Vertx.class;
default: return null;
}
}
@@ -86,6 +88,7 @@ public class ArangoDbEndpointConfigurer extends
PropertyConfigurerSupport implem
case "user": return target.getConfiguration().getUser();
case "vertexcollection":
case "vertexCollection": return
target.getConfiguration().getVertexCollection();
+ case "vertx": return target.getVertx();
default: return null;
}
}
diff --git
a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
index 7e18ee057b3..0b7f2e26e4c 100644
---
a/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
+++
b/components/camel-arangodb/src/generated/java/org/apache/camel/component/arangodb/ArangoDbEndpointUriFactory.java
@@ -23,7 +23,7 @@ public class ArangoDbEndpointUriFactory extends
org.apache.camel.support.compone
private static final Set<String> SECRET_PROPERTY_NAMES;
private static final Set<String> MULTI_VALUE_PREFIXES;
static {
- Set<String> props = new HashSet<>(12);
+ Set<String> props = new HashSet<>(13);
props.add("arangoDB");
props.add("database");
props.add("documentCollection");
@@ -36,6 +36,7 @@ public class ArangoDbEndpointUriFactory extends
org.apache.camel.support.compone
props.add("port");
props.add("user");
props.add("vertexCollection");
+ props.add("vertx");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
Set<String> secretProps = new HashSet<>(2);
secretProps.add("password");
diff --git
a/components/camel-arangodb/src/generated/resources/META-INF/org/apache/camel/component/arangodb/arangodb.json
b/components/camel-arangodb/src/generated/resources/META-INF/org/apache/camel/component/arangodb/arangodb.json
index 999eeab6954..2345a553778 100644
---
a/components/camel-arangodb/src/generated/resources/META-INF/org/apache/camel/component/arangodb/arangodb.json
+++
b/components/camel-arangodb/src/generated/resources/META-INF/org/apache/camel/component/arangodb/arangodb.json
@@ -34,8 +34,9 @@
"vertexCollection": { "index": 8, "kind": "property", "displayName":
"Vertex Collection", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Collection name of
vertices, when using ArangoDb as a Graph Database. Set the vertexCollect [...]
"arangoDB": { "index": 9, "kind": "property", "displayName": "Arango DB",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": true,
"secret": false, "description": "To use an existing ArangDB client." },
"autowiredEnabled": { "index": 10, "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 [...]
- "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, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
- "user": { "index": 12, "kind": "property", "displayName": "User", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
+ "vertx": { "index": 11, "kind": "property", "displayName": "Vertx",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "io.vertx.core.Vertx", "deprecated": false, "autowired": true,
"secret": false, "description": "To use an existing Vertx in the ArangoDB
client." },
+ "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, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
+ "user": { "index": 13, "kind": "property", "displayName": "User", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
},
"headers": {
"CamelArangoDbMultiUpdate": { "index": 0, "kind": "header", "displayName":
"", "group": "producer", "label": "", "required": false, "javaType":
"java.lang.Boolean", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "defaultValue": "false", "description": "Indicates if
there are multiple documents to update. If set to true, the body of the message
must be a Collection of documents to update.", "constantName":
"org.apache.camel.component.arangodb.ArangoDb [...]
@@ -58,7 +59,8 @@
"vertexCollection": { "index": 7, "kind": "parameter", "displayName":
"Vertex Collection", "group": "producer", "label": "producer", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "Collection name of
vertices, when using ArangoDb as a Graph Database. Set the vertexCollec [...]
"lazyStartProducer": { "index": 8, "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 [...]
"arangoDB": { "index": 9, "kind": "parameter", "displayName": "Arango DB",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "com.arangodb.ArangoDB", "deprecated": false, "autowired": false,
"secret": false, "description": "To use an existing ArangDB client." },
- "password": { "index": 10, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
- "user": { "index": 11, "kind": "parameter", "displayName": "User",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
+ "vertx": { "index": 10, "kind": "parameter", "displayName": "Vertx",
"group": "advanced", "label": "advanced", "required": false, "type": "object",
"javaType": "io.vertx.core.Vertx", "deprecated": false, "autowired": false,
"secret": false, "description": "To use an existing Vertx instance in the
ArangoDB client." },
+ "password": { "index": 11, "kind": "parameter", "displayName": "Password",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB password. If
user and password are default, this field is Optional." },
+ "user": { "index": 12, "kind": "parameter", "displayName": "User",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "configurationClass":
"org.apache.camel.component.arangodb.ArangoDbConfiguration",
"configurationField": "configuration", "description": "ArangoDB user. If user
and password are default, this field is Optional." }
}
}
diff --git
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
index bd83e9027c0..f9b769d8af4 100644
---
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
+++
b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbComponent.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.arangodb;
import java.util.Map;
import com.arangodb.ArangoDB;
+import io.vertx.core.Vertx;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.spi.Metadata;
@@ -31,6 +32,8 @@ public class ArangoDbComponent extends DefaultComponent {
@Metadata(label = "advanced", autowired = true)
private ArangoDB arangoDB;
+ @Metadata(label = "advanced", autowired = true)
+ private Vertx vertx;
@Metadata
private ArangoDbConfiguration configuration = new ArangoDbConfiguration();
@@ -52,6 +55,7 @@ public class ArangoDbComponent extends DefaultComponent {
configurationClone.setDatabase(remaining);
ArangoDbEndpoint endpoint = new ArangoDbEndpoint(uri, this,
configurationClone);
endpoint.setArangoDB(arangoDB);
+ endpoint.setVertx(vertx);
setProperties(endpoint, parameters);
return endpoint;
}
@@ -67,6 +71,17 @@ public class ArangoDbComponent extends DefaultComponent {
this.arangoDB = arangoDB;
}
+ public Vertx getVertx() {
+ return vertx;
+ }
+
+ /**
+ * To use an existing Vertx in the ArangoDB client.
+ */
+ public void setVertx(Vertx vertx) {
+ this.vertx = vertx;
+ }
+
public ArangoDbConfiguration getConfiguration() {
return configuration;
}
diff --git
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
index ef0fb66cf77..7b5128479b0 100644
---
a/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
+++
b/components/camel-arangodb/src/main/java/org/apache/camel/component/arangodb/ArangoDbEndpoint.java
@@ -19,6 +19,8 @@ package org.apache.camel.component.arangodb;
import java.util.Map;
import com.arangodb.ArangoDB;
+import com.arangodb.http.HttpProtocolConfig;
+import io.vertx.core.Vertx;
import org.apache.camel.Category;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
@@ -45,6 +47,8 @@ public class ArangoDbEndpoint extends DefaultEndpoint
implements EndpointService
private ArangoDbConfiguration configuration;
@UriParam(label = "advanced")
private ArangoDB arangoDB;
+ @UriParam(label = "advanced")
+ private Vertx vertx;
public ArangoDbEndpoint() {
}
@@ -91,6 +95,17 @@ public class ArangoDbEndpoint extends DefaultEndpoint
implements EndpointService
this.arangoDB = arangoDB;
}
+ public Vertx getVertx() {
+ return vertx;
+ }
+
+ /**
+ * To use an existing Vertx instance in the ArangoDB client.
+ */
+ public void setVertx(Vertx vertx) {
+ this.vertx = vertx;
+ }
+
public ArangoDbConfiguration getConfiguration() {
return configuration;
}
@@ -115,6 +130,10 @@ public class ArangoDbEndpoint extends DefaultEndpoint
implements EndpointService
builder.user(configuration.getUser()).password(configuration.getPassword());
}
+ if (vertx != null) {
+
builder.protocolConfig(HttpProtocolConfig.builder().vertx(vertx).build());
+ }
+
arangoDB = builder.build();
}
@@ -127,5 +146,4 @@ public class ArangoDbEndpoint extends DefaultEndpoint
implements EndpointService
arangoDB.shutdown();
}
}
-
}
diff --git
a/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCustomVertxIT.java
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCustomVertxIT.java
new file mode 100644
index 00000000000..7fa2f13555b
--- /dev/null
+++
b/components/camel-arangodb/src/test/java/org/apache/camel/component/arangodb/integration/ArangoCustomVertxIT.java
@@ -0,0 +1,110 @@
+/*
+ * 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.component.arangodb.integration;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Optional;
+
+import io.vertx.core.Vertx;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.infra.core.annotations.ContextFixture;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperties;
+import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
+
+import static org.apache.camel.component.arangodb.ArangoDbConstants.AQL_QUERY;
+import static
org.apache.camel.component.arangodb.ArangoDbConstants.AQL_QUERY_BIND_PARAMETERS;
+import static
org.apache.camel.component.arangodb.ArangoDbConstants.RESULT_CLASS_TYPE;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@DisabledIfSystemProperties({
+ @DisabledIfSystemProperty(named = "ci.env.name", matches =
"apache.org",
+ disabledReason = "Apache CI nodes are too
resource constrained for this test"),
+ @DisabledIfSystemProperty(named = "arangodb.tests.disable", matches =
"true",
+ disabledReason = "Manually disabled tests")
+})
+public class ArangoCustomVertxIT extends BaseArangoDb {
+ @BindToRegistry("customVertx")
+ static Vertx vertx = Vertx.vertx();
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:query")
+
.toF("arangodb:{{arangodb.testDb}}?host=%s&port=%d&operation=AQL_QUERY",
+ service.getHost(), service.getPort());
+ }
+ };
+ }
+
+ @AfterAll
+ public static void afterAll() {
+ vertx.close();
+ }
+
+ @ContextFixture
+ @Override
+ public void createCamelContext(CamelContext ctx) {
+ super.createCamelContext(ctx);
+ // Unbind the client so that we can set the Vertx instance
+ ctx.getRegistry().unbind("arangoDB");
+ }
+
+ @Test
+ public void findByParameters() {
+ TestDocumentEntity test = new TestDocumentEntity("bar", 10);
+ collection.insertDocument(test);
+
+ TestDocumentEntity test2 = new TestDocumentEntity("bar");
+ collection.insertDocument(test2);
+
+ TestDocumentEntity test3 = new TestDocumentEntity();
+ test3.setNumber(10);
+ collection.insertDocument(test3);
+
+ String query = "FOR t IN " + COLLECTION_NAME + " FILTER t.foo == @foo
AND t.number == @number RETURN t";
+ Map<String, Object> bindVars = Map.of("foo", test.getFoo(), "number",
test.getNumber());
+
+ Exchange result = template.request("direct:query", exchange -> {
+ exchange.getMessage().setHeader(AQL_QUERY, query);
+ exchange.getMessage().setHeader(AQL_QUERY_BIND_PARAMETERS,
bindVars);
+ exchange.getMessage().setHeader(RESULT_CLASS_TYPE,
TestDocumentEntity.class);
+ });
+
+ assertInstanceOf(Collection.class, result.getMessage().getBody());
+ Collection<TestDocumentEntity> list = (Collection<TestDocumentEntity>)
result.getMessage().getBody();
+
+ assertNotNull(list);
+ Optional<TestDocumentEntity> optional = list.stream().findFirst();
+ assertTrue(optional.isPresent());
+ TestDocumentEntity doc = optional.get();
+ assertNotNull(doc);
+ assertNotNull(doc.getKey());
+ assertNotNull(doc.getRev());
+ assertEquals(test.getFoo(), doc.getFoo());
+ assertEquals(test.getNumber(), doc.getNumber());
+ }
+}
diff --git
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
index 90ae2f76ff6..a40d6e56d72 100644
---
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
+++
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/ArangodbComponentBuilderFactory.java
@@ -249,6 +249,21 @@ public interface ArangodbComponentBuilderFactory {
return this;
}
+ /**
+ * To use an existing Vertx in the ArangoDB client.
+ *
+ * The option is a: <code>io.vertx.core.Vertx</code> type.
+ *
+ * Group: advanced
+ *
+ * @param vertx the value to set
+ * @return the dsl builder
+ */
+ default ArangodbComponentBuilder vertx(io.vertx.core.Vertx vertx) {
+ doSetProperty("vertx", vertx);
+ return this;
+ }
+
/**
* ArangoDB password. If user and password are default, this field is
* Optional.
@@ -312,6 +327,7 @@ public interface ArangodbComponentBuilderFactory {
case "vertexCollection":
getOrCreateConfiguration((ArangoDbComponent)
component).setVertexCollection((java.lang.String) value); return true;
case "arangoDB": ((ArangoDbComponent)
component).setArangoDB((com.arangodb.ArangoDB) value); return true;
case "autowiredEnabled": ((ArangoDbComponent)
component).setAutowiredEnabled((boolean) value); return true;
+ case "vertx": ((ArangoDbComponent)
component).setVertx((io.vertx.core.Vertx) value); return true;
case "password": getOrCreateConfiguration((ArangoDbComponent)
component).setPassword((java.lang.String) value); return true;
case "user": getOrCreateConfiguration((ArangoDbComponent)
component).setUser((java.lang.String) value); return true;
default: return false;
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
index 6f725599b7f..e29da8d9b0b 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java
@@ -307,6 +307,35 @@ public interface ArangoDbEndpointBuilderFactory {
doSetProperty("arangoDB", arangoDB);
return this;
}
+ /**
+ * To use an existing Vertx instance in the ArangoDB client.
+ *
+ * The option is a: <code>io.vertx.core.Vertx</code> type.
+ *
+ * Group: advanced
+ *
+ * @param vertx the value to set
+ * @return the dsl builder
+ */
+ default AdvancedArangoDbEndpointBuilder vertx(io.vertx.core.Vertx
vertx) {
+ doSetProperty("vertx", vertx);
+ return this;
+ }
+ /**
+ * To use an existing Vertx instance in the ArangoDB client.
+ *
+ * The option will be converted to a <code>io.vertx.core.Vertx</code>
+ * type.
+ *
+ * Group: advanced
+ *
+ * @param vertx the value to set
+ * @return the dsl builder
+ */
+ default AdvancedArangoDbEndpointBuilder vertx(String vertx) {
+ doSetProperty("vertx", vertx);
+ return this;
+ }
}
public interface ArangoDbBuilders {
diff --git
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/ArangodbUriDsl.kt
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/ArangodbUriDsl.kt
index 39c46dae22e..4d0be86a9a0 100644
---
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/ArangodbUriDsl.kt
+++
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/ArangodbUriDsl.kt
@@ -146,6 +146,13 @@ public class ArangodbUriDsl(
it.property("arangoDB", arangoDB)
}
+ /**
+ * To use an existing Vertx instance in the ArangoDB client.
+ */
+ public fun vertx(vertx: String) {
+ it.property("vertx", vertx)
+ }
+
/**
* ArangoDB password. If user and password are default, this field is
Optional.
*/