简体   繁体   English

一个OSGi捆绑包中有多个骆驼蓝图?

[英]Multiple camel blueprints in one OSGi bundle?

I'm trying to figure out if I should package multiple blueprint.xml files in a single OSGi bundle that I want to deploy into karaf. 我试图弄清楚是否应该将多个blueprint.xml文件打包在一个要部署到karaf中的OSGi捆绑包中。 Each blueprint.xml file has one camel context. 每个blueprint.xml文件都有一个骆驼上下文。 I've tried to just throw all my blueprints into the OSGI-INF/blueprint folder, but I got an error saying 我试图将我所有的蓝图都扔到OSGI-INF / blueprint文件夹中,但是出现错误提示

Name 'jms' is already in use by a registered component

That seems to make sense, because I do this in every blueprint.xml 这似乎很有意义,因为我在每个blueprint.xml中都这样做

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory">
        <bean class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://0.0.0.0:61616"/>
            <property name="userName" value="karaf"/>
            <property name="password" value="karaf"/>
        </bean>
    </property>
</bean>

Should I even do that? 我应该这样做吗? Or would it be better for each CamelContext to be it's own bundle? 还是将每个CamelContext都捆绑在一起会更好? I've seen this https://camel.apache.org/manual/latest/faq/why-use-multiple-camelcontext.html and it says that multiple CamelContexts would make sense when they're deployed as isolated bundles. 我已经看到了这个https://camel.apache.org/manual/latest/faq/why-use-multiple-camelcontext.html ,它说到将多个CamelContext作为独立的包部署时才有意义。 So what's the best practice here: 那么,这里的最佳实践是什么:

  • Each CamelContext with it's own blueprint.xml, bundled with the necessary beans into an osgi-bundle? 每个带有自己的blueprint.xml的CamelContext,都与必要的bean捆绑成osgi-bundle吗?
  • One bundle for all necessary beans, and just drop the blueprint.xml files in karaf's deploy folder? 捆绑所有必需的bean,然后将blueprint.xml文件放入karaf的deploy文件夹中吗?
  • One CamelContext which imports all the other CamelContexts, bundled with all necessary beans? 一个CamelContext导入所有其他CamelContext,并捆绑所有必需的bean?

This is more of a question about service design, not Camel. 这更多是关于服务设计的问题,而不是骆驼。

Since a bundle is a deployment unit , I would first of all look at the different lifecycles of your code . 由于捆绑包是一个部署单元 ,因此我首先要研究代码不同生命周期

If some things must always be deployed together , if they cannot evolve individually , you can make one bundle containing them. 如果某些东西必须始终部署在一起 ,如果它们不能单独发展 ,则可以制作一个包含它们的捆绑包。 Simply because, in terms of releasing and deployment, you cannot profit from dividing the code into smaller units. 仅仅因为在发布和部署方面,您无法从将代码分成较小的单元中受益。

On the other hand, if something is evolving faster or slower and must therefore be deployed more often (or less often), you should put it in its own bundle . 另一方面,如果某些事物发展得更快或更慢 ,因此必须更频繁地(或更少地)部署,则应将其放在自己的捆绑包中

This way you are able to deploy code only when it really changes . 这样,您只有在代码真正更改时才能部署代码 In contrast to a giant EAR file to deploy a big monolithic application when only a small bugfix was implemented. 与仅实现一个小错误修正时部署一个大型整体应用程序的巨大EAR文件相反。

So, in summary, you can use more or less the microservice principles to "cut" your code into units. 因此,总而言之,您可以或多或少地使用微服务原则将代码“切割”为单元。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 基本的Apache Camel FileRoute部署为OSGi捆绑软件 - Basic Apache Camel FileRoute deployed as OSGi bundle 使用OSGi捆绑uri的Camel xquery端点 - Camel xquery endpoint with OSGi bundle uri 骆驼+保险丝中战争与osgi捆绑包之间的交叉通信 - Cross communication between war and osgi bundle in camel + fuse OSGi bundle部署策略最佳实践apache Camel - Best Practice of OSGi bundle deployment strategy with apache Camel osgi-karaf-服务和骆驼路线的多种版本 - osgi-karaf-multiple versions of service and camel route 一个捆绑包中的Spring Bean无法在另一个捆绑包中的骆驼路线中访问 - Spring bean from one bundle is not accessible in camel route in another bundle 无法部署包含通过Websphere 8.5中的白羊座蓝图定义的骆驼路线的osgi捆绑包 - Unable to deploy a osgi bundle containing a camel route defined via aries blueprint in Websphere 8.5 osgi中的骆驼OptaplannerComponent - camel OptaplannerComponent in osgi 生成Javadoc for OSGi捆绑包 - Generate Javadoc for OSGi bundle Maven插件可用于构建包含骆驼路线和一些POJO的osgi捆绑包,以用于在fuse-servicemix 4.3.0内部进行部署? - maven plugin to be used for building an osgi bundle containing camel-routes and some POJO's for deploying inside fuse-servicemix 4.3.0?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM