Propagate exceptions from Camel to wrapping main method?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Propagate exceptions from Camel to wrapping main method?

Andreas A.
Hi

I have a standalone Camel application:

A java main method with a Camel Main class that starts two different contexts.

In case of an OutOfMemoryError I would like to propagate this Error from Camel to the enclosing java main method. How can I propagate Errors and Exceptions "out" of the Camel errorhandling?
Reply | Threaded
Open this post in threaded view
|

Re: Propagate exceptions from Camel to wrapping main method?

claus.straube
Hi.

I think one way to do this is:

onException(OutOfMemoryError.class)
.to(xxx);

You can replace xxx with a component that fits best for your case.
Perhaps a bean call if you've something like a spring context.

Best regards - Claus

On 03.12.2010 11:37, Andreas A. wrote:

> Hi
>
> I have a standalone Camel application:
>
> A java main method with a Camel Main class that starts two different
> contexts.
>
> In case of an OutOfMemoryError I would like to propagate this Error from
> Camel to the enclosing java main method. How can I propagate Errors and
> Exceptions "out" of the Camel errorhandling?