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

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


The following commit(s) were added to refs/heads/master by this push:
     new 01ec963  camel-vertx - Use autowired
01ec963 is described below

commit 01ec96334017a98d796e03d0a9adb46ad1fb917d
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Nov 15 12:11:54 2020 +0100

    camel-vertx - Use autowired
---
 .../org/apache/camel/catalog/components/vertx.json |  2 +-
 .../apache/camel/catalog/docs/vertx-component.adoc |  2 +-
 .../component/vertx/VertxComponentConfigurer.java  |  5 +++
 .../org/apache/camel/component/vertx/vertx.json    |  2 +-
 .../camel-vertx/src/main/docs/vertx-component.adoc |  2 +-
 .../camel/component/vertx/VertxComponent.java      | 18 +--------
 .../apache/camel/component/vertx/VertxHelper.java  | 44 ----------------------
 .../modules/ROOT/pages/vertx-component.adoc        |  2 +-
 8 files changed, 11 insertions(+), 66 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx.json
index 5266bb7..46ec906 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/vertx.json
@@ -25,7 +25,7 @@
     "host": { "kind": "property", "displayName": "Host", "group": "common", 
"label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Hostname for creating an embedded clustered EventBus" },
     "port": { "kind": "property", "displayName": "Port", "group": "common", 
"label": "", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "autowired": false, "secret": false, "description": "Port 
for creating an embedded clustered EventBus" },
     "timeout": { "kind": "property", "displayName": "Timeout", "group": 
"common", "label": "", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 60, 
"description": "Timeout in seconds to wait for clustered Vertx EventBus to be 
ready. The default value is 60." },
-    "vertx": { "kind": "property", "displayName": "Vertx", "group": "common", 
"label": "", "required": false, "type": "object", "javaType": 
"io.vertx.core.Vertx", "deprecated": false, "autowired": false, "secret": 
false, "description": "To use the given vertx EventBus instead of creating a 
new embedded EventBus" },
+    "vertx": { "kind": "property", "displayName": "Vertx", "group": "common", 
"label": "", "required": false, "type": "object", "javaType": 
"io.vertx.core.Vertx", "deprecated": false, "autowired": true, "secret": false, 
"description": "To use the given vertx EventBus instead of creating a new 
embedded EventBus" },
     "vertxOptions": { "kind": "property", "displayName": "Vertx Options", 
"group": "common", "label": "", "required": false, "type": "object", 
"javaType": "io.vertx.core.VertxOptions", "deprecated": false, "autowired": 
false, "secret": false, "description": "Options to use for creating vertx" },
     "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Allows for bridging the 
consumer to the Camel routing Error Handler, which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages, or the likes, will 
now be processed as a me [...]
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start 
Producer", "group": "producer", "label": "producer", "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 producer 
may otherwise fail during star [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-component.adoc
index 7832f04..b42dac1 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/vertx-component.adoc
@@ -59,7 +59,7 @@ The Vert.x component supports 9 options, which are listed 
below.
 | *host* (common) | Hostname for creating an embedded clustered EventBus |  | 
String
 | *port* (common) | Port for creating an embedded clustered EventBus |  | int
 | *timeout* (common) | Timeout in seconds to wait for clustered Vertx EventBus 
to be ready. The default value is 60. | 60 | int
-| *vertx* (common) | To use the given vertx EventBus instead of creating a new 
embedded EventBus |  | Vertx
+| *vertx* (common) | *Autowired* To use the given vertx EventBus instead of 
creating a new embedded EventBus |  | Vertx
 | *vertxOptions* (common) | Options to use for creating vertx |  | VertxOptions
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *lazyStartProducer* (producer) | 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 [...]
diff --git 
a/components/camel-vertx/src/generated/java/org/apache/camel/component/vertx/VertxComponentConfigurer.java
 
b/components/camel-vertx/src/generated/java/org/apache/camel/component/vertx/VertxComponentConfigurer.java
index 102e85d..b9682d5 100644
--- 
a/components/camel-vertx/src/generated/java/org/apache/camel/component/vertx/VertxComponentConfigurer.java
+++ 
b/components/camel-vertx/src/generated/java/org/apache/camel/component/vertx/VertxComponentConfigurer.java
@@ -40,6 +40,11 @@ public class VertxComponentConfigurer extends 
PropertyConfigurerSupport implemen
     }
 
     @Override
+    public String[] getAutowiredNames() {
+        return new String[]{"vertx"};
+    }
+
+    @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "autowiredenabled":
diff --git 
a/components/camel-vertx/src/generated/resources/org/apache/camel/component/vertx/vertx.json
 
b/components/camel-vertx/src/generated/resources/org/apache/camel/component/vertx/vertx.json
index 5266bb7..46ec906 100644
--- 
a/components/camel-vertx/src/generated/resources/org/apache/camel/component/vertx/vertx.json
+++ 
b/components/camel-vertx/src/generated/resources/org/apache/camel/component/vertx/vertx.json
@@ -25,7 +25,7 @@
     "host": { "kind": "property", "displayName": "Host", "group": "common", 
"label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Hostname for creating an embedded clustered EventBus" },
     "port": { "kind": "property", "displayName": "Port", "group": "common", 
"label": "", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "autowired": false, "secret": false, "description": "Port 
for creating an embedded clustered EventBus" },
     "timeout": { "kind": "property", "displayName": "Timeout", "group": 
"common", "label": "", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 60, 
"description": "Timeout in seconds to wait for clustered Vertx EventBus to be 
ready. The default value is 60." },
-    "vertx": { "kind": "property", "displayName": "Vertx", "group": "common", 
"label": "", "required": false, "type": "object", "javaType": 
"io.vertx.core.Vertx", "deprecated": false, "autowired": false, "secret": 
false, "description": "To use the given vertx EventBus instead of creating a 
new embedded EventBus" },
+    "vertx": { "kind": "property", "displayName": "Vertx", "group": "common", 
"label": "", "required": false, "type": "object", "javaType": 
"io.vertx.core.Vertx", "deprecated": false, "autowired": true, "secret": false, 
"description": "To use the given vertx EventBus instead of creating a new 
embedded EventBus" },
     "vertxOptions": { "kind": "property", "displayName": "Vertx Options", 
"group": "common", "label": "", "required": false, "type": "object", 
"javaType": "io.vertx.core.VertxOptions", "deprecated": false, "autowired": 
false, "secret": false, "description": "Options to use for creating vertx" },
     "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Allows for bridging the 
consumer to the Camel routing Error Handler, which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages, or the likes, will 
now be processed as a me [...]
     "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start 
Producer", "group": "producer", "label": "producer", "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 producer 
may otherwise fail during star [...]
diff --git a/components/camel-vertx/src/main/docs/vertx-component.adoc 
b/components/camel-vertx/src/main/docs/vertx-component.adoc
index 7832f04..b42dac1 100644
--- a/components/camel-vertx/src/main/docs/vertx-component.adoc
+++ b/components/camel-vertx/src/main/docs/vertx-component.adoc
@@ -59,7 +59,7 @@ The Vert.x component supports 9 options, which are listed 
below.
 | *host* (common) | Hostname for creating an embedded clustered EventBus |  | 
String
 | *port* (common) | Port for creating an embedded clustered EventBus |  | int
 | *timeout* (common) | Timeout in seconds to wait for clustered Vertx EventBus 
to be ready. The default value is 60. | 60 | int
-| *vertx* (common) | To use the given vertx EventBus instead of creating a new 
embedded EventBus |  | Vertx
+| *vertx* (common) | *Autowired* To use the given vertx EventBus instead of 
creating a new embedded EventBus |  | Vertx
 | *vertxOptions* (common) | Options to use for creating vertx |  | VertxOptions
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *lazyStartProducer* (producer) | 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 [...]
diff --git 
a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
 
b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
index 83bb357..0e17d25 100644
--- 
a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
+++ 
b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
@@ -17,7 +17,6 @@
 package org.apache.camel.component.vertx;
 
 import java.util.Map;
-import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -36,9 +35,6 @@ import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- * A Camel Component for <a href="http://vertx.io/";>vert.x</a>
- */
 @Component("vertx")
 public class VertxComponent extends DefaultComponent {
 
@@ -48,7 +44,7 @@ public class VertxComponent extends DefaultComponent {
 
     @Metadata(label = "advanced")
     private VertxFactory vertxFactory;
-    @Metadata
+    @Metadata(autowired = true)
     private Vertx vertx;
     @Metadata
     private String host;
@@ -142,18 +138,6 @@ public class VertxComponent extends DefaultComponent {
     }
 
     @Override
-    protected void doInit() throws Exception {
-        super.doInit();
-
-        if (vertx == null) {
-            Set<Vertx> vertxes = 
getCamelContext().getRegistry().findByType(Vertx.class);
-            if (vertxes.size() == 1) {
-                vertx = vertxes.iterator().next();
-            }
-        }
-    }
-
-    @Override
     protected void doStart() throws Exception {
         super.doStart();
 
diff --git 
a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxHelper.java
 
b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxHelper.java
deleted file mode 100644
index be657bf..0000000
--- 
a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxHelper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.vertx;
-
-import io.vertx.core.json.JsonArray;
-import io.vertx.core.json.JsonObject;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-
-/**
- * @deprecated do not use, to to be removed
- */
-@Deprecated
-public final class VertxHelper {
-
-    private VertxHelper() {
-    }
-
-    public static Object getVertxBody(Exchange exchange) {
-        Message msg = exchange.getMessage();
-        Object body = msg.getBody(JsonObject.class);
-        if (body == null) {
-            body = msg.getBody(JsonArray.class);
-        }
-        if (body == null) {
-            body = msg.getBody(String.class);
-        }
-        return body;
-    }
-}
diff --git a/docs/components/modules/ROOT/pages/vertx-component.adoc 
b/docs/components/modules/ROOT/pages/vertx-component.adoc
index 13340fd..1885c07 100644
--- a/docs/components/modules/ROOT/pages/vertx-component.adoc
+++ b/docs/components/modules/ROOT/pages/vertx-component.adoc
@@ -61,7 +61,7 @@ The Vert.x component supports 9 options, which are listed 
below.
 | *host* (common) | Hostname for creating an embedded clustered EventBus |  | 
String
 | *port* (common) | Port for creating an embedded clustered EventBus |  | int
 | *timeout* (common) | Timeout in seconds to wait for clustered Vertx EventBus 
to be ready. The default value is 60. | 60 | int
-| *vertx* (common) | To use the given vertx EventBus instead of creating a new 
embedded EventBus |  | Vertx
+| *vertx* (common) | *Autowired* To use the given vertx EventBus instead of 
creating a new embedded EventBus |  | Vertx
 | *vertxOptions* (common) | Options to use for creating vertx |  | VertxOptions
 | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
 | *lazyStartProducer* (producer) | 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 [...]

Reply via email to