You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/08/02 11:14:55 UTC

[GitHub] [camel-k] pjcubero edited a comment on issue #1649: Caffeine with Knative doesn't work

pjcubero edited a comment on issue #1649:
URL: https://github.com/apache/camel-k/issues/1649#issuecomment-667660569


   For example, If I run this integration:
   
   import org.apache.camel.builder.RouteBuilder;
   
   public class EjemploCache extends RouteBuilder {
   	@Override
   	public void configure() throws Exception {
   		from("timer:tick")
   			.setBody(constant("Hello"))
   			.setHeader("CamelCaffeineAction", constant("PUT"))
   			.setHeader("CamelCaffeineKey", constant("1"))
   			.toF("caffeine-cache://%s", "test")
   			.log("Result of Action ${header.CamelCaffeineAction} with key ${header.CamelCaffeineKey} is: ${body}")
   			.setBody(constant(null))
   			.setHeader("CamelCaffeineAction", constant("GET"))
   			.setHeader("CamelCaffeineKey", constant("1"))
   			.toF("caffeine-cache://%s", "test")
   			.log("Result of Action ${header.CamelCaffeineAction} with key ${header.CamelCaffeineKey} is: ${body}")
   			.setBody(constant(null))
   			.setHeader("CamelCaffeineAction", constant("INVALIDATE"))
   			.setHeader("CamelCaffeineKey", constant("1"))
   			.log("Invalidating entry with key ${header.CamelCaffeineKey}")
   			.toF("caffeine-cache://%s", "test")
   			.setHeader("CamelCaffeineAction", constant("GET"))
   			.setHeader("CamelCaffeineKey", constant("1"))
   			.toF("caffeine-cache://%s", "test")
   			.log("The Action ${header.CamelCaffeineAction} with key ${header.CamelCaffeineKey} has result? ${header.CamelCaffeineActionHasResult}");
     }
   }
   
   **it's working fine. But If I try to run this:**
   
   import org.apache.camel.builder.RouteBuilder;
   import org.apache.camel.BindToRegistry;
   
   import com.github.benmanes.caffeine.cache.Cache;
   import com.github.benmanes.caffeine.cache.Caffeine;
   
   import java.util.concurrent.TimeUnit;
   
   public class ConsumidorCambios extends RouteBuilder {
   
     @Override
     public void configure() throws Exception {    
   
         // Write your routes here, for example:
         from("knative:endpoint/consumidor-cambios")
           .to("caffeine-cache://ejemplo?cache=#cache&action=PUT&key=token")
           .setBody().simple("Hola Mundo")
           .log("Before Read Cache! ${body}")
           .to("caffeine-cache://ejemplo?cache=#cache&action=GET&key=token") // Puedes añadir o no el parámetro cache pero claro primero debe estar vinculado, es decir haber echo una acción previamente
           .log("Test! ${body}")
           .setBody()
             .simple("Respuesta desde el endpoint de cambios ${date:now}")
           .to("log:info");
   
     }
   }
   
   this is not deployed properly, and at the end I see the error: 
   
   **integration deployment failed**


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org