camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xdevroey <>
Subject Transactional Camel route with ActiveMQ Topic and aggregator
Date Wed, 23 Feb 2011 11:42:45 GMT


I am trying to design a Camel route to take messages from an ActiveMQ Topic
and register them into an Oracle database. The requirements for this route
are: all messages will be saved in the database as soon as possible (we
speak about ‘near real time’).

My first idea was to have:
-	A durable subscriber consuming messages from the ActiveMQ topic (with a
connection pool).
-	A processor which format the data to have an Object[] ready for the INSERT
-	An aggregator to group the Object [] into an Object[][].
-	Send the all thing to a bean which will get a connection to the database
from a pool (using commond-dbcp), creates a PreparedStatement, fill it using
the addBatch() method and send the batch to the database (the INSERTS are
immediately committed). This last point is used to avoid connections
Which will give in DSL something like:

   .aggregate(constant(true),new ObjectArrayAggregationStrategy())

To avoid message losses, I wanted to make the route transactional (JMS), so
the messages are removed from the ActiveMQ topic only if the route is
I read somewhere in the doc that a JMS transaction is attached to a thread
(using the Spring JMS transaction manager), my question is then: how will it
react with the aggregator?

When the activemq endpoint uses a connection pool, will the aggregator
aggregate messages from all those threads (with one Object[][] resulting
from the aggregation) or will each thread have its own aggregation (with as
many Object[][] resulting from the aggregation as there are threads in the
connection pool) ?

Will each thread of the connection pool be blocked at the aggregator until
the aggregation completes (and thus the batch is sent to the DB) or not?

Does someone have any idea and/or advices? I am actually working with Camel
2.2.0-fuse-02-00 and and ActiveMQ 5.3.1-fuse-02-00 in FUSE/Servicemix.

Many thanks in advance for your help.



Application Developer
Atos Worldline SA/NV 
Haachtsesteenweg 1442 Chaussée de Haecht
B-1130 Brussels, Belgium
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message