我正在配置一个看起来像这样的apache-camel路线:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<propertyPlaceholder id="properties" location="file:/../jboss/dependencies-fuse/archivo.properties"/>
<route>
<from uri="amqLocal:endpointA"/>
<choice>
<when>
<simple>{{property.var}} == 'F' </simple>
<to uri="amqLocal:endpointB"/>
</when>
</choice>
<to uri="amqLocal:endpointC"/>
<to uri="amqLocal:endpointD"/>
</route>
</camelContext>
假设属性文件定义正确,我正在寻找一种方法,只有当名为property.var的属性等于'F'时,路由器才能将消息传递到名为amqLocal:endpointB的端点。然后,路由器应继续向端点amqLocal:endpointC和amqLocal:endpointD抛出相同的消息。
我不知道它是否像我所说的那样工作。也许我应该使用该<filter>
组件,但是它总是抛出以下异常:
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[JmsMessage[JmsMessageID: ID:emi-pc-38668-1459998422949-1:2:1:1:1]]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635)[org.apache.camel:camel-core:2.15.1.redhat-621084 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2]
at org.apache.camel.builder.SimpleBuilder.createPredicate(SimpleBuilder.java:93)[org.apache.camel:camel-core:2.15.1.redhat-621084 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2]
at org.apache.camel.builder.SimpleBuilder.matches(SimpleBuilder.java:74)[org.apache.camel:camel-core:2.15.1.redhat-621084 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2]
at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:92)[org.apache.camel:camel-core:2.15.1.redhat-621084 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[org.apache.camel:camel-core:2.15.1.redhat-621084 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)[org.apache.camel:camel-core:2.15.1.redhat-621084 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashma
有人可以帮忙吗?还有另一种好方法吗?
{{var}}
改为使用{{ }}
属性占位符语法:http : //camel.apache.org/using-propertyplaceholder.html
如果要使用简单语言引用属性占位符,则需要使用${ }
语法并使用以下properties-location
函数:http : //camel.apache.org/simple
这样就可以了${properties-location:var}
。使用此选项时,将在运行时为每个消息解析占位符。前者在骆驼启动过程中被解决过一次。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句