189.7. 예외 비활성화
Camel 2.16에서 사용 가능
기본적으로 json 페이로드에 구성된 jsonpath 표현식에 따라 유효한 경로가 없는 경우 jsonpath가 예외가 발생합니다. 일부 사용 사례에서는 json 페이로드에 선택적 데이터가 포함된 경우 이를 무시해야 할 수 있습니다. 따라서 다음과 같이 suppressExceptions 옵션을 true로 설정하여 이 값을 무시할 수 있습니다.
from("direct:start")
.choice()
// use true to suppress exceptions
.when().jsonpath("person.middlename", true)
.to("mock:middle")
.otherwise()
.to("mock:other");
XML DSL에서 다음을 수행합니다.
<route>
<from uri="direct:start"/>
<choice>
<when>
<jsonpath suppressExceptions="true">person.middlename</jsonpath>
<to uri="mock:middle"/>
</when>
<otherwise>
<to uri="mock:other"/>
</otherwise>
</choice>
</route>
이 옵션은 @JsonPath 주석에서도 사용할 수 있습니다.