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
#1
Hello,

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].

Regards,

Eric
davsclaus (413) [Avatar] Offline
#2
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
#3
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:

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

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

{code}
dead.message(0).property(Exchange.EXCEPTION_CAUGHT).convertTo(String.class).contains("blah");
{code}

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: https://github.com/camelinaction/camelinaction/blob/d61c02d78017c3d21b50e2239195ca9ddbf80192/chapter5/errorhandler/src/test/java/camelinaction/HandleFaultTest.java
davsclaus (413) [Avatar] Offline
#4
Re: 5.3.4 Handling faults: HandleFaultTest
Hi

Thanks for reporting. That is a bug in camel-core. I have logged a ticket to get this fixed
https://issues.apache.org/jira/browse/CAMEL-7767