Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10230

Items in the cache expires even though eternal is set to true.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 2.16.2
    • None
    • camel-cache
    • Camel 2.16.2 - ServiceMix 7.0.0.M2

    Description

      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();

      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            slaborde Sebastián Laborde
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: