camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonin Stefanutti <anto...@stefanutti.fr>
Subject Re: Unexpected behaviour from threads async API in Camel 2.14.0
Date Thu, 08 Oct 2015 20:41:46 GMT
Hi Claudius,

Using the ProducerTemplate.sendBody [1] method to send a message to the direct endpoint actually
creates a UnitOfWorkProducer instance that blocks the caller thread until the unit of work
has completed [2]. So even if your route contains some asynchronous processing through the
threads DSL, the caller thread will block until the message is fully processed.

As your producing executor service thread pool size is equals to the task queue size of your
consuming executor, and given the call to sendBody is synchronous, no rejection occurs.

[1] https://github.com/claudiusb/camel-threads-problem-reproducer/blob/master/src/test/java/com/github/claudiusb/camelthreadsproblemreproducer/ThreadsProblemReproducer.java#L103

[2] https://github.com/apache/camel/blob/camel-2.14.0/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java#L72

Antonin

> On 07 Oct 2015, at 19:35, Claudius B <claudius.boettcher@gmail.com> wrote:
> 
> Hi Camel community,
> 
> I was trying to turn a route into asynchronous processing to cause it to
> return immediately using the threads API (http://camel.apache.org/async.html).
> When the route, more accurately the routes thread pool, cannot process more
> tasks, those should be rejected with an exception (Abort) - which is not
> happening.
> 
> The unexpected behaviour is shown and further explained in this unit test:
> https://github.com/claudiusb/camel-threads-problem-reproducer
> 
> I would be very glad if someone could take a look on this and explain to me
> what is happening, if im using the API in the wrong way or if this might be
> a problem in Camel.
> 
> Best regards
> Claudius


Mime
View raw message