camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Error handling Questions
Date Mon, 04 May 2009 09:07:51 GMT
Hi

What version of Camel are you using? Camel 2.0 has many improvments in
error handling and processing over 1.x.

On Mon, May 4, 2009 at 10:54 AM, Zhi Zhou <zhi.zhou@sybase.com> wrote:
> Hello all,
>
> Camel's error handling is pretty powerful, but lately I am having two
> questions about it.
>
> 1) I am working a custom camel component, and not quite sure how to handle
> certain error condition. I may be having wrong idea from the very beginning
> but let me give you a simple scenario to describe the issue.
>
> from("jms:someQueue").to("myCustom:endpoint");
>
> My custom endpoint does some async message sending. For performance reason,
> it should keep sending messages from the jms queue without waiting for
> responses. responses come back asynchronously from the remote host. The
> question here is that if a response doesn't return without a timeout period,
> I would like an exception to be thrown and hence to be captured by camel's
> error handling where some redelivery logic is made possible. unfortunately,
> with this async nature of producing, the timeout event will be triggered in
> a different thread and hence no way to have camel to capture my created
> exception up to my limited camel knowledge.
We are planning to add a new Async API in Camel 2.0 so you leverage
Camel to do async routing much more easily.

Anyway if you leverage the async task execution in the JDK 1.5
concurrent API then you can get a handle to your async task, known as
a Future handle.
With that you can test whether the task is complete, get the result,
get the result within a timeout period etc.

>
>
> 2) my second question: is it possible that the error handling will happen in
> multiple threads in case of multi-threaded exchange processing. for example,
> the following route:
>
> from("direct:start").thread(10).process(new Processor(){/*throw some
> exception*/});
>
> will the error handling happen in the same thread of the caller that
> produces message to "direct:start", or will happen concurrently in multiple
> threads?
The thread is basically a worker pool, and since you use direct
component your route is synchronous all the way. Leveraging up till 10
worker threads.

If you want to divide into async you should use the seda component.
But when you want to do request-reply over seda it gets complicated.

Hence we are planning a new Async API in Camel 2.0 that addresses this.
There is a discussion on this in the camel-dev forum.


>
>
> Zhi
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration

Mime
View raw message