The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

gunnewegh (1) [Avatar] Offline

I recently started reading the MEAP Camel book. Examples are very good, although one example seems a little unclear.

In the HandleFaultTest, the OrderService.toSoap() method sets a fault in the Out message of the Exchange. The ExcangePattern in this service is InOnly, which is the first thing I am wondering about.

The second thing is that the OrderService.toSoap() method also sets the body in the Out message with a Document object. Under the hood Camel will set the Out message to null and wrap the Document.toString() in a CamelException (see HandleFaultInterceptor.handleFault()), resulting in the loss of the Documents content. Nobody will ever see the <faultstring>ActiveMQ in Action is out of stock</faultstring>. Instead, the ErrorHandler will only be able to log org.apache.camel.CamelException: [#document: null].


davsclaus (413) [Avatar] Offline
Re: 5.3.4 Handling faults: HandleFaultTest
The MEP is just a flag. You can still set OUT messages if you like.
wheleph (1) [Avatar] Offline
Re: 5.3.4 Handling faults: HandleFaultTest
I guess my questions is related to the original one so I'm posting it here instead of creation of a new thread.

Let's consider test HandleFaultTest.testOrderFail. It contains the following expectation:

dead.message(0).property(Exchange.EXCEPTION_CAUGHT).convertTo(String.class).contains("ActiveMQ in Action is out of stock");

However if I change the expected value to something else like this:


the test is still green. Can anyone explain to me what's wrong with this expectation?

Source code of the test can be examined here:
davsclaus (413) [Avatar] Offline
Re: 5.3.4 Handling faults: HandleFaultTest

Thanks for reporting. That is a bug in camel-core. I have logged a ticket to get this fixed