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 2023/07/14 09:54:08 UTC
[camel] branch camel-3.20.x updated (016bc9a145f -> a5b7d028aa1)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
from 016bc9a145f Update camel releases
new 5e51568f1ef CAMEL-19603: camel-core - configureVault should be done general so its also done for Spring Boot and Quarkus and not only camel-main/camel-jbang.
new a5b7d028aa1 CAMEL-19603: camel-core - configureVault should be done general so its also done for Spring Boot and Quarkus and not only camel-main/camel-jbang.
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:
.../org/apache/camel/main/BaseMainSupport.java | 72 +-------------------
.../camel/main/DefaultConfigurationConfigurer.java | 77 +++++++++++++++++++++-
2 files changed, 77 insertions(+), 72 deletions(-)
[camel] 02/02: CAMEL-19603: camel-core - configureVault should be done general so its also done for Spring Boot and Quarkus and not only camel-main/camel-jbang.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit a5b7d028aa1b930c127322902ad0b223e2c42fac
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 14 11:48:10 2023 +0200
CAMEL-19603: camel-core - configureVault should be done general so its also done for Spring Boot and Quarkus and not only camel-main/camel-jbang.
---
.../src/main/java/org/apache/camel/main/BaseMainSupport.java | 3 ++-
.../java/org/apache/camel/main/DefaultConfigurationConfigurer.java | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index 2dccb705cfc..5863226de5c 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -52,7 +52,6 @@ import org.apache.camel.saga.CamelSagaService;
import org.apache.camel.spi.AutowiredLifecycleStrategy;
import org.apache.camel.spi.CamelBeanPostProcessor;
import org.apache.camel.spi.CamelEvent;
-import org.apache.camel.spi.ContextReloadStrategy;
import org.apache.camel.spi.DataFormat;
import org.apache.camel.spi.Language;
import org.apache.camel.spi.PackageScanClassResolver;
@@ -1108,6 +1107,8 @@ public abstract class BaseMainSupport extends BaseService {
// and call after all properties are set
DefaultConfigurationConfigurer.afterPropertiesSet(camelContext);
+ // and configure vault
+ DefaultConfigurationConfigurer.configureVault(camelContext);
}
private void setRouteTemplateProperties(
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
index 0e84d35ae6f..939fad307c5 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
@@ -571,6 +571,10 @@ public final class DefaultConfigurationConfigurer {
devConsoleRegistry.register(console);
}
}
+
+ // set the default thread pool profile if defined
+ initThreadPoolProfiles(registry, camelContext);
+
// vaults
AwsVaultConfiguration aws = getSingleBeanOfType(registry, AwsVaultConfiguration.class);
if (aws != null) {
@@ -593,9 +597,6 @@ public final class DefaultConfigurationConfigurer {
vault.setHashicorpVaultConfiguration(hashicorp);
}
configureVault(camelContext);
-
- // set the default thread pool profile if defined
- initThreadPoolProfiles(registry, camelContext);
}
/**
[camel] 01/02: CAMEL-19603: camel-core - configureVault should be done general so its also done for Spring Boot and Quarkus and not only camel-main/camel-jbang.
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5e51568f1ef6e4937d151009b619b24c2dfca5dc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jul 14 11:11:44 2023 +0200
CAMEL-19603: camel-core - configureVault should be done general so its also done for Spring Boot and Quarkus and not only camel-main/camel-jbang.
---
.../org/apache/camel/main/BaseMainSupport.java | 69 ---------------------
.../camel/main/DefaultConfigurationConfigurer.java | 72 ++++++++++++++++++++++
2 files changed, 72 insertions(+), 69 deletions(-)
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index 7d5835683eb..2dccb705cfc 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -387,73 +387,6 @@ public abstract class BaseMainSupport extends BaseService {
protected void configureLifecycle(CamelContext camelContext) throws Exception {
}
- /**
- * Configures security vaults such as AWS, Azure, Google and Hashicorp.
- */
- protected void configureVault(CamelContext camelContext) throws Exception {
- VaultConfiguration vc = camelContext.getVaultConfiguration();
- if (vc == null) {
- return;
- }
-
- if (vc.aws().isRefreshEnabled()) {
- Optional<Runnable> task = camelContext.adapt(ExtendedCamelContext.class)
- .getPeriodTaskResolver().newInstance("aws-secret-refresh", Runnable.class);
- if (task.isPresent()) {
- long period = vc.aws().getRefreshPeriod();
- Runnable r = task.get();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
- }
- if (camelContext.hasService(ContextReloadStrategy.class) == null) {
- // refresh is enabled then we need to automatically enable context-reload as well
- ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
- camelContext.addService(reloader);
- }
- PeriodTaskScheduler scheduler = getCamelContext().adapt(ExtendedCamelContext.class).getPeriodTaskScheduler();
- scheduler.schedulePeriodTask(r, period);
- }
- }
-
- if (vc.gcp().isRefreshEnabled()) {
- Optional<Runnable> task = camelContext.adapt(ExtendedCamelContext.class)
- .getPeriodTaskResolver().newInstance("gcp-secret-refresh", Runnable.class);
- if (task.isPresent()) {
- long period = vc.gcp().getRefreshPeriod();
- Runnable r = task.get();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
- }
- if (camelContext.hasService(ContextReloadStrategy.class) == null) {
- // refresh is enabled then we need to automatically enable context-reload as well
- ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
- camelContext.addService(reloader);
- }
- PeriodTaskScheduler scheduler = getCamelContext().adapt(ExtendedCamelContext.class).getPeriodTaskScheduler();
- scheduler.schedulePeriodTask(r, period);
- }
- }
-
- if (vc.azure().isRefreshEnabled()) {
- Optional<Runnable> task = camelContext.adapt(ExtendedCamelContext.class)
- .getPeriodTaskResolver().newInstance("azure-secret-refresh", Runnable.class);
- if (task.isPresent()) {
- long period = vc.azure().getRefreshPeriod();
- Runnable r = task.get();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
- }
- if (camelContext.hasService(ContextReloadStrategy.class) == null) {
- // refresh is enabled then we need to automatically enable context-reload as well
- ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
- camelContext.addService(reloader);
- }
- PeriodTaskScheduler scheduler = getCamelContext().adapt(ExtendedCamelContext.class).getPeriodTaskScheduler();
- scheduler.schedulePeriodTask(r, period);
- }
- }
- }
-
protected void autoconfigure(CamelContext camelContext) throws Exception {
// gathers the properties (key=value) that was auto-configured
final OrderedLocationProperties autoConfiguredProperties = new OrderedLocationProperties();
@@ -696,8 +629,6 @@ public abstract class BaseMainSupport extends BaseService {
configureLifecycle(camelContext);
- configureVault(camelContext);
-
if (standalone) {
step = recorder.beginStep(BaseMainSupport.class, "configureRoutes", "Collect Routes");
configureRoutes(camelContext);
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
index 3f53dfa2ed3..0e84d35ae6f 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultConfigurationConfigurer.java
@@ -19,6 +19,7 @@ package org.apache.camel.main;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -61,6 +62,7 @@ import org.apache.camel.spi.ManagementStrategy;
import org.apache.camel.spi.MessageHistoryFactory;
import org.apache.camel.spi.ModelJAXBContextFactory;
import org.apache.camel.spi.NodeIdFactory;
+import org.apache.camel.spi.PeriodTaskScheduler;
import org.apache.camel.spi.ProcessorFactory;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.spi.ReactiveExecutor;
@@ -86,6 +88,7 @@ import org.apache.camel.support.SimpleUuidGenerator;
import org.apache.camel.support.jsse.GlobalSSLContextParametersSupplier;
import org.apache.camel.support.startup.LoggingStartupStepRecorder;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.TimeUtils;
import org.apache.camel.vault.AwsVaultConfiguration;
import org.apache.camel.vault.AzureVaultConfiguration;
import org.apache.camel.vault.GcpVaultConfiguration;
@@ -589,10 +592,79 @@ public final class DefaultConfigurationConfigurer {
VaultConfiguration vault = camelContext.getVaultConfiguration();
vault.setHashicorpVaultConfiguration(hashicorp);
}
+ configureVault(camelContext);
+
// set the default thread pool profile if defined
initThreadPoolProfiles(registry, camelContext);
}
+ /**
+ * Configures security vaults such as AWS, Azure, Google and Hashicorp.
+ */
+ protected static void configureVault(CamelContext camelContext) throws Exception {
+ VaultConfiguration vc = camelContext.getVaultConfiguration();
+ if (vc == null) {
+ return;
+ }
+
+ if (vc.aws().isRefreshEnabled()) {
+ Optional<Runnable> task = camelContext.adapt(ExtendedCamelContext.class)
+ .getPeriodTaskResolver().newInstance("aws-secret-refresh", Runnable.class);
+ if (task.isPresent()) {
+ long period = vc.aws().getRefreshPeriod();
+ Runnable r = task.get();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
+ }
+ if (camelContext.hasService(ContextReloadStrategy.class) == null) {
+ // refresh is enabled then we need to automatically enable context-reload as well
+ ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
+ camelContext.addService(reloader);
+ }
+ PeriodTaskScheduler scheduler = camelContext.adapt(ExtendedCamelContext.class).getPeriodTaskScheduler();
+ scheduler.schedulePeriodTask(r, period);
+ }
+ }
+
+ if (vc.gcp().isRefreshEnabled()) {
+ Optional<Runnable> task = camelContext.adapt(ExtendedCamelContext.class)
+ .getPeriodTaskResolver().newInstance("gcp-secret-refresh", Runnable.class);
+ if (task.isPresent()) {
+ long period = vc.gcp().getRefreshPeriod();
+ Runnable r = task.get();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
+ }
+ if (camelContext.hasService(ContextReloadStrategy.class) == null) {
+ // refresh is enabled then we need to automatically enable context-reload as well
+ ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
+ camelContext.addService(reloader);
+ }
+ PeriodTaskScheduler scheduler = camelContext.adapt(ExtendedCamelContext.class).getPeriodTaskScheduler();
+ scheduler.schedulePeriodTask(r, period);
+ }
+ }
+
+ if (vc.azure().isRefreshEnabled()) {
+ Optional<Runnable> task = camelContext.adapt(ExtendedCamelContext.class)
+ .getPeriodTaskResolver().newInstance("azure-secret-refresh", Runnable.class);
+ if (task.isPresent()) {
+ long period = vc.azure().getRefreshPeriod();
+ Runnable r = task.get();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Scheduling: {} (period: {})", r, TimeUtils.printDuration(period, false));
+ }
+ if (camelContext.hasService(ContextReloadStrategy.class) == null) {
+ // refresh is enabled then we need to automatically enable context-reload as well
+ ContextReloadStrategy reloader = new DefaultContextReloadStrategy();
+ camelContext.addService(reloader);
+ }
+ PeriodTaskScheduler scheduler = camelContext.adapt(ExtendedCamelContext.class).getPeriodTaskScheduler();
+ scheduler.schedulePeriodTask(r, period);
+ }
+ }
+ }
+
public static void afterPropertiesSet(final CamelContext camelContext) throws Exception {
// additional configuration
}