架构
表达式
登录后可跨设备保存划线和私人笔记登录
表达式
表达式与断言(Predicate)可用于在 DSL 中创建各种企业集成模式(Enterprise Integration Patterns),例如基于内容的路由器(Content Based Router) EIP 或接收者列表(Recipient List) EIP。
为了支持动态规则,Camel 通过多种不同的语言提供了可插拔的 Expression 策略。
| Simple 经常被用作 Camel EIP 的断言和表达式。 |
|---|
如果你在 DSL 之外并希望创建自己的表达式,可以实现 Expression 接口、复用其他构建器,或者尝试 ExpressionBuilder 类。
表达式 API
Camel 表达式的 API 定义在 org.apache.camel.Expression 接口中,如下所示:
public interface Expression {
/**
* Returns the value of the expression on the given exchange
*
* @param exchange the message exchange on which to evaluate the expression
* @param type the expected type of the evaluation result
* @return the value of the expression
*/
<T> T evaluate(Exchange exchange, Class<T> type);
}Expression 会被求值为一个 Object 值。正因如此,表达式才如此强大:它可用于函数、数据映射、模板化,也适用于低代码用户。
评论
登录后参与评论
正在加载评论…
KnowForge