Different behaviours when trying to run integration in devmode
vs build/run container
#1016
Replies: 5 comments 4 replies
-
You class |
Beta Was this translation helpful? Give feedback.
-
And when I fix that and run it in dev mode with 4.3 then it startup, but lacks connection to the database Caused by: java.net.ConnectException: Connection refused So when you then deploy (then jbang export) as camel-main and that runs a bit differently as it runs this as general maven based project with compile to JAR |
Beta Was this translation helpful? Give feedback.
-
Okay so you are using spring annotations that only works with jbang (as jbang can simulate that). However karavan exports to camel-main. So you should use Camel annotations instead. So your code would be
|
Beta Was this translation helpful? Give feedback.
-
There is maybe a little bug with the field dependency injection so notice how its part of the method parameters. |
Beta Was this translation helpful? Give feedback.
-
stuff fixed in newer camel and karavan releases. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I'm experiencing two issues when running project in
devmode
(Run button) vsBuild / Run container
Issue #1: Camel jbang dependencies not being picked up in
devmode
**Integration I have uses some dependancies in beans (created and registered in .java file in project) that I added to
application.properties
file within projectFor example I've added two dependencies (
camel.jbang.dependencies
) to existing default ones:camel:sql,org.postgresql:postgresql:42.6.0
so that
org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository
can be constructed :If I run this project in devmode I get error indicating that dependency is missing and jbang did not resolve required dependencies:
/TestIntegrationIdempotentRepository.java:1: error: package org.apache.camel.processor.idempotent.jdbc does not exist import org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository;
while if I build and run this project, it works fine (well I get another error not related to this one, which I'll describe in Issue #2 below).
I must note that I discovered if i set
jBangOptions
inDevModeResource.java -> runProjectWithJBangOptions
to--deps=org.apache.camel:camel-sql:4.1.0,org.postgresql:postgresql:42.6.0,org.apache.commons:commons-dbcp2:2.10.0
devmode runs fine and picks up all dependencies.I'm a little bit puzzled why this different behaviour happens? Also since there is an
jBangOptions
param available in the controller, is there a way to send these options from the builder UI or this is not used?Issue #2: Integration containing IdempotentConsumer and beans required to run it runs correctly in
devmode
while when built/run container error is thrown**I'm trying to run simple integration that uses Idempotent Consumer which stores duplacate messages in IdempotentRepository (postgres db). Two beans are needed for this to work:
DataSource
bean andIdempotentRepository
beanIdempotentConsumer is then configured with
IdempotentRepository
. Idempotent repository bean example can be seen in Issue #1 (it's configured as Java file because I could not find a way to configure two dependant beans such we have in this case via builder or camel yaml specification):Integration with defined bean:
If I run in
devmode
this integration (with added .java file above), it runs fine and idempotent consumer works as expected (stores messages in configured DB viaDataSourceBean
) *BUT if I build and run in container, I get an error stating that TestIntegrationIdempotentRepository is not registered in registry and cannot be found:This is even a bigger puzzle for me because it seems as if
Testidempotentrepository
is not registered, but I wonder why? Why this works indevmode
but doesn't inbuild/run container
configuration, shouldn't the the procedure and configuration be the same underneath the hood when deploying these integrations?Beta Was this translation helpful? Give feedback.
All reactions