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");
from("direct:start")
.choice()
// use true to suppress exceptions
.when().jsonpath("person.middlename", true)
.to("mock:middle")
.otherwise()
.to("mock:other");
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
<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>
<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>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow