cesarjv commented on issue #6224:
URL: https://github.com/apache/camel-quarkus/issues/6224#issuecomment-2189654450

   @jamesnetherton  Ready I managed to solve, now I am enabling the elimination 
of the cache after a certain time, but I cannot eliminate it, that is, use the 
properties camel.component.caffeine-cache.expire-after-access-time and 
camel.component.caffeine-cache .expire-after-write-time, however, I am testing 
and after setting a time to 60 seconds, the query is still being done in the 
cache:
   
   #cache
   camel.component.caffeine-cache.expire-after-write-time=60
   camel.component.caffeine-cache.expire-after-access-time=60
   
   Test number 1 at 2:00 PM
   
   ![Screenshot 2024-06-25 
140040](https://github.com/apache/camel-quarkus/assets/31625237/0db308f3-9000-4fdf-be1a-3c30c7746332)
   
   Query the cache:
   
   ![Screenshot 2024-06-25 
140143](https://github.com/apache/camel-quarkus/assets/31625237/6840d934-f5da-4e74-805c-763f2ad6d7f8)
   
   Test number 2 at 2:04 PM, in this chaos 240 seconds have already passed 
since it was cached:
   
   ![prueba 4 minutos 
despues](https://github.com/apache/camel-quarkus/assets/31625237/cc72e2ed-51b6-4d5a-87f2-f2b9f1c3d2cb)
   
   Keep consulting the cache:
   
   ![Screenshot 2024-06-25 
140535](https://github.com/apache/camel-quarkus/assets/31625237/33a73a81-0537-4413-a01b-a75f0b634278)
   
   What could be the cause of this behavior? Shouldn't it be possible to 
consult the service again outside the cache after the expiration time (60sec)?
   
   This is how I ended up configuring my ResRoute
   
   ```
   @ApplicationScoped
   public class ResRoute extends RouteBuilder {
   
       @ConfigProperty(name = "client.findIndividualCustomerByDocId")
       String findIndividualCustomerByDocId;
       @ConfigProperty(name = "client.findOrganizacionCustomerByDocId")
       String findOrganizacionCustomerByDocId;
       @ConfigProperty(name = "path.openapi")
       String pathOpenapi;
       @ConfigProperty(name = "descripcion.servicio")
       String descripcionServicio;
       private ConfigureSsl configureSsl;
       private static final String SALIDA_BSS_EXCEPTION = "Salida del 
microservicio BSS FindCustomerByDocId ${exchangeProperty[bodyRs]}";
       private static final String MSG_EXCEPTION = "Descripcion de la 
Exception: ${exception.message}";
   
       public ResRoute() {
           configureSsl = new ConfigureSsl();
       }
   
       @Override
       public void configure() throws Exception {
   
           BeanDate beanDate= new BeanDate();
           getContext().getRegistry().bind("BeanDate",beanDate);
           restConfiguration()
                   .bindingMode(RestBindingMode.json)
                   .dataFormatProperty("json.in.disableFeatures", 
"FAIL_ON_UNKNOWN_PROPERTIES")
                   .apiContextPath(pathOpenapi)
                   .apiProperty("api.title", "FindCustomerByDocId")
                   .apiProperty("api.description", descripcionServicio)
                   .apiProperty("api.version", "1.0.0")
                   .apiProperty("cors", "true");
   
           rest("customerInformation/v1.4.0/users/")
                   
.get("/{user_id}/customers").to("direct:/{user_id}/customers")
                   .outType(Customer.class)
                   
.param().name("FindCustomerByDocIdResponse").type(body).description("parametro 
de salida").required(true)
                   .endParam()
                   .to("direct:pipeline");
   
           from("direct:pipeline")
                   .doTry()
                   .process(new FindCustomerByDocIdProcessorReq())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"User ID: 
${exchangeProperty[userId]}")
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+"Correlator ID: ${exchangeProperty[correlatorId]}")
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"Tipo de 
Documento (Num): ${exchangeProperty[documentTypeNum]}")
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"Tipo de 
Cliente: ${exchangeProperty[customerType]}")
                   .choice()
                   .when(simple("${exchangeProperty[customerType]} == 
'NATURAL'"))
                   .process(new FindIndividualCustomerByDocIdProcessorReq())
                   .setHeader(CaffeineConstants.ACTION, 
constant(CaffeineConstants.ACTION_GET))
                   
.setHeader(CaffeineConstants.KEY).exchangeProperty("documentNumber")
                   .toF("caffeine-cache://%s", "IndividualCache")
                   .log("Hay Resultado en Cache de la consulta asociado al 
siguiente documento: ${exchangeProperty[userId]} 
${header.CamelCaffeineActionHasResult}}")
                   .log("CamelCaffeineActionSucceeded: 
${header.CamelCaffeineActionSucceeded}")
                   
.choice().when(header(CaffeineConstants.ACTION_HAS_RESULT).isEqualTo(Boolean.FALSE))
                       .to(configureSsl.setupSSLContext(getCamelContext(), 
findIndividualCustomerByDocId))
                       .setHeader(CaffeineConstants.ACTION, 
constant(CaffeineConstants.ACTION_PUT))
                       
.setHeader(CaffeineConstants.KEY).exchangeProperty("documentNumber")
                       .toF("caffeine-cache://%s", "IndividualCache")
                       .process(new FindIndividualCustomerByDocIdProcessorRes())
                       .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+"Salida del microservicio FindIndividualCustomerByDocId 
${exchangeProperty[findIndividualCustomerByDocIdResponse]}")
                       .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+"Salida del microservicio BSS FindCustomerByDocId 
${exchangeProperty[findCustomerByDocIdResponse]}")
                   .otherwise()
                       .log("Cache is working")
                       .process(new FindIndividualCustomerByDocIdProcessorRes())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"Salida 
del microservicio FindIndividualCustomerByDocId 
${exchangeProperty[findIndividualCustomerByDocIdResponse]}")
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"Salida 
del microservicio BSS FindCustomerByDocId 
${exchangeProperty[findCustomerByDocIdResponse]}")
                   .when(simple("${exchangeProperty[customerType]} == 
'JURIDICO'"))
                   .process(new FindOrganizationCustomerByDocIdProcessorReq())
                   .to(configureSsl.setupSSLContext(getCamelContext(), 
findOrganizacionCustomerByDocId))
                   .process(new FindOrganizationCustomerByDocIdProcessorRes())
                   /*.log("\n["+getCurrentDate()+"]"+"Entrada del microservicio 
FindOrganizationCustomerByDocId 
${exchangeProperty[findOrganizationCustomerByDocIdRequest]}") */
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"Salida 
del microservicio FindOrganizationCustomerByDocId 
${exchangeProperty[findOrganizationCustomerByDocIdResponse]}")
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] "+"Salida 
del microservicio BSS FindCustomerByDocId 
${exchangeProperty[findCustomerByDocIdResponse]}")
                   .endChoice()
                   .endDoTry()
                   .doCatch(RequiredValueException.class)
                   .process(new 
FindCustomerByDocIdProcessorInvalidFormatException())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+MSG_EXCEPTION)
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+SALIDA_BSS_EXCEPTION)
                   .doCatch(HttpHostConnectException.class)
                   .process(new 
FindCustomerByDocIdProcessorHttpHostConectionException())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+MSG_EXCEPTION)
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+SALIDA_BSS_EXCEPTION)
                   .doCatch(NotFoundDataException.class)
                   .process(new 
FindCustomerByDocIdProcessorInformationSubscriber())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+MSG_EXCEPTION)
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+SALIDA_BSS_EXCEPTION)
                   .doCatch(UnknownHostException.class)
                   .process(new 
FindCustomerByDocIdProcessorHttpHostConectionException())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+MSG_EXCEPTION)
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+SALIDA_BSS_EXCEPTION)
                   .doCatch(NoHttpResponseException.class)
                   .process(new 
FindCustomerByDocIdProcessorHttpHostConectionException())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+MSG_EXCEPTION)
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+SALIDA_BSS_EXCEPTION)
                   .doCatch(Exception.class)
                   .process(new FindCustomerByDocIdProcessorException())
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+MSG_EXCEPTION)
                   .log("\n[${bean:BeanDate.getCurrentDateTime()}] 
"+SALIDA_BSS_EXCEPTION);
       }
   }
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to