You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/03/31 16:41:30 UTC

[camel-spring-boot] branch master updated: CAMEL-14813: Remove CachingServiceDiscovery

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

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/master by this push:
     new 32fe4b1  CAMEL-14813: Remove CachingServiceDiscovery
     new 135a3ed  Merge pull request #37 from lburgazzoli/CAMEL-14813
32fe4b1 is described below

commit 32fe4b121879da0aaf5c9c82d17c7eb72b8bd0bf
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Mar 31 18:30:13 2020 +0200

    CAMEL-14813: Remove CachingServiceDiscovery
---
 .../boot/cloud/CamelCloudConfigurationProperties.java       | 13 +------------
 .../camel/spring/boot/cloud/CamelCloudServiceDiscovery.java | 10 +---------
 .../cloud/CamelCloudServiceDiscoveryAutoConfiguration.java  |  9 +--------
 3 files changed, 3 insertions(+), 29 deletions(-)

diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
index 2185950..133facb 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudConfigurationProperties.java
@@ -221,22 +221,11 @@ public class CamelCloudConfigurationProperties {
          * Configure service discoveries.
          */
         private Map<String, List<String>> services = new HashMap<>();
-        /**
-         * Configure cache timeout (in millis).
-         */
-        private String cacheTimeout;
+
 
         public Map<String, List<String>> getServices() {
             return services;
         }
-
-        public String getCacheTimeout() {
-            return cacheTimeout;
-        }
-
-        public void setCacheTimeout(String cacheTimeout) {
-            this.cacheTimeout = cacheTimeout;
-        }
     }
 
     public static class ServiceDiscovery extends ServiceDiscoveryConfiguration {
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java
index cd07dfc..493262b 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscovery.java
@@ -21,23 +21,15 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.cloud.ServiceDefinition;
 import org.apache.camel.cloud.ServiceDiscovery;
-import org.apache.camel.impl.cloud.CachingServiceDiscovery;
 import org.apache.camel.impl.cloud.CombinedServiceDiscovery;
 
 public class CamelCloudServiceDiscovery implements ServiceDiscovery {
     private ServiceDiscovery delegate;
 
-    public CamelCloudServiceDiscovery(Long timeout, List<ServiceDiscovery> serviceDiscoveryList) {
+    public CamelCloudServiceDiscovery(List<ServiceDiscovery> serviceDiscoveryList) {
         // Created a chained service discovery that collects services from multiple
         // ServiceDiscovery
         this.delegate = new CombinedServiceDiscovery(serviceDiscoveryList);
-
-        // If a timeout is provided, wrap the serviceDiscovery with a caching
-        // strategy so the discovery implementations are not queried for each
-        // discovery request
-        if (timeout != null && timeout > 0) {
-            this.delegate = CachingServiceDiscovery.wrap(this.delegate, timeout, TimeUnit.MILLISECONDS);
-        }
     }
 
     @Override
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
index 9de1d38..9ba1600 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/cloud/CamelCloudServiceDiscoveryAutoConfiguration.java
@@ -68,14 +68,7 @@ public class CamelCloudServiceDiscoveryAutoConfiguration implements BeanFactoryA
     @Lazy
     @Bean(name = "service-discovery")
     public CamelCloudServiceDiscovery serviceDiscovery(List<ServiceDiscovery> serviceDiscoveryList) throws NoTypeConversionAvailableException {
-        String cacheTimeout = configurationProperties.getServiceDiscovery().getCacheTimeout();
-        Long timeout = null;
-
-        if (cacheTimeout != null) {
-            timeout = camelContext.getTypeConverter().mandatoryConvertTo(Long.class, timeout);
-        }
-
-        return new CamelCloudServiceDiscovery(timeout, serviceDiscoveryList);
+        return new CamelCloudServiceDiscovery(serviceDiscoveryList);
     }
 
     @PostConstruct