[英]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:
那么,这里的最佳实践是什么:
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.