搜索

30.6. 变量参考

download PDF

变量表

表 30.1 “简单语言的变量” 显示简单语言支持的所有变量。

表 30.1. 简单语言的变量
变量类型描述

camelContext

对象

Camel 上下文。支持 OGNL 表达式。

camelId

字符串

Camel 上下文的 ID 值。

exchangeId

字符串

交换的 ID 值。

id

字符串

In 消息 ID 值。

正文(body)

对象

In 消息正文。支持 OGNL 表达式。

in.body

对象

In 消息正文。支持 OGNL 表达式。

out.body

对象

Out 消息正文。

bodyAs(Type)

类型

In 消息正文,转换为指定类型。所有类型类型 必须使用其完全限定的 Java 名称来指定,除了 type: byte[]StringIntegerLong 除外。转换的正文可以是 null。

mandatoryBodyAs(Type)

类型

In 消息正文,转换为指定类型。所有类型类型 必须使用其完全限定的 Java 名称来指定,除了 type: byte[]StringIntegerLong 除外。转换的正文应该为空。

header.HeaderName

对象

In message 的 HeaderName 标头。支持 OGNL 表达式。

header[HeaderName]

对象

In message 的 HeaderName 标头(alternative 语法)。

headers.HeaderName

对象

In message 的 HeaderName 标头。

headers[HeaderName]

对象

In message 的 HeaderName 标头(alternative 语法)。

in.header.HeaderName

对象

In message 的 HeaderName 标头。支持 OGNL 表达式。

in.header[HeaderName]

对象

In message 的 HeaderName 标头(alternative 语法)。

in.headers.HeaderName

对象

In message 的 HeaderName 标头。支持 OGNL 表达式。

in.headers[HeaderName]

对象

In message 的 HeaderName 标头(alternative 语法)。

out.header.HeaderName

对象

Out message 的 HeaderName 标头。

out.header[HeaderName]

对象

Out 消息的 HeaderName 标头(alternative 语法)。

out.headers.HeaderName

对象

Out message 的 HeaderName 标头。

out.headers[HeaderName]

对象

Out 消息的 HeaderName 标头(alternative 语法)。

headerAs(Key,Type)

类型

Key 标头,转换为指定类型。所有类型类型 必须使用其完全限定的 Java 名称来指定,除了 type: byte[]StringIntegerLong 除外。转换的值可以是 null。

标头

Map

所有 In 标头(作为 java.util.Map 类型)。

in.headers

Map

所有 In 标头(作为 java.util.Map 类型)。

property.PropertyName

对象

交换上的 PropertyName 属性。

property[PropertyName]

对象

交换上的 PropertyName 属性(alternative 语法)。

sys.SysPropertyName

字符串

SysPropertyName Java 系统属性。

sysenv.SysEnvVar

字符串

SysEnvVar 系统环境变量。

exception

字符串

来自 Exchange.getException () 的 exception 对象或如果这个值为 null,则来自 Exchange.EXCEPTION_CAUGHT 属性的异常;否则为 null。支持 OGNL 表达式。

exception.message

字符串

如果在交换上设置了异常,则返回 Exception.getMessage () 的值;否则,返回 null

exception.stacktrace

字符串

如果在交换上设置了异常,则返回 Exception.getStackTrace () 的值;否则,返回 null注意: 简单语言首先尝试从 Exchange.getException () 检索异常。如果没有设置该属性,它会通过调用 Exchange.getProperty (Exchange.CAUGHT_EXCEPTION) 来检查安全异常。

date:command:pattern

字符串

使用 java.text.SimpleDateFormat 模式格式的日期。支持以下命令: 现在,对于当前日期和时间; header. HeaderName in.header.HeaderNameIn 消息中使用 java.util.Date 对象; out.header.HeaderName 使用 Out 消息的 HeaderName 标头中的 java.util.Date 对象;

Bean:beanID.Method

对象

在引用的 bean 上调用一个方法 ,并返回方法调用 的结果。要指定方法名称,您可以使用 beanID.Method 语法;或者,您可以使用 beanID?method=method Name语法。

ref:beanID

对象

在 registry 中查找带有 ID beanID 的 bean,并返回对 bean 本身的引用。例如,如果您使用 splitter EIP,您可以使用此变量引用实现分割算法的 bean。

Properties:Key

字符串

Key 属性占位符 的值。

Properties:Location:Key

字符串

Key 属性占位符的值,其中属性文件的位置由 Location 提供。

threadName

字符串

当前线程的名称。

routeId

字符串

返回正在路由 Exchange 的当前路由的 ID。

类型:名称[.Field]

对象

通过其 Fully-Qualified-Name (FQN)引用类型或字段。要引用某个字段,请附加 .字段。例如,您可以将 Exchange 类中的 FILE_NAME 常量字段指代为 type:org.apache.camel.Exchange.FILE_NAME

collate(group)

list

在 Camel 2.17 中,collate 函数迭代消息正文,并将数据分组到特定大小的子列表中。您可以将 Splitter EIP 与 Splitter EIP 搭配使用,将消息正文和组批量分成一组 N 子列表。

skip(number)

Ierator

skip 函数迭代消息正文并跳过第一个项目数。这可与 Splitter EIP 一起使用来分割消息正文,并跳过第一个 N 个项目数。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.