[英]How to reference an Apache Camel Exchange within a route in Java
在 Camel 路線中,我向 Exchange 添加了一個屬性:
.setProperty("n", Integer.valueOf(n))
對於一些int
n
。 如果我想稍后設置另一個屬性
.setProperty("2n", 2*[expression that evaluates to n])
對於值2*n
,我會為[expression that evaluates to n]
什么? 我想引用交換屬性"n"
而不是原始的int
n
。
我考慮過使用
simple("${properties:n}").evaluate([reference to Exchange])
但我不知道如何引用 Exchange。
您可以使用Processor
來實現此邏輯:
.process( ex -> ex.setProperty("2n", ex.getProperty("n", Integer.class)*2) )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.