camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Daly <>
Subject Transactional jms
Date Tue, 26 Apr 2011 15:26:06 GMT

Using Apache camel 2.7

I've taken a simple example from the Camel in Action book.

An modified it slighly.


public class Process {
    protected ProducerTemplate template;

    public void process(Exchange exchange) throws InterruptedException{

        for (int i = 0; i<2; i++){

            if(i == 1){
                throw new InterruptedException();
            System.out.println("************************ producer is " +
            template.send("activemq:queue:b", exchange);


    public void setTemplate(ProducerTemplate template) {
            this.template = template;

I see that the transaction rolls back and a message remains on the queue:a
after the interruptionException is thrown,
however the message that is sent to queue:b is not rolled back.

To explain a little more on my issue. We have a trigger message on a queue
that is then processed by a bean.
This bean goes to the database and publishes many messages onto another
queue for extra processing.One for each row in the database.

If we have a failure, I dont what to send the same message onto the second
Hope someone can help.

Otherwise I was thinking of keeping a message repository of messages I've
already published.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message