camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leroykendall <leroykend...@yahoo.com>
Subject JMS transaction behavior inside of route
Date Mon, 08 Apr 2013 15:03:46 GMT
Hi,

The standard JMS transaction looks like:

    session = connection.createSession( true, -1 );
    queue = session.createQueue( "queue.name" );
    consumer = session.createConsumer( queue );

    // Messages processing loop
    try {
        message = consumer.receive();       // Receive message from queue
        ...
        messageFlow( message );
        anotherMessageFlow( message );
        ...
        session.commit();          // Message acknowledge
    } catch (Exception ex) {
        session.rollback();         // Put message back to queue for
redelivery
    }

Question: can we do similar behavior in Camel route?
So it would look like:

    <route>
        <from uri="jms:queue:queue.name"/>    <|-- Receive message from
queue, but don't do acknowledge yet. -->
        ...
        <bean ref="messageFlow"/>
        <bean ref="anotherMessageFlow"/>     <|-- If exception is thrown
here then do rollback of message back to JMS queue for redelivery. -->
    </route>                                            <|-- End of route.
Do JMS session commit and message acknowledge. -->

So can Camel 2.10.0 do this?

Thanks.
--Victor



--
View this message in context: http://camel.465427.n5.nabble.com/JMS-transaction-behavior-inside-of-route-tp5730513.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message