camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralf Steppacher <ralf.steppac...@derivativepartners.com>
Subject Can't get <camel:threads> to work
Date Wed, 05 Oct 2011 10:16:42 GMT
Hi all,

I am stuck with what seemed a trivial task: parallel execution of a
route with <camel:threads>.

I have basically copied the "Example: threads DSL" on
http://camel.apache.org/async.html and tried the same in spring XML.
This is what my route looks like at the moment:

<camel:route>
  <camel:from ref="mq.topic.command" />
  <camel:threads>
    <camel:unmarshal>
      <camel:serialization />
    </camel:unmarshal>
    <camel:log loggingLevel="INFO" message="Received command:
${in.body}" />
    <delay>
      <constant>10000</constant>
    </delay>
  </camel:threads>
</camel:route>

There are three commands published simultaneously to the topic
"mq.topic.command" every minute. I expected the three commands to be
logged quasi simsimultaneously due to the parallel processing, but it
seems as if they are processed serially in a single thread:

2011-10-05 11:53:00,191 INFO  route1 - Received command: Command
[commandType=HARVEST_CLOSES, messageSource=EVENT_EMITTER,
uuid=9497b5a2-8f39-435c-b00a-44135900d9b7, version=null]
2011-10-05 11:53:10,212 INFO  route1 - Received command: Command
[commandType=HARVEST_QUOTES, messageSource=EVENT_EMITTER,
uuid=72018457-fa4b-4d0f-8187-9c7f8dabb0bf, version=null]
2011-10-05 11:53:20,231 INFO  route1 - Received command: Command
[commandType=HARVEST_TRADES, messageSource=EVENT_EMITTER,
uuid=642227f5-0849-43fc-84f9-60233a6023a4, version=null]

I have tried and tested all combinations of where to put the
<camel:threads> tag, the behavior stays the same.

I found several examples on the web that put the threads tag on a single
line like this: <camel:threads /> 
This is valid according to the schema, but for me start-up of the route
fails because "thread" has no children.

I spent a little time debugging the ramp-up of the context and can see
an ExecutorService being created.

What am I missing?

The behavior is the same with Camel 2.7.2 and 2.8.1. I am running this
on Ubuntu 11.04 (64bit) and Sun JDK 1.6.0_26 (64bit). 


Thanks!
Ralf

Mime
View raw message