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.git
The following commit(s) were added to refs/heads/master by this push: new 46a579f CAMEL-15524: camel-caffeine: use cacheName to lookup cache instances from the registry (#4203) 46a579f is described below commit 46a579f6dcb708134d9cde36d864d2696bcf9c20 Author: Luca Burgazzoli <lburgazz...@users.noreply.github.com> AuthorDate: Fri Sep 11 18:31:37 2020 +0200 CAMEL-15524: camel-caffeine: use cacheName to lookup cache instances from the registry (#4203) --- .../cache/CaffeineCacheComponentConfigurer.java | 3 --- .../cache/CaffeineCacheEndpointConfigurer.java | 3 --- .../load/CaffeineLoadCacheComponentConfigurer.java | 3 --- .../load/CaffeineLoadCacheEndpointConfigurer.java | 3 --- .../component/caffeine/cache/caffeine-cache.json | 2 -- .../caffeine/load/caffeine-loadcache.json | 2 -- .../src/main/docs/caffeine-cache-component.adoc | 10 ++++----- .../main/docs/caffeine-loadcache-component.adoc | 6 ++---- .../component/caffeine/CaffeineConfiguration.java | 14 ------------- .../caffeine/cache/CaffeineCacheEndpoint.java | 16 +++++++-------- .../caffeine/cache/CaffeineCacheProducer.java | 4 ++-- .../caffeine/load/CaffeineLoadCacheEndpoint.java | 14 ++++++------- .../caffeine/load/CaffeineLoadCacheProducer.java | 4 ++-- ...neCacheProducerMultiOperationSameCacheTest.java | 5 +++-- .../caffeine/cache/CaffeineCacheProducerTest.java | 3 ++- .../CaffeineCacheRemovaListenerProducerTest.java | 3 ++- .../CaffeineCacheStatsCounterProducerTest.java | 3 ++- ...adCacheProducerMultiOperationSameCacheTest.java | 5 +++-- .../loadcache/CaffeineLoadCacheProducerTest.java | 3 ++- .../dsl/CaffeineCacheComponentBuilderFactory.java | 14 ------------- .../CaffeineLoadcacheComponentBuilderFactory.java | 14 ------------- .../dsl/CaffeineCacheEndpointBuilderFactory.java | 24 ---------------------- .../CaffeineLoadCacheEndpointBuilderFactory.java | 24 ---------------------- .../ROOT/pages/camel-3x-upgrade-guide-3_6.adoc | 20 ++++++++++++++++++ 24 files changed, 59 insertions(+), 143 deletions(-) diff --git a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheComponentConfigurer.java b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheComponentConfigurer.java index 9b8182e..a82668f 100644 --- a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheComponentConfigurer.java +++ b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheComponentConfigurer.java @@ -29,7 +29,6 @@ public class CaffeineCacheComponentConfigurer extends PropertyConfigurerSupport case "action": getOrCreateConfiguration(target).setAction(property(camelContext, java.lang.String.class, value)); return true; case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; - case "cache": getOrCreateConfiguration(target).setCache(property(camelContext, com.github.benmanes.caffeine.cache.Cache.class, value)); return true; case "cacheloader": case "cacheLoader": getOrCreateConfiguration(target).setCacheLoader(property(camelContext, com.github.benmanes.caffeine.cache.CacheLoader.class, value)); return true; case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.caffeine.CaffeineConfiguration.class, value)); return true; @@ -67,7 +66,6 @@ public class CaffeineCacheComponentConfigurer extends PropertyConfigurerSupport Map<String, Object> answer = new CaseInsensitiveMap(); answer.put("action", java.lang.String.class); answer.put("basicPropertyBinding", boolean.class); - answer.put("cache", com.github.benmanes.caffeine.cache.Cache.class); answer.put("cacheLoader", com.github.benmanes.caffeine.cache.CacheLoader.class); answer.put("configuration", org.apache.camel.component.caffeine.CaffeineConfiguration.class); answer.put("createCacheIfNotExist", boolean.class); @@ -93,7 +91,6 @@ public class CaffeineCacheComponentConfigurer extends PropertyConfigurerSupport case "action": return getOrCreateConfiguration(target).getAction(); case "basicpropertybinding": case "basicPropertyBinding": return target.isBasicPropertyBinding(); - case "cache": return getOrCreateConfiguration(target).getCache(); case "cacheloader": case "cacheLoader": return getOrCreateConfiguration(target).getCacheLoader(); case "configuration": return target.getConfiguration(); diff --git a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpointConfigurer.java b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpointConfigurer.java index d82e466..820a289 100644 --- a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpointConfigurer.java +++ b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpointConfigurer.java @@ -22,7 +22,6 @@ public class CaffeineCacheEndpointConfigurer extends PropertyConfigurerSupport i case "action": target.getConfiguration().setAction(property(camelContext, java.lang.String.class, value)); return true; case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; - case "cache": target.getConfiguration().setCache(property(camelContext, com.github.benmanes.caffeine.cache.Cache.class, value)); return true; case "cacheloader": case "cacheLoader": target.getConfiguration().setCacheLoader(property(camelContext, com.github.benmanes.caffeine.cache.CacheLoader.class, value)); return true; case "createcacheifnotexist": @@ -60,7 +59,6 @@ public class CaffeineCacheEndpointConfigurer extends PropertyConfigurerSupport i Map<String, Object> answer = new CaseInsensitiveMap(); answer.put("action", java.lang.String.class); answer.put("basicPropertyBinding", boolean.class); - answer.put("cache", com.github.benmanes.caffeine.cache.Cache.class); answer.put("cacheLoader", com.github.benmanes.caffeine.cache.CacheLoader.class); answer.put("createCacheIfNotExist", boolean.class); answer.put("evictionType", org.apache.camel.component.caffeine.EvictionType.class); @@ -86,7 +84,6 @@ public class CaffeineCacheEndpointConfigurer extends PropertyConfigurerSupport i case "action": return target.getConfiguration().getAction(); case "basicpropertybinding": case "basicPropertyBinding": return target.isBasicPropertyBinding(); - case "cache": return target.getConfiguration().getCache(); case "cacheloader": case "cacheLoader": return target.getConfiguration().getCacheLoader(); case "createcacheifnotexist": diff --git a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheComponentConfigurer.java b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheComponentConfigurer.java index a57f1ef..3fb576c 100644 --- a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheComponentConfigurer.java +++ b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheComponentConfigurer.java @@ -29,7 +29,6 @@ public class CaffeineLoadCacheComponentConfigurer extends PropertyConfigurerSupp case "action": getOrCreateConfiguration(target).setAction(property(camelContext, java.lang.String.class, value)); return true; case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; - case "cache": getOrCreateConfiguration(target).setCache(property(camelContext, com.github.benmanes.caffeine.cache.Cache.class, value)); return true; case "cacheloader": case "cacheLoader": getOrCreateConfiguration(target).setCacheLoader(property(camelContext, com.github.benmanes.caffeine.cache.CacheLoader.class, value)); return true; case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.caffeine.CaffeineConfiguration.class, value)); return true; @@ -67,7 +66,6 @@ public class CaffeineLoadCacheComponentConfigurer extends PropertyConfigurerSupp Map<String, Object> answer = new CaseInsensitiveMap(); answer.put("action", java.lang.String.class); answer.put("basicPropertyBinding", boolean.class); - answer.put("cache", com.github.benmanes.caffeine.cache.Cache.class); answer.put("cacheLoader", com.github.benmanes.caffeine.cache.CacheLoader.class); answer.put("configuration", org.apache.camel.component.caffeine.CaffeineConfiguration.class); answer.put("createCacheIfNotExist", boolean.class); @@ -93,7 +91,6 @@ public class CaffeineLoadCacheComponentConfigurer extends PropertyConfigurerSupp case "action": return getOrCreateConfiguration(target).getAction(); case "basicpropertybinding": case "basicPropertyBinding": return target.isBasicPropertyBinding(); - case "cache": return getOrCreateConfiguration(target).getCache(); case "cacheloader": case "cacheLoader": return getOrCreateConfiguration(target).getCacheLoader(); case "configuration": return target.getConfiguration(); diff --git a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpointConfigurer.java b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpointConfigurer.java index f1e442c..da9c2a2 100644 --- a/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpointConfigurer.java +++ b/components/camel-caffeine/src/generated/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpointConfigurer.java @@ -22,7 +22,6 @@ public class CaffeineLoadCacheEndpointConfigurer extends PropertyConfigurerSuppo case "action": target.getConfiguration().setAction(property(camelContext, java.lang.String.class, value)); return true; case "basicpropertybinding": case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true; - case "cache": target.getConfiguration().setCache(property(camelContext, com.github.benmanes.caffeine.cache.Cache.class, value)); return true; case "cacheloader": case "cacheLoader": target.getConfiguration().setCacheLoader(property(camelContext, com.github.benmanes.caffeine.cache.CacheLoader.class, value)); return true; case "createcacheifnotexist": @@ -60,7 +59,6 @@ public class CaffeineLoadCacheEndpointConfigurer extends PropertyConfigurerSuppo Map<String, Object> answer = new CaseInsensitiveMap(); answer.put("action", java.lang.String.class); answer.put("basicPropertyBinding", boolean.class); - answer.put("cache", com.github.benmanes.caffeine.cache.Cache.class); answer.put("cacheLoader", com.github.benmanes.caffeine.cache.CacheLoader.class); answer.put("createCacheIfNotExist", boolean.class); answer.put("evictionType", org.apache.camel.component.caffeine.EvictionType.class); @@ -86,7 +84,6 @@ public class CaffeineLoadCacheEndpointConfigurer extends PropertyConfigurerSuppo case "action": return target.getConfiguration().getAction(); case "basicpropertybinding": case "basicPropertyBinding": return target.isBasicPropertyBinding(); - case "cache": return target.getConfiguration().getCache(); case "cacheloader": case "cacheLoader": return target.getConfiguration().getCacheLoader(); case "createcacheifnotexist": diff --git a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json index 8135720..f623e80 100644 --- a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json +++ b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/cache/caffeine-cache.json @@ -24,7 +24,6 @@ }, "componentProperties": { "action": { "kind": "property", "displayName": "Action", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence." }, - "cache": { "kind": "property", "displayName": "Cache", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.Cache", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure an already instantiated cache to be used" }, "cacheLoader": { "kind": "property", "displayName": "Cache Loader", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.CacheLoader", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure a CacheLoader in case of a LoadCache use" }, "createCacheIfNotExist": { "kind": "property", "displayName": "Create Cache If Not Exist", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Configure if a cache need to be created if it does exist or can't be pre-configured." }, "evictionType": { "kind": "property", "displayName": "Eviction Type", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.caffeine.EvictionType", "enum": [ "size_based", "time_based" ], "deprecated": false, "secret": false, "defaultValue": "SIZE_BASED", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Set the eviction Type for thi [...] @@ -45,7 +44,6 @@ "properties": { "cacheName": { "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "the cache name" }, "action": { "kind": "parameter", "displayName": "Action", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence." }, - "cache": { "kind": "parameter", "displayName": "Cache", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.Cache", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure an already instantiated cache to be used" }, "cacheLoader": { "kind": "parameter", "displayName": "Cache Loader", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.CacheLoader", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure a CacheLoader in case of a LoadCache use" }, "createCacheIfNotExist": { "kind": "parameter", "displayName": "Create Cache If Not Exist", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Configure if a cache need to be created if it does exist or can't be pre-configured." }, "evictionType": { "kind": "parameter", "displayName": "Eviction Type", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.caffeine.EvictionType", "enum": [ "size_based", "time_based" ], "deprecated": false, "secret": false, "defaultValue": "SIZE_BASED", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Set the eviction Type for th [...] diff --git a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json index 4afc151..33476c9 100644 --- a/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json +++ b/components/camel-caffeine/src/generated/resources/org/apache/camel/component/caffeine/load/caffeine-loadcache.json @@ -24,7 +24,6 @@ }, "componentProperties": { "action": { "kind": "property", "displayName": "Action", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence." }, - "cache": { "kind": "property", "displayName": "Cache", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.Cache", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure an already instantiated cache to be used" }, "cacheLoader": { "kind": "property", "displayName": "Cache Loader", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.CacheLoader", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure a CacheLoader in case of a LoadCache use" }, "createCacheIfNotExist": { "kind": "property", "displayName": "Create Cache If Not Exist", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Configure if a cache need to be created if it does exist or can't be pre-configured." }, "evictionType": { "kind": "property", "displayName": "Eviction Type", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.caffeine.EvictionType", "enum": [ "size_based", "time_based" ], "deprecated": false, "secret": false, "defaultValue": "SIZE_BASED", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Set the eviction Type for thi [...] @@ -45,7 +44,6 @@ "properties": { "cacheName": { "kind": "path", "displayName": "Cache Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "the cache name" }, "action": { "kind": "parameter", "displayName": "Action", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence." }, - "cache": { "kind": "parameter", "displayName": "Cache", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.Cache", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure an already instantiated cache to be used" }, "cacheLoader": { "kind": "parameter", "displayName": "Cache Loader", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "com.github.benmanes.caffeine.cache.CacheLoader", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "To configure a CacheLoader in case of a LoadCache use" }, "createCacheIfNotExist": { "kind": "parameter", "displayName": "Create Cache If Not Exist", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Configure if a cache need to be created if it does exist or can't be pre-configured." }, "evictionType": { "kind": "parameter", "displayName": "Eviction Type", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.caffeine.EvictionType", "enum": [ "size_based", "time_based" ], "deprecated": false, "secret": false, "defaultValue": "SIZE_BASED", "configurationClass": "org.apache.camel.component.caffeine.CaffeineConfiguration", "configurationField": "configuration", "description": "Set the eviction Type for th [...] diff --git a/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc b/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc index 2803b8b..72aaff7 100644 --- a/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc +++ b/components/camel-caffeine/src/main/docs/caffeine-cache-component.adoc @@ -41,7 +41,7 @@ format, `?option=value&option=#beanRef&...` // component options: START -The Caffeine Cache component supports 18 options, which are listed below. +The Caffeine Cache component supports 17 options, which are listed below. @@ -49,7 +49,6 @@ The Caffeine Cache component supports 18 options, which are listed below. |=== | Name | Description | Default | Type | *action* (producer) | To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence. | | String -| *cache* (producer) | To configure an already instantiated cache to be used | | Cache | *cacheLoader* (producer) | To configure a CacheLoader in case of a LoadCache use | | CacheLoader | *createCacheIfNotExist* (producer) | Configure if a cache need to be created if it does exist or can't be pre-configured. | true | boolean | *evictionType* (producer) | Set the eviction Type for this cache. There are 2 enums and the value can be one of: size_based, time_based | SIZE_BASED | EvictionType @@ -90,14 +89,13 @@ with the following path and query parameters: |=== -=== Query Parameters (18 parameters): +=== Query Parameters (17 parameters): [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type | *action* (producer) | To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence. | | String -| *cache* (producer) | To configure an already instantiated cache to be used | | Cache | *cacheLoader* (producer) | To configure a CacheLoader in case of a LoadCache use | | CacheLoader | *createCacheIfNotExist* (producer) | Configure if a cache need to be created if it does exist or can't be pre-configured. | true | boolean | *evictionType* (producer) | Set the eviction Type for this cache. There are 2 enums and the value can be one of: size_based, time_based | SIZE_BASED | EvictionType @@ -129,8 +127,8 @@ protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() { from("direct://start") - .toF("caffeine-cache://%s?cache=#cache&action=PUT&key=1", "test") - .toF("caffeine-cache://%s?cache=#cache&key=1&action=GET", "test") + .to("caffeine-cache://cache?action=PUT&key=1") + .to("caffeine-cache://cache?key=1&action=GET") .log("Test! ${body}") .to("mock:result"); } diff --git a/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc b/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc index 0be6cc3..32f1316 100644 --- a/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc +++ b/components/camel-caffeine/src/main/docs/caffeine-loadcache-component.adoc @@ -41,7 +41,7 @@ format, `?option=value&option=#beanRef&...` // component options: START -The Caffeine LoadCache component supports 18 options, which are listed below. +The Caffeine LoadCache component supports 17 options, which are listed below. @@ -49,7 +49,6 @@ The Caffeine LoadCache component supports 18 options, which are listed below. |=== | Name | Description | Default | Type | *action* (producer) | To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence. | | String -| *cache* (producer) | To configure an already instantiated cache to be used | | Cache | *cacheLoader* (producer) | To configure a CacheLoader in case of a LoadCache use | | CacheLoader | *createCacheIfNotExist* (producer) | Configure if a cache need to be created if it does exist or can't be pre-configured. | true | boolean | *evictionType* (producer) | Set the eviction Type for this cache. There are 2 enums and the value can be one of: size_based, time_based | SIZE_BASED | EvictionType @@ -90,14 +89,13 @@ with the following path and query parameters: |=== -=== Query Parameters (18 parameters): +=== Query Parameters (17 parameters): [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type | *action* (producer) | To configure the default cache action. If an action is set in the message header, then the operation from the header takes precedence. | | String -| *cache* (producer) | To configure an already instantiated cache to be used | | Cache | *cacheLoader* (producer) | To configure a CacheLoader in case of a LoadCache use | | CacheLoader | *createCacheIfNotExist* (producer) | Configure if a cache need to be created if it does exist or can't be pre-configured. | true | boolean | *evictionType* (producer) | Set the eviction Type for this cache. There are 2 enums and the value can be one of: size_based, time_based | SIZE_BASED | EvictionType diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConfiguration.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConfiguration.java index 101f19c..3655031 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConfiguration.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/CaffeineConfiguration.java @@ -16,7 +16,6 @@ */ package org.apache.camel.component.caffeine; -import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.CacheLoader; import com.github.benmanes.caffeine.cache.RemovalListener; import com.github.benmanes.caffeine.cache.stats.StatsCounter; @@ -37,8 +36,6 @@ public class CaffeineConfiguration implements Cloneable { @UriParam(label = "advanced") private String valueType; @UriParam(label = "producer") - private Cache cache; - @UriParam(label = "producer") private CacheLoader cacheLoader; @UriParam(label = "producer") private boolean statsEnabled; @@ -117,17 +114,6 @@ public class CaffeineConfiguration implements Cloneable { this.valueType = valueType; } - public Cache getCache() { - return cache; - } - - /** - * To configure an already instantiated cache to be used - */ - public void setCache(Cache cache) { - this.cache = cache; - } - public CacheLoader getCacheLoader() { return cacheLoader; } diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java index c8b86d8..bf64db8 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheEndpoint.java @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; import org.apache.camel.Category; +import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; @@ -30,6 +31,7 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; +import org.apache.camel.support.CamelContextHelper; import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.util.ObjectHelper; @@ -48,8 +50,7 @@ public class CaffeineCacheEndpoint extends DefaultEndpoint { private Cache cache; - CaffeineCacheEndpoint(String uri, CaffeineCacheComponent component, String cacheName, - CaffeineConfiguration configuration) throws Exception { + CaffeineCacheEndpoint(String uri, Component component, String cacheName, CaffeineConfiguration configuration) { super(uri, component); this.cacheName = cacheName; @@ -58,15 +59,14 @@ public class CaffeineCacheEndpoint extends DefaultEndpoint { @Override public Producer createProducer() throws Exception { - return new CaffeineCacheProducer(this, this.cacheName, configuration, cache); + return new CaffeineCacheProducer(this, configuration, cache); } @Override protected void doStart() throws Exception { - if (ObjectHelper.isNotEmpty(configuration.getCache())) { - cache = configuration.getCache(); - } else { - Caffeine<Object, Object> builder = Caffeine.newBuilder(); + cache = CamelContextHelper.lookup(getCamelContext(), cacheName, Cache.class); + if (cache == null) { + Caffeine<?, ?> builder = Caffeine.newBuilder(); if (configuration.getEvictionType() == EvictionType.SIZE_BASED) { builder.initialCapacity(configuration.getInitialCapacity()); builder.maximumSize(configuration.getMaximumSize()); @@ -78,7 +78,7 @@ public class CaffeineCacheEndpoint extends DefaultEndpoint { if (ObjectHelper.isEmpty(configuration.getStatsCounter())) { builder.recordStats(); } else { - builder.recordStats(() -> configuration.getStatsCounter()); + builder.recordStats(configuration::getStatsCounter); } } if (ObjectHelper.isNotEmpty(configuration.getRemovalListener())) { diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducer.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducer.java index 63a274f..10f53b8 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducer.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducer.java @@ -32,8 +32,8 @@ public class CaffeineCacheProducer extends HeaderSelectorProducer { private final CaffeineConfiguration configuration; private final Cache cache; - public CaffeineCacheProducer(CaffeineCacheEndpoint endpoint, String cacheName, CaffeineConfiguration configuration, - Cache cache) throws Exception { + public CaffeineCacheProducer(CaffeineCacheEndpoint endpoint, CaffeineConfiguration configuration, + Cache cache) { super(endpoint, CaffeineConstants.ACTION, configuration::getAction); this.configuration = configuration; this.cache = cache; diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java index c76f4b9..6e09285 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheEndpoint.java @@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.LoadingCache; import org.apache.camel.Category; +import org.apache.camel.Component; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.Producer; @@ -30,6 +31,7 @@ import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; +import org.apache.camel.support.CamelContextHelper; import org.apache.camel.support.DefaultEndpoint; import org.apache.camel.util.ObjectHelper; @@ -48,8 +50,7 @@ public class CaffeineLoadCacheEndpoint extends DefaultEndpoint { private LoadingCache cache; - CaffeineLoadCacheEndpoint(String uri, CaffeineLoadCacheComponent component, String cacheName, - CaffeineConfiguration configuration) throws Exception { + CaffeineLoadCacheEndpoint(String uri, Component component, String cacheName, CaffeineConfiguration configuration) { super(uri, component); this.cacheName = cacheName; @@ -58,14 +59,13 @@ public class CaffeineLoadCacheEndpoint extends DefaultEndpoint { @Override public Producer createProducer() throws Exception { - return new CaffeineLoadCacheProducer(this, this.cacheName, configuration, cache); + return new CaffeineLoadCacheProducer(this, configuration, cache); } @Override protected void doStart() throws Exception { - if (ObjectHelper.isNotEmpty(configuration.getCache())) { - cache = (LoadingCache) configuration.getCache(); - } else { + cache = CamelContextHelper.lookup(getCamelContext(), cacheName, LoadingCache.class); + if (cache == null) { Caffeine<Object, Object> builder = Caffeine.newBuilder(); if (configuration.getEvictionType() == EvictionType.SIZE_BASED) { builder.initialCapacity(configuration.getInitialCapacity()); @@ -78,7 +78,7 @@ public class CaffeineLoadCacheEndpoint extends DefaultEndpoint { if (ObjectHelper.isEmpty(configuration.getStatsCounter())) { builder.recordStats(); } else { - builder.recordStats(() -> configuration.getStatsCounter()); + builder.recordStats(configuration::getStatsCounter); } } if (ObjectHelper.isNotEmpty(configuration.getRemovalListener())) { diff --git a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheProducer.java b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheProducer.java index e2d5e72..bc856b5 100644 --- a/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheProducer.java +++ b/components/camel-caffeine/src/main/java/org/apache/camel/component/caffeine/load/CaffeineLoadCacheProducer.java @@ -32,8 +32,8 @@ public class CaffeineLoadCacheProducer extends HeaderSelectorProducer { private final CaffeineConfiguration configuration; private final LoadingCache cache; - public CaffeineLoadCacheProducer(CaffeineLoadCacheEndpoint endpoint, String cacheName, CaffeineConfiguration configuration, - LoadingCache cache) throws Exception { + public CaffeineLoadCacheProducer(CaffeineLoadCacheEndpoint endpoint, CaffeineConfiguration configuration, + LoadingCache cache) { super(endpoint, CaffeineConstants.ACTION, configuration::getAction); this.configuration = configuration; this.cache = cache; diff --git a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerMultiOperationSameCacheTest.java b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerMultiOperationSameCacheTest.java index 38bd472..698ac73 100644 --- a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerMultiOperationSameCacheTest.java +++ b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerMultiOperationSameCacheTest.java @@ -52,8 +52,9 @@ public class CaffeineCacheProducerMultiOperationSameCacheTest extends CaffeineCa protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct://start").toF("caffeine-cache://%s?cache=#cache&action=PUT&key=1", "test") - .toF("caffeine-cache://%s?cache=#cache&key=1&action=GET", "test") + from("direct://start") + .to("caffeine-cache://cache?action=PUT&key=1") + .to("caffeine-cache://cache?key=1&action=GET") .to("log:org.apache.camel.component.caffeine?level=INFO&showAll=true&multiline=true") .log("Test! ${body}") .to("mock:result"); diff --git a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerTest.java b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerTest.java index 3278efb..2f4174e 100644 --- a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerTest.java +++ b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheProducerTest.java @@ -219,7 +219,8 @@ public class CaffeineCacheProducerTest extends CaffeineCacheTestSupport { protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct://start").toF("caffeine-cache://%s?cache=#cache", "test") + from("direct://start") + .to("caffeine-cache://cache") .to("log:org.apache.camel.component.caffeine?level=INFO&showAll=true&multiline=true") .to("mock:result"); } diff --git a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheRemovaListenerProducerTest.java b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheRemovaListenerProducerTest.java index 3c2d0db..e72d64b 100644 --- a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheRemovaListenerProducerTest.java +++ b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheRemovaListenerProducerTest.java @@ -219,7 +219,8 @@ public class CaffeineCacheRemovaListenerProducerTest extends CaffeineCacheTestSu protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct://start").toF("caffeine-cache://%s?cache=#cacheRl", "test") + from("direct://start") + .to("caffeine-cache://cacheRl") .to("log:org.apache.camel.component.caffeine?level=INFO&showAll=true&multiline=true") .to("mock:result"); } diff --git a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java index 47d8ce1..a8cb4e6 100644 --- a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java +++ b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/cache/CaffeineCacheStatsCounterProducerTest.java @@ -60,7 +60,8 @@ public class CaffeineCacheStatsCounterProducerTest extends CaffeineCacheTestSupp protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct://start").toF("caffeine-cache://%s?cache=#cacheSc", "test") + from("direct://start") + .to("caffeine-cache://cacheSc") .to("log:org.apache.camel.component.caffeine?level=INFO&showAll=true&multiline=true") .to("mock:result"); } diff --git a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerMultiOperationSameCacheTest.java b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerMultiOperationSameCacheTest.java index 8b6df8c..c4cb382 100644 --- a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerMultiOperationSameCacheTest.java +++ b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerMultiOperationSameCacheTest.java @@ -52,8 +52,9 @@ public class CaffeineLoadCacheProducerMultiOperationSameCacheTest extends Caffei protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct://start").toF("caffeine-loadcache://%s?cache=#cache&action=PUT&key=1", "test") - .toF("caffeine-loadcache://%s?cache=#cache&key=1&action=GET", "test") + from("direct://start") + .to("caffeine-loadcache://cache?action=PUT&key=1") + .to("caffeine-loadcache://cache?key=1&action=GET") .to("log:org.apache.camel.component.caffeine?level=INFO&showAll=true&multiline=true") .log("Test! ${body}") .to("mock:result"); diff --git a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerTest.java b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerTest.java index 648978b..f5d7727 100644 --- a/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerTest.java +++ b/components/camel-caffeine/src/test/java/org/apache/camel/component/caffeine/loadcache/CaffeineLoadCacheProducerTest.java @@ -206,7 +206,8 @@ public class CaffeineLoadCacheProducerTest extends CaffeineLoadCacheTestSupport protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { - from("direct://start").toF("caffeine-loadcache://%s?cache=#cache", "test") + from("direct://start") + .to("caffeine-loadcache://cache") .to("log:org.apache.camel.component.caffeine?level=INFO&showAll=true&multiline=true") .to("mock:result"); } diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineCacheComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineCacheComponentBuilderFactory.java index 4636b95..d4cad32 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineCacheComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineCacheComponentBuilderFactory.java @@ -61,19 +61,6 @@ public interface CaffeineCacheComponentBuilderFactory { return this; } /** - * To configure an already instantiated cache to be used. - * - * The option is a: - * <code>com.github.benmanes.caffeine.cache.Cache</code> type. - * - * Group: producer - */ - default CaffeineCacheComponentBuilder cache( - com.github.benmanes.caffeine.cache.Cache cache) { - doSetProperty("cache", cache); - return this; - } - /** * To configure a CacheLoader in case of a LoadCache use. * * The option is a: @@ -315,7 +302,6 @@ public interface CaffeineCacheComponentBuilderFactory { Object value) { switch (name) { case "action": getOrCreateConfiguration((CaffeineCacheComponent) component).setAction((java.lang.String) value); return true; - case "cache": getOrCreateConfiguration((CaffeineCacheComponent) component).setCache((com.github.benmanes.caffeine.cache.Cache) value); return true; case "cacheLoader": getOrCreateConfiguration((CaffeineCacheComponent) component).setCacheLoader((com.github.benmanes.caffeine.cache.CacheLoader) value); return true; case "createCacheIfNotExist": getOrCreateConfiguration((CaffeineCacheComponent) component).setCreateCacheIfNotExist((boolean) value); return true; case "evictionType": getOrCreateConfiguration((CaffeineCacheComponent) component).setEvictionType((org.apache.camel.component.caffeine.EvictionType) value); return true; diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineLoadcacheComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineLoadcacheComponentBuilderFactory.java index a598c25..5ef026b 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineLoadcacheComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/CaffeineLoadcacheComponentBuilderFactory.java @@ -62,19 +62,6 @@ public interface CaffeineLoadcacheComponentBuilderFactory { return this; } /** - * To configure an already instantiated cache to be used. - * - * The option is a: - * <code>com.github.benmanes.caffeine.cache.Cache</code> type. - * - * Group: producer - */ - default CaffeineLoadcacheComponentBuilder cache( - com.github.benmanes.caffeine.cache.Cache cache) { - doSetProperty("cache", cache); - return this; - } - /** * To configure a CacheLoader in case of a LoadCache use. * * The option is a: @@ -318,7 +305,6 @@ public interface CaffeineLoadcacheComponentBuilderFactory { Object value) { switch (name) { case "action": getOrCreateConfiguration((CaffeineLoadCacheComponent) component).setAction((java.lang.String) value); return true; - case "cache": getOrCreateConfiguration((CaffeineLoadCacheComponent) component).setCache((com.github.benmanes.caffeine.cache.Cache) value); return true; case "cacheLoader": getOrCreateConfiguration((CaffeineLoadCacheComponent) component).setCacheLoader((com.github.benmanes.caffeine.cache.CacheLoader) value); return true; case "createCacheIfNotExist": getOrCreateConfiguration((CaffeineLoadCacheComponent) component).setCreateCacheIfNotExist((boolean) value); return true; case "evictionType": getOrCreateConfiguration((CaffeineLoadCacheComponent) component).setEvictionType((org.apache.camel.component.caffeine.EvictionType) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineCacheEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineCacheEndpointBuilderFactory.java index fee8ae0..1ec7586 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineCacheEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineCacheEndpointBuilderFactory.java @@ -52,30 +52,6 @@ public interface CaffeineCacheEndpointBuilderFactory { return this; } /** - * To configure an already instantiated cache to be used. - * - * The option is a: - * <code>com.github.benmanes.caffeine.cache.Cache</code> type. - * - * Group: producer - */ - default CaffeineCacheEndpointBuilder cache(Object cache) { - doSetProperty("cache", cache); - return this; - } - /** - * To configure an already instantiated cache to be used. - * - * The option will be converted to a - * <code>com.github.benmanes.caffeine.cache.Cache</code> type. - * - * Group: producer - */ - default CaffeineCacheEndpointBuilder cache(String cache) { - doSetProperty("cache", cache); - return this; - } - /** * To configure a CacheLoader in case of a LoadCache use. * * The option is a: diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineLoadCacheEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineLoadCacheEndpointBuilderFactory.java index 00d47da..9987d83 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineLoadCacheEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CaffeineLoadCacheEndpointBuilderFactory.java @@ -52,30 +52,6 @@ public interface CaffeineLoadCacheEndpointBuilderFactory { return this; } /** - * To configure an already instantiated cache to be used. - * - * The option is a: - * <code>com.github.benmanes.caffeine.cache.LoadingCache</code> type. - * - * Group: producer - */ - default CaffeineLoadCacheEndpointBuilder cache(Object cache) { - doSetProperty("cache", cache); - return this; - } - /** - * To configure an already instantiated cache to be used. - * - * The option will be converted to a - * <code>com.github.benmanes.caffeine.cache.LoadingCache</code> type. - * - * Group: producer - */ - default CaffeineLoadCacheEndpointBuilder cache(String cache) { - doSetProperty("cache", cache); - return this; - } - /** * To configure a CacheLoader in case of a LoadCache use. * * The option is a: diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_6.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_6.adoc index c912b7b..c31991d 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_6.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_6.adoc @@ -100,3 +100,23 @@ public class Application { ==== As a consequence of this change, the Camel Spring Boot starters have been amended to use Customizers instead of creating instances of components, languages or data formats. ==== + + +=== Camel Caffein + +To configure the component to use a pre-configured cache, it is not more required to use the now removed `cache` option as the component perorm a look-up from the registry based on the `cacheName` URI param. + +As example, the following code: + + +[source,java] +---- +.to("caffeine-cache://cache?cache=#myCache&action=PUT&key=1") +---- + +Should eb repolaced by: + +[source,java] +---- +.to("caffeine-cache://myCache?action=PUT&key=1") +---- \ No newline at end of file