根据专家的建议,我正在尝试使用 Camel(2.18.2) + karaf(4.0.8)+blueprint(Aries) 进行迁移。
我将文件分隔为 Routes XML 文件和 Beans XML 文件。RouteXml-> 它只有 Camel Routes BeanXml-> 它只有 bean 定义
结构::
Bundle-Conf/OSGI-INF/blueprint/rootCamelContext.xml
Bundle-A/OSGI-INF/blueprint/RouteContextA.xml
/OSGI-INF/blueprint/BeansA2.xml
Bundle-B/OSGI-INF/blueprint/RouteContextB.xml
/OSGI-INF/blueprint/BeansB2.xml
karaf/Config/Routes/RoutesA1.xml
karaf/Config/Routes/RoutesB1.xml
rootCamelContext.xml -> it has CamelContext and Has some routes and beans defined .
RouteContextA.xml-> it has <RouteContex> with some routes
RoutesA1.xml-> it has <Routes> with some routes
BeansA2.xml-> it has <Blueprint> with some beans
RouteContextB.xml-> it has <RouteContex> with some routes
RoutesB1.xml-> it has <Routes> with some routes
BeansB2.xml-> it has <Blueprint> with some beans
现在 rootCamelContext.xml 加载正常。但其他捆绑 A 和 B 路线未加载。
问题: 1. 如何从 Bundle A 和 Bundle B 加载路由和 Bean?2. 如何将 bundle A 和 B 路由附加到 rootCamelContext ?
请帮助我了解如何从其他捆绑包中加载 bean。
我确实从其他捆绑包中导出了所有包。
更新
我现在得到原因:org.apache.camel.NoSuchBeanException:在注册表中找不到 bean:customBeanProcessor 类型:org.apache.camel.Processor
即使我在 Bundle-B 中公开了上面的 bean 并且它的状态是活动的。
karaf-root()>ls |grep -i custom
[org.apache.camel.Processor, com.rnd.model.impl.CustomServiceProcessorBase, com.rnd.generic.CustomServiceProcessor]
osgi.service.blueprint.compname = customBeanProcessor
谢谢,