我目前正在德国的一个项目上工作,该项目已经在Karaf内部使用了Camel。我想使用Camel K在Kubernetes集群中部署以Blueprint XML编写的示例Camel路由。在Karaf中定义和创建数据源很简单。在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中使用的数据源吗?
答案 0 :(得分:1)
您好,欢迎来到StackOverflow
您基本上会问如何在Camel K中定义Camel上下文中的自定义bean 。数据源定义等被定义为Camel上下文中的bean。
有关类似问题和示例答案,请参见this link。