Java 是否可以将CamelContext的outhouse关闭策略整合到一个中心OSGi包中?

Java 是否可以将CamelContext的outhouse关闭策略整合到一个中心OSGi包中?,java,apache-camel,osgi,blueprint-osgi,Java,Apache Camel,Osgi,Blueprint Osgi,我试图将我的OSGi捆绑包的中心bean放在一个中心捆绑包中,该捆绑包将它们作为服务提供。这在ErrorHanders和处理器上可以正常工作,但在和上则不行。我收到的错误消息是 org.osgi.service.blueprint.container.ComponentDefinitionException: A class org.apache.camel.processor.RedeliveryPolicy was found in the interfaces list, but clas

我试图将我的OSGi捆绑包的中心bean放在一个中心捆绑包中,该捆绑包将它们作为服务提供。这在ErrorHanders和处理器上可以正常工作,但在和上则不行。我收到的错误消息是

org.osgi.service.blueprint.container.ComponentDefinitionException: A class org.apache.camel.processor.RedeliveryPolicy was found in the interfaces list, but class proxying is not allowed by default. The ext:proxy-method='classes' attribute needs to be added to this service reference.
我可以尝试按照说明添加
ext:proxy方法
,但首先我想理解这里的线索。也许集中战略和政策不是个好主意

[EDIT]这里的错误是在服务中使用
类而不是
接口
。因此
interface=“org.apache.camel.spi.ShutdownStrategy”
应该是这里的正确接口(对于ShutdownStrategy)。带有我的骆驼路线的捆绑包引用了此服务,因此:

<reference
    id="shutdownStrategy"
    interface="org.apache.camel.spi.ShutdownStrategy"
    component-name="shutdownStrategy" />
[编辑]我想把这个问题局限于关闭策略,因为当我在我的中央包中的ErrorHandlers中引用重新交付策略时,它可以正常工作

那么,是否有可能将关闭战略也排除在外?也许不会,因为

当使用SpringXML时,您只需定义一个Springbean,它实现org.apache.camel.spi.ShutdownStrategy,camel将在启动时查找它并使用它而不是它的默认值


我在书中找到了答案

通过实现
org.apache.camel.spi.ShutdownStrategy
并使用setShutdownStrategy方法在CamelContext上设置它,您可以实现自己的策略来控制关机

当使用SpringXML时,您只需定义一个Springbean,它实现了
org.apache.camel.spi.ShutdownStrategy
,camel将在启动时查找它并使用它,而不是它的默认值

因此,如果您有自己的关机策略实现,您可以将其用作bean

<bean id="shutdownStrategy"
    class="org.apache.camel.spi.ShutdownStrategy">
</bean>

<bean id="shutdownStrategy"
    class="org.apache.camel.spi.ShutdownStrategy">
</bean>