You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by benshort <be...@benshort.co.uk> on 2009/02/04 15:58:51 UTC
JMS Transactions
Hi,
I have the following route...
from("jms:rts_messages_email?concurrentConsumers=1")
.process(new SendingProcessor())
.onException(Exception.class)
.handled(true)
.maximumRedeliveries(0)
.process(new SendFailedProcessor())
.to("jms:message_status", "jms:failed_messages")
.end()
.to("jms:message_status", smtp)
.process(new SentProcessor())
.to("jms:message_status");
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?
Ben
--
View this message in context: http://www.nabble.com/JMS-Transactions-tp21832102s22882p21832102.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JMS Transactions
Posted by James Strachan <ja...@gmail.com>.
2009/2/4 James Strachan <ja...@gmail.com>:
> 2009/2/4 benshort <be...@benshort.co.uk>:
>>
>> Hi,
>>
>> I have the following route...
>>
>> from("jms:rts_messages_email?concurrentConsumers=1")
>> .process(new SendingProcessor())
>>
>> .onException(Exception.class)
>> .handled(true)
>> .maximumRedeliveries(0)
>> .process(new SendFailedProcessor())
>> .to("jms:message_status", "jms:failed_messages")
>> .end()
>>
>> .to("jms:message_status", smtp)
>> .process(new SentProcessor())
>> .to("jms:message_status");
>>
>> 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?
>
> Yes - see the "Enabling Transacted Consumption" section here...
> http://camel.apache.org/jms.html
>
> Basically specify transacted=true and provide a transactionManager on
> the component.
Damn hit send to early - examples here btw
http://camel.apache.org/transactional-client.html
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/
Re: JMS Transactions
Posted by James Strachan <ja...@gmail.com>.
2009/2/4 benshort <be...@benshort.co.uk>:
>
> Hi,
>
> I have the following route...
>
> from("jms:rts_messages_email?concurrentConsumers=1")
> .process(new SendingProcessor())
>
> .onException(Exception.class)
> .handled(true)
> .maximumRedeliveries(0)
> .process(new SendFailedProcessor())
> .to("jms:message_status", "jms:failed_messages")
> .end()
>
> .to("jms:message_status", smtp)
> .process(new SentProcessor())
> .to("jms:message_status");
>
> 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?
Yes - see the "Enabling Transacted Consumption" section here...
http://camel.apache.org/jms.html
Basically specify transacted=true and provide a transactionManager on
the component.
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/