188.8. 인라인 간단한 예외

Camel 2.18에서 사용 가능

이제 간단한 구문 ${xxx}를 사용하여 JSonPath 표현식에서 간단한 언어 표현식을 인라인화할 수 있습니다. 예는 다음과 같습니다.An example is shown below:

from("direct:start")
  .choice()
    .when().jsonpath("$.store.book[?(@.price < ${header.cheap})]")
      .to("mock:cheap")
    .when().jsonpath("$.store.book[?(@.price < ${header.average})]")
      .to("mock:average")
    .otherwise()
      .to("mock:expensive");

및 XML DSL에서 다음을 수행합니다.

<route>
  <from uri="direct:start"/>
  <choice>
    <when>
      <jsonpath>$.store.book[?(@.price < ${header.cheap})]</jsonpath>
      <to uri="mock:cheap"/>
    </when>
    <when>
      <jsonpath>$.store.book[?(@.price < ${header.average})]</jsonpath>
      <to uri="mock:average"/>
    </when>
    <otherwise>
      <to uri="mock:expensive"/>
    </otherwise>
  </choice>
</route>

다음과 같이 allowSimple을 false로 설정하여 인라인 간단한 식에 대한 지원을 끌 수 있습니다.

.when().jsonpath("$.store.book[?(@.price < 10)]", false, false)

및 XML DSL에서 다음을 수행합니다.

<jsonpath allowSimple="false">$.store.book[?(@.price < 10)]</jsonpath>