从Karaf OSGi中的Camel BLueprint DSL中的其他bundle加载bean的问题

时间:2017-03-08 03:03:42

标签: apache-camel apache-karaf aries

我正在尝试使用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:类型为:org.apache.camel.Processor的customBeanProcessor

即使我在Bundle-B中暴露了上面的bean,它的状态也是Active。

      karaf-root()>ls |grep -i custom
      [org.apache.camel.Processor, com.rnd.model.impl.CustomServiceProcessorBase, com.rnd.generic.CustomServiceProcessor]

osgi.service.blueprint.compname = customBeanProcessor

谢谢,

0 个答案:

没有答案