...
Info | ||
---|---|---|
| ||
When using |
doTry
around a Content Based Router not supported
Code Block | ||
---|---|---|
| ||
from("direct:dotry").setExchangePattern(ExchangePattern.InOut)
.doTry()
.to("https://localhost:8080/rest/order/123")
.choice()
.when().simple("${header.CamelHttpResponseCode} == '200'")
.convertBodyTo(String.class)
// DO SOMETHING
.endChoice()
.doCatch(Exception.class) // NOT SUPPORTED !!
.log(">> Exception")
.endDoTry(); |
The ChoiceDefinition class which is part of the DSL language of Apache Camel to implement the Content Based Router EIP Pattern doesn’t extends the OutputDefinition, which means that you cannot define the doCatch after the ChoiceDefinition as presented with the previous example. If you want to catch the exception inside of ChoiceDefinition, you can use error handler or use doTry…doCatch inside of when part.
About doCatch
and its power over Java
...