Hello,

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
statement.
-       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
overloads.
Which will give in DSL something like:

from("activemq:topic:MY.TOPIC")
   .processRef("normalizerProc")
   .aggregate(constant(true),new ObjectArrayAggregationStrategy())
   .to("bean:sqlBatchSender")
   .end();

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
committed. 
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.

Xavier


-----
--
Xavier DEVROEY

Application Developer
Atos Worldline SA/NV 
Haachtsesteenweg 1442 Chaussée de Haecht
B-1130 Brussels, Belgium
www.atosworldline.be
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Transactional-Camel-route-with-ActiveMQ-Topic-and-aggregator-tp3396892p3396892.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to