Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
jamesnetherton closed issue #5962: camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository URL: https://github.com/apache/camel-quarkus/issues/5962 -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
jamesnetherton commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2049448519 I made some changes that should fix the `ClassNotFoundException` issues: https://github.com/apache/camel-quarkus/pull/5989 I'll follow up with another issue to adapt things further, after we get a resolution to [CAMEL-20654](https://issues.apache.org/jira/browse/CAMEL-20654). -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
jamesnetherton commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2047483573 > I'm thinking that these dependencies really shouldn't be necessary and perhaps should be included in the `camel-quarkus-spring-redis artifact`?? It's likely due to usage of `io.quarkus:quarkus-spring-data-commons-api`: https://github.com/apache/camel-quarkus/blob/main/extensions-jvm/spring-redis/runtime/pom.xml#L54-L57 Which is probably a shaded version of the original, with various packages excluded. We should probably just use the vanilla `org.springframework` one. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
JesperBerggren commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2047457958 Ok, I have it running but had to make two unexpected dependencies in the pom. First it complained about: `java.lang.ClassNotFoundException: org.springframework.data.util.CloseableIterator` I got past that by adding this dependency: ``` org.springframework.data spring-data-commons 3.2.4 ``` Then I complained about: `java.lang.ClassNotFoundException: org.springframework.expression.EvaluationContext` And I got past that by adding this dependency: ``` org.springframework spring-expression 6.1.5 ``` I'm thinking that these dependencies really shouldn't be necessary and perhaps should be included in the `camel-quarkus-spring-redis artifact`?? -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
JesperBerggren commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2044658945 I wonder what I'm missing. When I produce a bean of type RedisTemplate with this simple code: ``` public class Producers { @Produces @ApplicationScoped RedisTemplate produceRedisTemplate() { RedisConfiguration redisConfiguration = new RedisConfiguration(); redisConfiguration.setHost("localhost"); redisConfiguration.setPort(6379); RedisTemplate redisTemplate = (RedisTemplate) redisConfiguration.getRedisTemplate(); redisTemplate.opsForSet(); LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisTemplate.getConnectionFactory(); assert lettuceConnectionFactory != null; Objects.requireNonNull(lettuceConnectionFactory.getSentinelConfiguration()).setPassword("password"); redisTemplate.getConnectionFactory().getConnection().serverCommands().flushDb(); return redisTemplate; } } ``` I get this exception that causes quarkus not to be able to start up. ``` java.lang.RuntimeException: java.lang.RuntimeException: Failed to start quarkus at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:643) at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:727) at java.base/java.util.Optional.orElseGet(Optional.java:364) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) Caused by: java.lang.RuntimeException: Failed to start quarkus at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source) at io.quarkus.runtime.Application.start(Application.java:101) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:285) at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:252) at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:610) at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:725) ... 2 more Caused by: java.lang.NoClassDefFoundError: org/springframework/data/util/CloseableIterator at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:508) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:468) at org.apache.camel.component.redis.RedisConfiguration.createDefaultTemplate(RedisConfiguration.java:160) at org.apache.camel.component.redis.RedisConfiguration.getRedisTemplate(RedisConfiguration.java:90) at dk.atp.integration.dp.kvitteringopsamler.Producers.produceRedisTemplate(Producers.java:22) at dk.atp.integration.dp.kvitteringopsamler.Producers_ProducerMethod_produceRedisTemplate_oXh1o33dh07G6QKT2LUDr_oOLFE_Bean.doCreate(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.Producers_ProducerMethod_produceRedisTemplate_oXh1o33dh07G6QKT2LUDr_oOLFE_Bean.create(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.Producers_ProducerMethod_produceRedisTemplate_oXh1o33dh07G6QKT2LUDr_oOLFE_Bean.get(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.Producers_ProducerMethod_produceRedisTemplate_oXh1o33dh07G6QKT2LUDr_oOLFE_Bean.get(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter_Bean.doCreate(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter_Bean.create(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter_Bean.create(Unknown Source) at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:119) at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38) at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35) at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.c19(Unknown Source) at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.computeIfAbsent(Unknown Source) at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:35) at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:21) at dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter_ClientProxy.arc$delegate(Unknown Source) at dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter_ClientProxy.arc_contextualInstance(Unknown
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
davsclaus commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2039505936 I created a ticket to see if we can make something generic https://issues.apache.org/jira/browse/CAMEL-20654 It will be useful for other components where you need to setup something that is common to configure via a set of key=value pairs. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
davsclaus commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2039499831 Yeah would be nice if quarkus could allow configuration form application properties - its very common and handy for setting this kind of stuff - instead of writing code all the time. And it would be needed for low-code effort like karavan/kaoto as well. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
jamesnetherton commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2039487972 > works quite differently in Quarkus than Spring Boot Yes. The 'spring' part of the extension name is a little misleading. It gives you the means to interact with Redis via a Spring backed library. But it doesn't provide you with full Spring framework support like the IOC container, auto configuration etc. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
JesperBerggren commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2039477088 Thanks for a quick reply! Ok, then it works quite differently in Quarkus than Spring Boot. In Spring Boot it enough to set something like this in application.properties ``` spring.data.redis.database=0 spring.data.redis.host=localhost spring.data.redis.port=6379 spring.data.redis.password=mypass spring.data.redis.timeout=6 ``` after which the a RedisTemplate bean can automatically be injected (without producing it manually). It seems smarter and more in line with e.g. the CamelContext which doesn't need to be produced manually in Quarkus. When I have something functional I'll post it for later reference if anybody else should be interested. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
jamesnetherton commented on issue #5962: URL: https://github.com/apache/camel-quarkus/issues/5962#issuecomment-2037264953 In order to `@Inject` `RedisTemplate` you need to [produce](https://quarkus.io/guides/cdi-reference#simplified-producer-method-declaration) a bean of that type somewhere in your application. If you don't need any special customisation of the `RedisTemplate`, then you can use the simplified constructor: https://github.com/apache/camel/blob/camel-4.4.1/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/processor/idempotent/RedisIdempotentRepository.java#L41-L47 -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[I] camel-quarkus-spring-redis doesn't autowire RedisTemplate so it cannot be used for e.g. RedisIdempotentRepository [camel-quarkus]
JesperBerggren opened a new issue, #5962: URL: https://github.com/apache/camel-quarkus/issues/5962 ### Bug description The extension _camel-quarkus-spring-redis_ doesn't seem to autowire _RedisTemplate_ which is needed for _RedisIdempotentRepository_. I've got this dependency: ``` org.apache.camel.quarkus camel-quarkus-spring-redis ``` And in my code I have something like this: ``` @ApplicationScoped public class CommonRoutes extends RouteBuilder { public static final int SUCCESS = 100; public static final int ERROR = 200; public static final int EXHAUSTED = 300; @ConfigProperty(name = "url") private String url; @ConfigProperty(name = "max.retry.count") private String maxRetryCnt; @ConfigProperty(name = "ordning") private String ordning; @Inject private CamelContext context; @Inject private RedisTemplate redisTemplate; @Override public void configure() throws Exception { // Redis idempotent repository RedisIdempotentRepository redisIdempotentRepository = new RedisIdempotentRepository(redisTemplate, "NGDP.KvitteringOpsamler"); context.getRegistry().bind("redisIdempotentRepo", redisIdempotentRepository); ... ``` But when I run my code I get these exceptions: ``` java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: jakarta.enterprise.inject.spi.DeploymentException: Found 4 deployment problems: [1] Unsatisfied dependency for type org.springframework.data.redis.core.RedisTemplate and qualifiers [@Default] - injection target: dk.atp.integration.dp.kvitteringopsamler.FileRouter#redisTemplate - declared on CLASS bean [types=[org.apache.camel.builder.BuilderSupport, org.apache.camel.Ordered, org.apache.camel.CamelContextAware, org.apache.camel.spi.ResourceAware, org.apache.camel.spi.HasCamelContext, dk.atp.integration.dp.kvitteringopsamler.FileRouter, org.apache.camel.RoutesBuilder, java.lang.Object, org.apache.camel.builder.ModelRoutesBuilder, org.apache.camel.builder.RouteBuilder], qualifiers=[@Default, @Any], target=dk.atp.integration.dp.kvitteringopsamler.FileRouter] [2] Unsatisfied dependency for type org.springframework.data.redis.core.RedisTemplate and qualifiers [@Default] - injection target: dk.atp.integration.dp.kvitteringopsamler.MailRouter#redisTemplate - declared on CLASS bean [types=[org.apache.camel.builder.BuilderSupport, org.apache.camel.Ordered, org.apache.camel.CamelContextAware, org.apache.camel.spi.ResourceAware, dk.atp.integration.dp.kvitteringopsamler.MailRouter, org.apache.camel.spi.HasCamelContext, org.apache.camel.RoutesBuilder, java.lang.Object, org.apache.camel.builder.ModelRoutesBuilder, org.apache.camel.builder.RouteBuilder], qualifiers=[@Default, @Any], target=dk.atp.integration.dp.kvitteringopsamler.MailRouter] [3] Unsatisfied dependency for type org.springframework.data.redis.core.RedisTemplate and qualifiers [@Default] - injection target: dk.atp.integration.dp.kvitteringopsamler.CommonRoutes#redisTemplate - declared on CLASS bean [types=[org.apache.camel.builder.BuilderSupport, org.apache.camel.Ordered, org.apache.camel.CamelContextAware, org.apache.camel.spi.ResourceAware, org.apache.camel.spi.HasCamelContext, org.apache.camel.RoutesBuilder, java.lang.Object, dk.atp.integration.dp.kvitteringopsamler.CommonRoutes, org.apache.camel.builder.ModelRoutesBuilder, org.apache.camel.builder.RouteBuilder], qualifiers=[@Default, @Any], target=dk.atp.integration.dp.kvitteringopsamler.CommonRoutes] [4] Unsatisfied dependency for type org.springframework.data.redis.core.RedisTemplate and qualifiers [@Default] - injection target: dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter#redisTemplate - declared on CLASS bean [types=[org.apache.camel.builder.BuilderSupport, org.apache.camel.Ordered, org.apache.camel.CamelContextAware, dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter, org.apache.camel.spi.ResourceAware, org.apache.camel.spi.HasCamelContext, org.apache.camel.RoutesBuilder, java.lang.Object, org.apache.camel.builder.ModelRoutesBuilder, org.apache.camel.builder.RouteBuilder], qualifiers=[@Default, @Any], target=dk.atp.integration.dp.kvitteringopsamler.DatabaseRouter] at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1516) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:320) at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:160) at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:488) at java.base/jdk.internal.reflect.Na