【发布时间】:2020-06-13 21:44:34
【问题描述】:
我目前正在德国开展一个项目,该项目已经在 Karaf 中使用 Camel。我想使用 Camel K 在 Kubernetes 集群内部署一个用 Blueprint XML 编写的示例 Camel 路由。在 Karaf 中定义和创建数据源很简单。在卡拉夫 CLI 只需执行:
karaf@root()> jdbc:ds-create -t derby -u test -i datasource01
然后在XML下面部署
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="datasource01" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="url" value="jdbc:derby:database01" />
</bean>
<bean id="datasource02" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="url" value="jdbc:derby:database02" />
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<...>
<to uri="jdbc:datasource01"/>
<...>
<to uri="jdbc:datasource02"/>
<...>
</route>
</camelContext>
</blueprint>
我已经在文档和 Web 上搜索了 Camel K 和 Kubernetes 数据源,但没有找到解决方案。有人知道如何在 Kubernetes 中使用 Camel K 创建 JDBC 组件 URI 中使用的数据源吗?
【问题讨论】:
-
我认为这是不可能的。我认为 apache camel 期望数据源已经存在。
标签: sql kubernetes apache-camel datasource