camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Why doesn't the stub component throw exceptions in tests
Date Fri, 24 May 2013 04:18:08 GMT

Read the javadoc API on the producer template and the methods you use,
eg sendBody vs requestBody.
eg its about InOnly vs InOut messaging style.

The eips

On Thu, May 23, 2013 at 8:15 PM, dancerjohn <> wrote:
> I am writing a test for my error handling. The route I am testing uses JMS
> and therefore has URL properties that are not compatible with the direct
> component. The way I have it set up is that I pass the following to the
> Route Builder ("jms:queue:myqueue") and then it adds the additional URL
> properties. In the test env I would like to be able to pass in something
> like "direct:jmsInputChan" but this fails due to the URL properties not
> working with direct.
> Then I found stub. I can pass in "stub:blahblah" and get the route set up
> and tested no problem. However, if I set a configuration to throw an
> exception in the route I don't get the exception out.
> Here is what I mean... I am using ProducerTemplate.sendBody to send in a
> message. If this channel is a "direct:xyz" and an exception is thrown the
> exception is logged by Camel and then thrown out of sendBody which means I
> can catch the exception in my test or have the test fail because of the
> exception.
> However, when the route starts with a stub and I cause the exception, Camel
> logs the exception but it is NOT thrown out of sendBody. This makes it hard
> to verify that the exception was not handled.
> It seems that stub should behave similar to direct in this regard.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
----------------- The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Twitter: davsclaus
Author of Camel in Action:

View raw message