从XML DSL动态启动驼峰路由

从XML DSL动态启动驼峰路由,xml,spring,apache-camel,Xml,Spring,Apache Camel,我正在尝试根据属性文件中的布尔值在XMLDSL中有条件地启动路由。但它有点不起作用。我不确定这样做是否正确。感谢您的帮助,谢谢:) 这是我的blueprint.xml <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"> <property name="location" value="classpath:

我正在尝试根据属性文件中的布尔值在XMLDSL中有条件地启动路由。但它有点不起作用。我不确定这样做是否正确。感谢您的帮助,谢谢:)

这是我的blueprint.xml

<bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
    <property name="location" value="classpath:property.properties"/>
</bean>

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">


    <route autoStartup="${isTrue}">
        <from uri="pipe:prs:P" />
        <choice>
            <when>
                <simple>${headers.headerName} == 'DR91'</simple>
                <process ref="reqType"></process>
                <to uri="direct-vm:pipeRequestDR91" />
            </when>
            <when>
                <simple>${headers.headerName} == 'DR93'</simple>
                <process ref="reqType"></process>
                <to uri="direct-vm:pipeRequestDR93" />
            </when>
        </choice>
    </route>
我得到的错误是:

org.apache.camel.RuntimeCamelException: 
org.apache.camel.FailedToCreateRouteException: Failed to create route 
route1: Route(route1)[[From[pipe:prs:P]] -> [Choice[[When[simple{${h... 
because of Error parsing [${isTrue}] as a Boolean.

我认为这还没有得到支持。 看这里
我认为这还不受支持。 看这里

您应该使用Camel的属性占位符语法,即
{{xxx}
,例如do

 <route autoStartup="{{isTrue}}">

您应该使用Camel的属性占位符语法,即
{{xxx}
,例如do

 <route autoStartup="{{isTrue}}">


您用
blueprint osgi
标记了您的问题,但您使用的是Spring
BridgePropertyPlaceHolderConfigure
。我认为要么你的标记错误,要么你使用了BridgePropertyPlaceHolderConfigure。是的,我标记错误。谢谢你用
blueprint osgi
标记了你的问题,但是你使用的是Spring
BridgePropertyPlaceHolderConfigure
。我认为要么你的标记错误,要么你使用了BridgePropertyPlaceHolderConfigure。是的,我标记错误。谢谢汉克斯·克劳斯:)这样就成功了,现在我又开始关注其他问题了。因为它启动路由来检查它在再次启动时是否工作,所以它会触发我的bean。我们能避免吗?谢谢克劳斯:)这样就成功了,现在我又开始关注其他问题了。因为它启动路由来检查它在再次启动时是否工作,所以它会触发我的bean。我们能避免吗?