Osgi 确保在卡拉夫有序地关闭捆包
对于一个简单的用例,我有两个Karaf包:Osgi 确保在卡拉夫有序地关闭捆包,osgi,apache-karaf,osgi-bundle,blueprint-osgi,Osgi,Apache Karaf,Osgi Bundle,Blueprint Osgi,对于一个简单的用例,我有两个Karaf包: 捆绑共享库 Bundle My Implementation->dependens(1)Bundle共享库,blueprint中通过提到的Bundle依赖于bean的属性 我正在采取的步骤: <bean id="shutdownStrategy" class="org.apache.camel.impl.DefaultShutdownStrategy"> <property name="timeout" value="
提到的Bundle依赖于bean的属性
<bean id="shutdownStrategy" class="org.apache.camel.impl.DefaultShutdownStrategy">
<property name="timeout" value="1" />
</bean>
etc/config.properties
中设置org.apache.aries.blueprint.preemptiveShutdown=false
。这也无济于事
我是不是遗漏了什么
--编辑1--
在到处查看之后,我发现我们可以在DefaultShutdownStrategy中为timeout设置一个自定义值。因此,作为解决办法,我做了以下工作:
<bean id="shutdownStrategy" class="org.apache.camel.impl.DefaultShutdownStrategy">
<property name="timeout" value="1" />
</bean>
我理解这不是一种干净的最佳方式。就目前而言,它以某种方式帮助我避免丢失很多飞行中的信息
但是,任何建议或反馈都很好
--编辑2--添加捆绑包1的蓝图文件
<?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"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.3.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.3.0.xsd
">
<!-- persistent-id for shared context -->
<cm:property-placeholder persistent-id="xxx.shared" update-strategy="none" >
<cm:default-properties>
...
</cm:default-properties>
</cm:property-placeholder>
<!--jms broker connection-->
<reference id="jmsProducerConnectionFactory" interface="javax.jms.ConnectionFactory" filter="(osgi.jndi.service.name=jms/xxx.producer)" availability="mandatory" />
<bean id="xxx-producer" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsProducerConnectionFactory"/>
</bean>
<!-- Source DB Reference -->
<reference id="XDataSource" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=xxx-datasource)" availability="mandatory"/>
<!-- Datawarehouse DB Reference -->
<reference id="dw" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=xdb-datasource)" availability="mandatory"/>
<bean id="prs" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="XDataSource"/>
</bean>
<bean id="timestamp" class="org.library.shared.TimestampImplementation" destroy-method="synchronize" depends-on="dw">
<argument index="0" ref="dw" />
<argument index="2" value="Orders" />
</bean>
<bean id="shutdownStrategy" class="org.apache.camel.impl.DefaultShutdownStrategy">
<property name="timeout" value="1" />
</bean>
<camelContext id="camel-context" xmlns="http://camel.apache.org/schema/blueprint" depends-on="timestamp">
<packageScan>
<package>org.xyz.orders.routing</package>
</packageScan>
</camelContext>
</blueprint>
...
org.xyz.orders.routing
另一个捆绑包只是几个类的集合(一个共享库),我将其作为maven依赖项包括在内。该捆绑包没有蓝图文件
由于组织问题,我在某些地方使用了虚拟名称。您能显示捆绑包的蓝图xml吗?您好!谢谢你的回复。我已经用一个包的蓝图文件的内容更新了我的问题。作为一种解决方法,我使用了关机策略,但我觉得这不是正确的方法。另一个捆绑包只是几个类的集合(一个共享库),我将其作为maven依赖项包括在内。该捆绑包没有蓝图文件。因此,现在我的要求是这个包(带有Blueprint文件)应该在共享库包之前关闭。谢谢