第 26 章 Exchange Property

概述

Exchange 属性语言提供了访问 交换属性 的便捷方式。当您提供与其中一个交换属性名称匹配的键时,交换属性语言会返回对应的值。

Exchange 属性语言是 camel-core 的一部分。

XML 示例

例如,若要在 listOfEndpoints Exchange 属性包含接收者列表时实现接收者列表模式,您可以按照如下所示定义路由:

<camelContext>
  <route>
    <from uri="direct:a"/>
    <recipientList>
      <exchangeProperty>listOfEndpoints</exchangeProperty>
    </recipientList>
  </route>
</camelContext>

Java 示例

同一接收者列表示例可在 Java 中进行,如下所示:

from("direct:a").recipientList(exchangeProperty("listOfEndpoints"));