You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/12/10 06:56:51 UTC

[camel] branch master updated: CAMEL-15931: camel-pulsar - autowired for pulsar client

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 fa7d091  CAMEL-15931: camel-pulsar - autowired for pulsar client
fa7d091 is described below

commit fa7d091bd4dbdd790750763b1e2a3fe6a04db283
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Dec 10 07:47:37 2020 +0100

    CAMEL-15931: camel-pulsar - autowired for pulsar client
---
 .../resources/org/apache/camel/catalog/components/pulsar.json    | 2 +-
 .../org/apache/camel/catalog/docs/pulsar-component.adoc          | 2 +-
 .../apache/camel/component/pulsar/PulsarComponentConfigurer.java | 5 +++++
 .../resources/org/apache/camel/component/pulsar/pulsar.json      | 2 +-
 components/camel-pulsar/src/main/docs/pulsar-component.adoc      | 2 +-
 .../java/org/apache/camel/component/pulsar/PulsarComponent.java  | 2 +-
 .../java/org/apache/camel/component/pulsar/PulsarEndpoint.java   | 9 ++++++---
 docs/components/modules/ROOT/pages/pulsar-component.adoc         | 2 +-
 8 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
index 7cf919a..f9d6819 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pulsar.json
@@ -57,7 +57,7 @@
     "sendTimeoutMs": { "kind": "property", "displayName": "Send Timeout Ms", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 30000, "configurationClass": "org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField": "configuration", "description": "Send timeout in milliseconds" },
     "autoConfiguration": { "kind": "property", "displayName": "Auto Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.pulsar.utils.AutoConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The pulsar auto configuration" },
     "autowiredEnabled": { "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 t [...]
-    "pulsarClient": { "kind": "property", "displayName": "Pulsar Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.pulsar.client.api.PulsarClient", "deprecated": false, "autowired": false, "secret": false, "description": "The pulsar client" }
+    "pulsarClient": { "kind": "property", "displayName": "Pulsar Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.pulsar.client.api.PulsarClient", "deprecated": false, "autowired": true, "secret": false, "description": "The pulsar client" }
   },
   "properties": {
     "persistence": { "kind": "path", "displayName": "Persistence", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "persistent", "non-persistent" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the topic is persistent or non-persistent" },
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
index 35c04d4..84ed5be 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/pulsar-component.adoc
@@ -78,7 +78,7 @@ The Pulsar component supports 36 options, which are listed below.
 | *sendTimeoutMs* (producer) | Send timeout in milliseconds | 30000 | int
 | *autoConfiguration* (advanced) | The pulsar auto configuration |  | AutoConfiguration
 | *autowiredEnabled* (advanced) | 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. | true | boolean
-| *pulsarClient* (advanced) | The pulsar client |  | PulsarClient
+| *pulsarClient* (advanced) | *Autowired* The pulsar client |  | PulsarClient
 |===
 // component options: END
 
diff --git a/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java b/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
index 3a3786d..06f1424 100644
--- a/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
+++ b/components/camel-pulsar/src/generated/java/org/apache/camel/component/pulsar/PulsarComponentConfigurer.java
@@ -104,6 +104,11 @@ public class PulsarComponentConfigurer extends PropertyConfigurerSupport impleme
     }
 
     @Override
+    public String[] getAutowiredNames() {
+        return new String[]{"pulsarClient"};
+    }
+
+    @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase() : name) {
         case "ackgrouptimemillis":
diff --git a/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json b/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
index 7cf919a..f9d6819 100644
--- a/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
+++ b/components/camel-pulsar/src/generated/resources/org/apache/camel/component/pulsar/pulsar.json
@@ -57,7 +57,7 @@
     "sendTimeoutMs": { "kind": "property", "displayName": "Send Timeout Ms", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 30000, "configurationClass": "org.apache.camel.component.pulsar.PulsarConfiguration", "configurationField": "configuration", "description": "Send timeout in milliseconds" },
     "autoConfiguration": { "kind": "property", "displayName": "Auto Configuration", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.pulsar.utils.AutoConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The pulsar auto configuration" },
     "autowiredEnabled": { "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 t [...]
-    "pulsarClient": { "kind": "property", "displayName": "Pulsar Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.pulsar.client.api.PulsarClient", "deprecated": false, "autowired": false, "secret": false, "description": "The pulsar client" }
+    "pulsarClient": { "kind": "property", "displayName": "Pulsar Client", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "org.apache.pulsar.client.api.PulsarClient", "deprecated": false, "autowired": true, "secret": false, "description": "The pulsar client" }
   },
   "properties": {
     "persistence": { "kind": "path", "displayName": "Persistence", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "enum": [ "persistent", "non-persistent" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Whether the topic is persistent or non-persistent" },
diff --git a/components/camel-pulsar/src/main/docs/pulsar-component.adoc b/components/camel-pulsar/src/main/docs/pulsar-component.adoc
index 35c04d4..84ed5be 100644
--- a/components/camel-pulsar/src/main/docs/pulsar-component.adoc
+++ b/components/camel-pulsar/src/main/docs/pulsar-component.adoc
@@ -78,7 +78,7 @@ The Pulsar component supports 36 options, which are listed below.
 | *sendTimeoutMs* (producer) | Send timeout in milliseconds | 30000 | int
 | *autoConfiguration* (advanced) | The pulsar auto configuration |  | AutoConfiguration
 | *autowiredEnabled* (advanced) | 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. | true | boolean
-| *pulsarClient* (advanced) | The pulsar client |  | PulsarClient
+| *pulsarClient* (advanced) | *Autowired* The pulsar client |  | PulsarClient
 |===
 // component options: END
 
diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java
index baeb632..c98fd26 100644
--- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java
+++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarComponent.java
@@ -32,7 +32,7 @@ public class PulsarComponent extends DefaultComponent {
 
     @Metadata(label = "advanced")
     private AutoConfiguration autoConfiguration;
-    @Metadata(label = "advanced")
+    @Metadata(label = "advanced", autowired = true)
     private PulsarClient pulsarClient;
     @Metadata(label = "consumer,advanced")
     private PulsarMessageReceiptFactory pulsarMessageReceiptFactory = new DefaultPulsarMessageReceiptFactory();
diff --git a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java
index d38f838..8533786 100644
--- a/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java
+++ b/components/camel-pulsar/src/main/java/org/apache/camel/component/pulsar/PulsarEndpoint.java
@@ -50,16 +50,14 @@ public class PulsarEndpoint extends DefaultEndpoint {
     @UriPath
     @Metadata(required = true)
     private String topic;
-
     @UriParam(defaultValue = "true", label = "advanced")
-    private boolean synchronous;
+    private boolean synchronous = true;
 
     @UriParam
     private PulsarConfiguration pulsarConfiguration;
 
     public PulsarEndpoint(String uri, PulsarComponent component) {
         super(uri, component);
-        this.synchronous = true;
     }
 
     @Override
@@ -171,6 +169,11 @@ public class PulsarEndpoint extends DefaultEndpoint {
     }
 
     @Override
+    protected void doStart() throws Exception {
+        ObjectHelper.notNull(pulsarClient, "pulsarClient", this);
+    }
+
+    @Override
     public PulsarComponent getComponent() {
         return (PulsarComponent) super.getComponent();
     }
diff --git a/docs/components/modules/ROOT/pages/pulsar-component.adoc b/docs/components/modules/ROOT/pages/pulsar-component.adoc
index c3e6375..411c7ce 100644
--- a/docs/components/modules/ROOT/pages/pulsar-component.adoc
+++ b/docs/components/modules/ROOT/pages/pulsar-component.adoc
@@ -80,7 +80,7 @@ The Pulsar component supports 36 options, which are listed below.
 | *sendTimeoutMs* (producer) | Send timeout in milliseconds | 30000 | int
 | *autoConfiguration* (advanced) | The pulsar auto configuration |  | AutoConfiguration
 | *autowiredEnabled* (advanced) | 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. | true | boolean
-| *pulsarClient* (advanced) | The pulsar client |  | PulsarClient
+| *pulsarClient* (advanced) | *Autowired* The pulsar client |  | PulsarClient
 |===
 // component options: END