Apache camel Apache Camel使用spring DSL比较字符串和引号,如何转义?

Apache camel Apache Camel使用spring DSL比较字符串和引号,如何转义?,apache-camel,Apache Camel,如何将正文内容匹配(等于或开始与)值进行比较 {“状态”:“OK”} 你怎么知道的 <camel:choice> <camel:when> <simple>${in.body} == '{"status":"OK"}'</simple> ... </camel:when> </camel:choice> 但是我需要equals或startWith作为规则运算符。 :( 我使用的是apache-camel-2.2

如何将正文内容匹配(
等于
开始与
)值进行比较

{“状态”:“OK”}

你怎么知道的

<camel:choice>
 <camel:when>
  <simple>${in.body} == '{"status":"OK"}'</simple>
  ...
 </camel:when>
</camel:choice>
但是我需要
equals
startWith
作为规则运算符。 :(

我使用的是apache-camel-2.20.1版本,因此您最好使用这个组件来比较json

在pom中添加依赖项

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-jsonpath</artifactId>
  <version>x.x.x</version>
</dependency>

org.apache.camel
camel-jsonpath
x、 x.x
然后

<camel:choice>
 <camel:when>
  <jsonpath>$[?(@.status=='OK')]]</jsonpath>
  ...
 </camel:when>
</camel:choice>

$[?(@.status=='OK')]]
...
Camel支持,因此您最好使用这个组件来比较json

在pom中添加依赖项

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-jsonpath</artifactId>
  <version>x.x.x</version>
</dependency>

org.apache.camel
camel-jsonpath
x、 x.x
然后

<camel:choice>
 <camel:when>
  <jsonpath>$[?(@.status=='OK')]]</jsonpath>
  ...
 </camel:when>
</camel:choice>

$[?(@.status=='OK')]]
...