JMS Transactions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

JMS Transactions

Ben Short-4

I have the following route...

                        .process(new SendingProcessor())

                            .process(new SendFailedProcessor())
                            .to("jms:message_status", "jms:failed_messages")

                        .to("jms:message_status", smtp)
                            .process(new SentProcessor())

Errors while sending the smtp will be caught and sent to jms:message_status and jms:failed_messages.

jms:message_status is used to log out the send attempts. jms:failed_messages is a queue of failed messages that are processed to decide if they should be retried or not.

Now what I would like to do is make the shown route transactional. So the message is not removed from jms:rts_messages_email until it has been added to jms:message_status and jms:failed_messages in the case of an error or jms:message_status in the case of no error.

I want to do this so that if the application dies while the message is trying to be sent it will still be in the jms:rts_messages_email jms queue. and next time the application is started it will be pulled out and retried.

Is this possible?