You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/12/22 14:30:37 UTC
[camel-quarkus] branch master updated: Remove mp-config workaround
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 63a533d Remove mp-config workaround
new 8c76de9 Merge pull request #571 from lburgazzoli/remove-mp-config-workaround
63a533d is described below
commit 63a533d594475ffb05c5c52dbddae1c12bc819c5
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Sun Dec 22 11:23:26 2019 +0100
Remove mp-config workaround
---
.../camel/quarkus/core/FastCamelContext.java | 58 +---------------------
1 file changed, 2 insertions(+), 56 deletions(-)
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
index bcca279..fa2a9de 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/FastCamelContext.java
@@ -18,9 +18,7 @@ package org.apache.camel.quarkus.core;
import java.util.Collection;
import java.util.Map;
-import java.util.Properties;
import java.util.concurrent.ExecutorService;
-import java.util.function.Predicate;
import org.apache.camel.AsyncProcessor;
import org.apache.camel.CamelContext;
@@ -30,6 +28,7 @@ import org.apache.camel.PollingConsumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.TypeConverter;
+import org.apache.camel.component.microprofile.config.CamelMicroProfilePropertiesSource;
import org.apache.camel.health.HealthCheckRegistry;
import org.apache.camel.impl.DefaultExecutorServiceManager;
import org.apache.camel.impl.engine.AbstractCamelContext;
@@ -85,7 +84,6 @@ import org.apache.camel.spi.InflightRepository;
import org.apache.camel.spi.Injector;
import org.apache.camel.spi.Language;
import org.apache.camel.spi.LanguageResolver;
-import org.apache.camel.spi.LoadablePropertiesSource;
import org.apache.camel.spi.ManagementNameStrategy;
import org.apache.camel.spi.MessageHistoryFactory;
import org.apache.camel.spi.ModelJAXBContextFactory;
@@ -106,8 +104,6 @@ import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.spi.UnitOfWorkFactory;
import org.apache.camel.spi.UuidGenerator;
import org.apache.camel.spi.ValidatorRegistry;
-import org.eclipse.microprofile.config.Config;
-import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
public class FastCamelContext extends AbstractCamelContext {
private Model model;
@@ -320,57 +316,7 @@ public class FastCamelContext extends AbstractCamelContext {
protected PropertiesComponent createPropertiesComponent() {
org.apache.camel.component.properties.PropertiesComponent pc = new org.apache.camel.component.properties.PropertiesComponent();
pc.setAutoDiscoverPropertiesSources(false);
- //
- // The CamelMicroProfilePropertiesSource obtains a reference to the Config object using
- // ConfigProvider.getConfig() but in 1.0.0.Final there's that make the instance retrieved
- // not profile aware that should be solved by https://github.com/quarkusio/quarkus/pull/5387
- // which will be available in Quarkus 1.1.0.
- //
- // As a workaround the instance can be obtained with:
- //
- // ConfigProviderResolver.instance().getConfig()
- //
- // so I've replace the CamelMicroProfilePropertiesSource with a temporary custom implementation.
- //
- // TODO: remove this workaround once 1.1.0 si out
- //
- pc.addPropertiesSource(new LoadablePropertiesSource() {
- @Override
- public String getName() {
- return "mp-properties-source";
- }
-
- @Override
- public String getProperty(String name) {
- return ConfigProviderResolver.instance().getConfig().getOptionalValue(name, String.class).orElse(null);
- }
-
- @Override
- public Properties loadProperties() {
- final Properties answer = new Properties();
- final Config config = ConfigProviderResolver.instance().getConfig();
-
- for (String name : config.getPropertyNames()) {
- answer.put(name, config.getValue(name, String.class));
- }
-
- return answer;
- }
-
- @Override
- public Properties loadProperties(Predicate<String> filter) {
- final Properties answer = new Properties();
- final Config config = ConfigProviderResolver.instance().getConfig();
-
- for (String name : config.getPropertyNames()) {
- if (filter.test(name)) {
- answer.put(name, config.getValue(name, String.class));
- }
- }
-
- return answer;
- }
- });
+ pc.addPropertiesSource(new CamelMicroProfilePropertiesSource());
return pc;