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

davsclaus 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 9c27574ae6c CAMEL-18454: Allow to enable secret refresh from vault. 
(AWS)
9c27574ae6c is described below

commit 9c27574ae6c4cb5ae11d672c27cd7ed5df220f9e
Author: Claus Ibsen <[email protected]>
AuthorDate: Wed Sep 7 14:42:24 2022 +0200

    CAMEL-18454: Allow to enable secret refresh from vault. (AWS)
---
 .../catalog/main/camel-main-configuration-metadata.json    |  3 +++
 .../camel/impl/engine/DefaultPeriodTaskScheduler.java      | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index 4356af10528..3c49d0982d8 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -207,8 +207,11 @@
     { "name": "camel.threadpool.timeUnit", "description": "Sets the default 
time unit used for keep alive time", "sourceType": 
"org.apache.camel.main.ThreadPoolConfigurationProperties", "type": "object", 
"javaType": "java.util.concurrent.TimeUnit" },
     { "name": "camel.vault.aws.accessKey", "description": "The AWS access 
key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.aws.defaultCredentialsProvider", "description": 
"Define if we want to use the AWS Default Credentials Provider or not", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.refreshEnabled", "description": "Whether to 
automatically reload Camel upon secrets being updated in AWS.", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "boolean", "javaType": 
"boolean", "defaultValue": "false" },
+    { "name": "camel.vault.aws.refreshPeriod", "description": "The period 
(millis) between checking AWS for updated secrets.", "sourceType": 
"org.apache.camel.vault.AwsVaultConfiguration", "type": "integer", "javaType": 
"long", "defaultValue": 30000 },
     { "name": "camel.vault.aws.region", "description": "The AWS region", 
"sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": "string", 
"javaType": "java.lang.String" },
     { "name": "camel.vault.aws.secretKey", "description": "The AWS secret 
key", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
+    { "name": "camel.vault.aws.secrets", "description": "Specify the secret 
names (or pattern) to check for updates. Multiple secrets can be separated by 
comma.", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration", "type": 
"string", "javaType": "java.lang.String" },
     { "name": "camel.vault.azure.clientId", "description": "The client Id for 
accessing Azure Key Vault", "sourceType": 
"org.apache.camel.vault.AzureVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
     { "name": "camel.vault.azure.clientSecret", "description": "The client 
Secret for accessing Azure Key Vault", "sourceType": 
"org.apache.camel.vault.AzureVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
     { "name": "camel.vault.azure.tenantId", "description": "The Tenant Id for 
accessing Azure Key Vault", "sourceType": 
"org.apache.camel.vault.AzureVaultConfiguration", "type": "string", "javaType": 
"java.lang.String" },
diff --git 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultPeriodTaskScheduler.java
 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultPeriodTaskScheduler.java
index baf559c214a..754e3f6d43a 100644
--- 
a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultPeriodTaskScheduler.java
+++ 
b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultPeriodTaskScheduler.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.impl.engine;
 
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.TimerListener;
 import org.apache.camel.spi.PeriodTaskScheduler;
 import org.apache.camel.support.TimerListenerManager;
@@ -43,7 +44,7 @@ public final class DefaultPeriodTaskScheduler extends 
TimerListenerManager imple
         }
     }
 
-    private static final class TaskWrapper extends ServiceSupport implements 
TimerListener {
+    private final class TaskWrapper extends ServiceSupport implements 
TimerListener {
 
         private final StopWatch watch = new StopWatch();
         private final Runnable task;
@@ -62,6 +63,17 @@ public final class DefaultPeriodTaskScheduler extends 
TimerListenerManager imple
             }
         }
 
+        @Override
+        protected void doBuild() throws Exception {
+            CamelContextAware.trySetCamelContext(task, getCamelContext());
+            ServiceHelper.buildService(task);
+        }
+
+        @Override
+        protected void doInit() throws Exception {
+            ServiceHelper.initService(task);
+        }
+
         @Override
         protected void doStart() throws Exception {
             ServiceHelper.startService(task);

Reply via email to