I'm trying to run camel-k with jdbc locally with the following configuration.
Integration DSL KamelKJdbcRouter.java:
import org.apache.camel.builder.RouteBuilder;
// camel-k: dependency=camel:jdbc
// camel-k: dependency=mvn:io.quarkus:quarkus-jdbc-postgresql
public class KamelKJdbcRouter extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer://foo?period=10000")
.setBody(constant("SELECT data FROM test LIMIT 5 OFFSET 0"))
.to("jdbc:default")
.to("log:info");
}
}
application.properties:
quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/test
quarkus.datasource.username=postgresadmin
quarkus.datasource.password=admin123
quarkus.datasource.db-kind=postgresql
Command:
jbang run -Dcamel.jbang.version=4.2.0 camel@apache/camel run KamelKJdbcRouter.java
But I get following error:
Caused by: java.lang.IllegalArgumentException: No default DataSource found in the registry
at org.apache.camel.component.jdbc.JdbcComponent.createEndpoint(JdbcComponent.java:67)
at org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:170)
at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:804)
... 34 more
It seems like quarkus build isn't kicking in and the datasource is not being created. The example works fine on k8s. I'm using camel-k with jbang with other components (like activemq) and they work fine.
Do you have any idea? Thanks!
camel-jbang does not understand quarkus specific connection pools and whatnot. However this may be something we can add to camel-jbang for a common feature like databases etc.
You can configure a generic datasource as a bean and let camel-jbang use that until we have something for camel-jbang OOTB. https://issues.apache.org/jira/browse/CAMEL-20681