此内容没有您所选择的语言版本。

Chapter 28. Ref


Overview

The Ref expression language is really just a way to look up a custom Expression from the Registry. This is particular convenient to use in the XML DSL.

The Ref language is part of camel-core.

Static import

To use the Ref language in your Java application code, include the following import statement in your Java source files:

import static org.apache.camel.language.ref.RefLanguage.ref;

XML example

For example, the splitter pattern can reference a custom expression using the Ref language, as follows:

<beans ...>
  <bean id="myExpression" class="com.mycompany.MyCustomExpression"/>
  ...
  <camelContext>
    <route>
      <from uri="seda:a"/>
      <split>
        <ref>myExpression</ref>
        <to uri="mock:b"/>
      </split>
    </route>
  </camelContext>
</beans>

Java example

The preceding route can also be implemented in the Java DSL, as follows:

from("seda:a")
  .split().ref("myExpression")
  .to("seda:b");
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.