[ 
https://issues.apache.org/jira/browse/CAMEL-10230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15414880#comment-15414880
 ] 

Claus Ibsen commented on CAMEL-10230:
-------------------------------------

It likely depends on the ordering of the endpoints created/started. As eternal 
is false by default. So its the first endpoint with that cache name that gets 
created that decide if eternal is enabled or not.



> Items in the cache expires even though eternal is set to true.
> --------------------------------------------------------------
>
>                 Key: CAMEL-10230
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10230
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cache
>    Affects Versions: 2.16.2
>         Environment: Camel 2.16.2 - ServiceMix 7.0.0.M2
>            Reporter: Sebastián Laborde
>              Labels: camel-cache
>
> Items in the cache expires even though eternal is set to true. When a new 
> element is added to the cache, its properties are set to its default values.
> Only seems to work as expected if I put the cache properties into the route 
> itself everytime I add a new item into the cache (see below, bolded text). 
> CacheRouteBuilder:
> package uy.com.antel.pi.osgi.cache;
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.component.cache.CacheConstants;
> public class CacheRouteBuilder extends RouteBuilder {
>       private CacheAggregationStrategy CAS = new CacheAggregationStrategy();
>       
>       @Override
>       public void configure() throws Exception {
>               // TODO Auto-generated method stub
>               
>               // Set up Cache
>               
> from("cache://MyApplicationCache?eternal=true&diskPersistent=true")
>                       .to("mock:endpoint");
>               
>               // CXFRS Entry Point
>               from("cxfrs:bean:rsServer?bindingStyle=SimpleConsumer")
>                       .log("GET Request Received...")
>                       .choice()
>                               
> .when(header("operationName").isEqualTo("addEntry"))
>                                       .log("In add entry choice")
>                                       .log("${headers}")
>                                       .to("bean:restImplBean?method=addEntry")
>                                       
> .to("cache://MyApplicationCache*?eternal=true&diskPersistent=true*")
>                                       
> .to("bean:restImplBean?method=addedEntry")
>                               
> .when(header("operationName").isEqualTo("getEntry"))
>                                       .log("In get entry choice")
>                                       .to("bean:restImplBean?method=getEntry")
>                                       .to("cache://MyApplicationCache")
>                                       .log("${headers}")
>                                       .choice()
>                                               
> .when(header(CacheConstants.CACHE_ELEMENT_WAS_FOUND).isNull())
>                                       .to("bean:restImplBean?method=notFound")
>                                       .otherwise()
>                                       .to("bean:restImplBean?method=gotEntry")
>                                   .end()
>                       .end();
>               
>               }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to