apache骆驼路线选择/属性文件中的过滤器

艾米·卡斯特拉诺斯(Emi Castellanos)

我正在配置一个看起来像这样的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] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

apache骆驼路线选择/属性文件中的过滤器

来自分类Dev

使用cdi的骆驼文件组件过滤器

来自分类Dev

Laravel-在过滤器中获取路线名称

来自分类Dev

Notepad ++ 在文件过滤器中查找

来自分类Dev

AWS CLI和JMESPath过滤器并选择嵌套属性

来自分类Dev

如何选择过滤器选择列表中的列列表

来自分类Dev

使用过滤器在FetchXML中获取属性的属性

来自分类Dev

Sparql属性过滤器

来自分类Dev

Sparql属性过滤器

来自分类Dev

具有Ember数据“过滤器”的路线模型钩未加载依赖的计算属性

来自分类Dev

Angular JS过滤器组选择过滤器

来自分类Dev

Django模型中多对多字段的过滤器选择

来自分类Dev

ng-options中相关选择的过滤器

来自分类Dev

在AngularJS的选择下拉列表中添加搜索过滤器

来自分类Dev

Django中的动态过滤器选择字段

来自分类Dev

在SQL选择代码中更新过滤器

来自分类Dev

在easyui过滤器中搜索可删除选择

来自分类Dev

过滤器无法根据python中的长度选择数据?

来自分类Dev

选择字段中的Django CreateView过滤器外键

来自分类Dev

如何取消选择excel过滤器中的行

来自分类Dev

从Apache骆驼路线的分页API中读取

来自分类Dev

在Scala中编写Apache Beam过滤器

来自分类Dev

如何在Java中的Apache Spark Streaming中为文件名模式定义文件过滤器?

来自分类Dev

打开文件对话框中的文件过滤器

来自分类Dev

排除文件过滤器

来自分类Dev

修改文件过滤器

来自分类Dev

放置在过滤器中的vaadin访问会话属性

来自分类Dev

了解文件系统过滤器/小型过滤器

来自分类Dev

JFileChooser在过滤器中添加不同的文件类型