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 2021/03/16 08:27:49 UTC

[camel] branch master updated (58a9505 -> 5a3db4b)

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

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


    from 58a9505  Regen
     new 625a5a2  CAMEL-116340: Ensure components are started when CamelContext is starting.
     new 5a3db4b  CAMEL-116340: Salesforce component build time optimization.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/component/salesforce/SalesforceComponent.java |  9 +++++++--
 ...eption.java => FailedToStartComponentException.java} | 17 +++++++++--------
 .../apache/camel/impl/engine/AbstractCamelContext.java  | 13 +++++++++++++
 3 files changed, 29 insertions(+), 10 deletions(-)
 copy core/camel-api/src/main/java/org/apache/camel/{FailedToCreateProducerException.java => FailedToStartComponentException.java} (64%)


[camel] 01/02: CAMEL-116340: Ensure components are started when CamelContext is starting.

Posted by da...@apache.org.
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

commit 625a5a2d7665490f514ba5b9dca85dc55f6990eb
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 16 09:19:49 2021 +0100

    CAMEL-116340: Ensure components are started when CamelContext is starting.
---
 .../camel/FailedToStartComponentException.java     | 35 ++++++++++++++++++++++
 .../camel/impl/engine/AbstractCamelContext.java    | 13 ++++++++
 2 files changed, 48 insertions(+)

diff --git a/core/camel-api/src/main/java/org/apache/camel/FailedToStartComponentException.java b/core/camel-api/src/main/java/org/apache/camel/FailedToStartComponentException.java
new file mode 100644
index 0000000..a8aad24
--- /dev/null
+++ b/core/camel-api/src/main/java/org/apache/camel/FailedToStartComponentException.java
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+/**
+ * Exception when failing to start a {@link Component}.
+ */
+public class FailedToStartComponentException extends RuntimeCamelException {
+
+    private final String componentName;
+
+    public FailedToStartComponentException(String componentName, String message, Throwable cause) {
+        super("Failed to start component " + componentName + " because of " + message, cause);
+        this.componentName = componentName;
+    }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+}
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
index 6f4ac82..c638bd5 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java
@@ -53,6 +53,7 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.ErrorHandlerFactory;
 import org.apache.camel.ExchangeConstantProvider;
 import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.FailedToStartComponentException;
 import org.apache.camel.FluentProducerTemplate;
 import org.apache.camel.GlobalEndpointConfiguration;
 import org.apache.camel.IsSingleton;
@@ -2829,6 +2830,18 @@ public abstract class AbstractCamelContext extends BaseService
         startDate = System.currentTimeMillis();
         stopWatch.restart();
 
+        // ensure components are started
+        for (Map.Entry<String, Component> entry : components.entrySet()) {
+            StartupStep step = startupStepRecorder.beginStep(Component.class, entry.getKey(), "Start Component");
+            try {
+                ServiceHelper.startService(entry.getValue());
+            } catch (Exception e) {
+                throw new FailedToStartComponentException(entry.getKey(), e.getMessage(), e);
+            } finally {
+                startupStepRecorder.endStep(step);
+            }
+        }
+
         // Start the route controller
         ServiceHelper.startService(this.routeController);
 


[camel] 02/02: CAMEL-116340: Salesforce component build time optimization.

Posted by da...@apache.org.
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

commit 5a3db4b727fee213dbcde09c0a371f4d4de1e5b7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 16 09:20:07 2021 +0100

    CAMEL-116340: Salesforce component build time optimization.
---
 .../apache/camel/component/salesforce/SalesforceComponent.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
index 047b1fd..2dcfcea 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java
@@ -345,8 +345,8 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP
     }
 
     @Override
-    protected void doStart() throws Exception {
-        super.doStart();
+    protected void doBuild() throws Exception {
+        super.doBuild();
 
         if (loginConfig == null) {
             loginConfig = new SalesforceLoginConfig();
@@ -365,6 +365,11 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP
         } else {
             LOG.debug("Using shared login configuration: {}", loginConfig);
         }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
 
         // create a Jetty HttpClient if not already set
         if (httpClient == null) {