You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by lekkie <le...@gmail.com> on 2010/04/14 14:50:21 UTC

JMS Message Acknowledgement & Persistence in Camel

I have this scenario where I 'd like to keep a message in the queue until the
flow in my route has returned.

See explanation below:

<route>
    <from uri="jms:${queue}"/>
    <to uri="nmr:Webservice"/>
</route>

I'd like to finish processing <to uri="nmr:Webservice"/> - which means the
message is successfully sent to nmr:Webservice - before an ack is sent to my
message broker (jms:${queue}).

What acknowledgement mode will ensure an ack is only sent after camel
application returns from the <to uri="nmr:Webservice"/> call?

In the case of an exception, I believe an ack will not be sent to the
broker. Is my assumption correct?


kr.
-- 
View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: JMS Message Acknowledgement & Persistence in Camel

Posted by lekkie <le...@gmail.com>.



Claus Ibsen-2 wrote:
> 
> On Thu, Apr 15, 2010 at 8:53 AM, lekkie <le...@gmail.com> wrote:
>>
>> I checked it out on Amazon and it says it has not been released.
>>
>> Where else can I get it?
>>
> 
> See my mail signature :)
> http://www.manning.com/ibsen
> 
> If you buy from Manning you can can get the MEAP version which is an
> electronic copy (pdf) of the book while its being written.
> So while we write the book you get MEAP updates. We have done 5
> updates so far. There will be a 6. update when Jonathan and I have
> chapter 8 and 11 ready.
> 
> Manning very often have discounts = coupon codes.
> For example camel30 may still work which gives 30% discount.
> 
> Also if you follow #manning on twitter or subscribe to their e-news
> letter you get coupon codes for other books with discounts.
> For example yesterday Camel in Action was for sale for 15$, it was
> deal of the day.
> 
> When the book is in print, then Amazon, Barnes and Nobles and any
> other books store will have the book.
> Only Manning (the publisher) have the MEAP so you can read the book
> while its being written. Also this way you can influence and comment
> the book and have us the authors adjust it accordingly.
> 
> You can read more about MEAP here
> http://www.manning.com/about/meap
> 
> 
> The source code for the book is here
> http://code.google.com/p/camelinaction/
> 
> Where you can find ready to run examples. And the source code is free
> so you can actually just grab it right now and take a look.
> However the source code makes much more sense when you have the book
> as well, as the source code is being discussed in the book.
> 
> 
> And ActiveMQ has also a book: ActiveMQ in Action.
> Its to go in print in a couple of months. You can get the MEAP at
> manning as well.
> 
> 
> 
> 
> 
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Wed, Apr 14, 2010 at 6:50 PM, lekkie <le...@gmail.com> wrote:
>>>>
>>>> Thanks for the insight.
>>>>
>>>> I have gone ahead to implement the Transactional Client EIP pattern.
>>>>
>>>> However, I noticed that my transaction is redelivered only 4 times. I
>>>> used
>>>> JMSTransactionManager as my transaction manager and my redelivery
>>>> properties
>>>> says maxredelivery is 6. Also, my timetolive is 24hrs, but my failed
>>>> transaction is retried just 4 times.
>>>>
>>>
>>> AMQ will send the failed message to its DLQ.
>>> Camel in Action chapter 9 explains this and have an example and unit
>>> test.
>>>
>>>
>>>
>>>> How do I modify the number of time it is redelivered?
>>>>
>>>>
>>>> See my config below:
>>>> <bean id="redeliveryPolicy"
>>>> class="org.apache.activemq.RedeliveryPolicy">
>>>>                <property name="initialRedeliveryDelay" value="5000"/>
>>>>                <property name="maximumRedeliveries" value="6"/>
>>>>                <property name="useCollisionAvoidance" value="false"/>
>>>>                <property name="useExponentialBackOff" value="false"/>
>>>>        </bean>
>>>>
>>>> <bean id="jmsConnectionFactory"
>>>> class="org.apache.activemq.ActiveMQConnectionFactory">
>>>>                <property name="alwaysSessionAsync" value="false"/>
>>>>                <property name="alwaysSyncSend" value="true"/>
>>>>                <property
>>>> name="brokerURL"><value>${plusone-block-request-queue-url}</value></property>
>>>>                <property name="clientID" value=""/>
>>>>                <property name="closeTimeout" value="15000"/>
>>>>                <property name="copyMessageOnSend" value="true"/>
>>>>                <property name="disableTimeStampsByDefault"
>>>> value="false"/>
>>>>                <property name="dispatchAsync" value="false"/>
>>>>                <property name="objectMessageSerializationDefered"
>>>> value="false"/>
>>>>                <property name="optimizeAcknowledge" value="false"/>
>>>>                <property name="optimizedMessageDispatch" value="true"/>
>>>>                <property name="password" value=""/>
>>>>                <property name="producerWindowSize" value="0"/>
>>>>                <property name="statsEnabled" value="false"/>
>>>>                <property name="useAsyncSend" value="false"/>
>>>>                <property name="useCompression" value="false"/>
>>>>                <property name="useRetroactiveConsumer" value="false"/>
>>>>                <property name="userName" value=""/>
>>>>                <property name="watchTopicAdvisories" value="true"/>
>>>>                <property name="sendTimeout" value="0"/>
>>>>                <property name="redeliveryPolicy"
>>>> ref="redeliveryPolicy"/>
>>>>        </bean>
>>>>
>>>> <bean id="jmsTransactionManager"
>>>> class="org.springframework.jms.connection.JmsTransactionManager">
>>>>            <property name="connectionFactory"
>>>> ref="jmsConnectionFactory"
>>>> />
>>>>        </bean>
>>>>
>>>>        <bean id="jmsConfig"
>>>> class="org.apache.camel.component.jms.JmsConfiguration">
>>>>            <property name="connectionFactory"
>>>> ref="jmsConnectionFactory"/>
>>>>            <property name="transactionManager"
>>>> ref="jmsTransactionManager"/>
>>>>            <property name="transacted" value="true"/>
>>>>            <property name="concurrentConsumers" value="2"/>
>>>>            <property name="timeToLive" value="86400000"/>
>>>>                <property name="deliveryPersistent" value="true"/>
>>>>                <property name="explicitQosEnabled" value="true"/>
>>>>                <property name="priority" value="9"/>
>>>>                <property name="transactedInOut" value="true"/>
>>>>        </bean>
>>>>
>>>> <bean id="PROPAGATION_REQUIRED"
>>>> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>>>>            <property name="transactionManager"
>>>> ref="jmsTransactionManager"/>
>>>>            <property name="propagationBehaviorName"
>>>> value="PROPAGATION_REQUIRED"/>
>>>>        </bean>
>>>>
>>>>        <bean id="jms"
>>>> class="org.apache.camel.component.jms.JmsComponent">
>>>>                <property name="configuration" ref="jmsConfig"/>
>>>>        </bean>
>>>>
>>>> What else do I watchout for?
>>>>
>>>> kr.
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> You can use transactions - ack mode TRANSACTED
>>>>>
>>>>> And then you need to setup a TX manager.
>>>>>
>>>>> Chapter 9 in the Camel in Action book. (and find examples in the
>>>>> source code for the book)
>>>>> Or check the Transactional Client EIP pattern at Camel wiki.
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Apr 14, 2010 at 2:50 PM, lekkie <le...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> I have this scenario where I 'd like to keep a message in the queue
>>>>>> until
>>>>>> the
>>>>>> flow in my route has returned.
>>>>>>
>>>>>> See explanation below:
>>>>>>
>>>>>> <route>
>>>>>>    <from uri="jms:${queue}"/>
>>>>>>    <to uri="nmr:Webservice"/>
>>>>>> </route>
>>>>>>
>>>>>> I'd like to finish processing <to uri="nmr:Webservice"/> - which
>>>>>> means
>>>>>> the
>>>>>> message is successfully sent to nmr:Webservice - before an ack is
>>>>>> sent
>>>>>> to
>>>>>> my
>>>>>> message broker (jms:${queue}).
>>>>>>
>>>>>> What acknowledgement mode will ensure an ack is only sent after camel
>>>>>> application returns from the <to uri="nmr:Webservice"/> call?
>>>>>>
>>>>>> In the case of an exception, I believe an ack will not be sent to the
>>>>>> broker. Is my assumption correct?
>>>>>>
>>>>>>
>>>>>> kr.
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
>>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28245266.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28251817.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28287628.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: JMS Message Acknowledgement & Persistence in Camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Apr 15, 2010 at 8:53 AM, lekkie <le...@gmail.com> wrote:
>
> I checked it out on Amazon and it says it has not been released.
>
> Where else can I get it?
>

See my mail signature :)
http://www.manning.com/ibsen

If you buy from Manning you can can get the MEAP version which is an
electronic copy (pdf) of the book while its being written.
So while we write the book you get MEAP updates. We have done 5
updates so far. There will be a 6. update when Jonathan and I have
chapter 8 and 11 ready.

Manning very often have discounts = coupon codes.
For example camel30 may still work which gives 30% discount.

Also if you follow #manning on twitter or subscribe to their e-news
letter you get coupon codes for other books with discounts.
For example yesterday Camel in Action was for sale for 15$, it was
deal of the day.

When the book is in print, then Amazon, Barnes and Nobles and any
other books store will have the book.
Only Manning (the publisher) have the MEAP so you can read the book
while its being written. Also this way you can influence and comment
the book and have us the authors adjust it accordingly.

You can read more about MEAP here
http://www.manning.com/about/meap


The source code for the book is here
http://code.google.com/p/camelinaction/

Where you can find ready to run examples. And the source code is free
so you can actually just grab it right now and take a look.
However the source code makes much more sense when you have the book
as well, as the source code is being discussed in the book.


And ActiveMQ has also a book: ActiveMQ in Action.
Its to go in print in a couple of months. You can get the MEAP at
manning as well.





>
>
> Claus Ibsen-2 wrote:
>>
>> On Wed, Apr 14, 2010 at 6:50 PM, lekkie <le...@gmail.com> wrote:
>>>
>>> Thanks for the insight.
>>>
>>> I have gone ahead to implement the Transactional Client EIP pattern.
>>>
>>> However, I noticed that my transaction is redelivered only 4 times. I
>>> used
>>> JMSTransactionManager as my transaction manager and my redelivery
>>> properties
>>> says maxredelivery is 6. Also, my timetolive is 24hrs, but my failed
>>> transaction is retried just 4 times.
>>>
>>
>> AMQ will send the failed message to its DLQ.
>> Camel in Action chapter 9 explains this and have an example and unit test.
>>
>>
>>
>>> How do I modify the number of time it is redelivered?
>>>
>>>
>>> See my config below:
>>> <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
>>>                <property name="initialRedeliveryDelay" value="5000"/>
>>>                <property name="maximumRedeliveries" value="6"/>
>>>                <property name="useCollisionAvoidance" value="false"/>
>>>                <property name="useExponentialBackOff" value="false"/>
>>>        </bean>
>>>
>>> <bean id="jmsConnectionFactory"
>>> class="org.apache.activemq.ActiveMQConnectionFactory">
>>>                <property name="alwaysSessionAsync" value="false"/>
>>>                <property name="alwaysSyncSend" value="true"/>
>>>                <property
>>> name="brokerURL"><value>${plusone-block-request-queue-url}</value></property>
>>>                <property name="clientID" value=""/>
>>>                <property name="closeTimeout" value="15000"/>
>>>                <property name="copyMessageOnSend" value="true"/>
>>>                <property name="disableTimeStampsByDefault"
>>> value="false"/>
>>>                <property name="dispatchAsync" value="false"/>
>>>                <property name="objectMessageSerializationDefered"
>>> value="false"/>
>>>                <property name="optimizeAcknowledge" value="false"/>
>>>                <property name="optimizedMessageDispatch" value="true"/>
>>>                <property name="password" value=""/>
>>>                <property name="producerWindowSize" value="0"/>
>>>                <property name="statsEnabled" value="false"/>
>>>                <property name="useAsyncSend" value="false"/>
>>>                <property name="useCompression" value="false"/>
>>>                <property name="useRetroactiveConsumer" value="false"/>
>>>                <property name="userName" value=""/>
>>>                <property name="watchTopicAdvisories" value="true"/>
>>>                <property name="sendTimeout" value="0"/>
>>>                <property name="redeliveryPolicy" ref="redeliveryPolicy"/>
>>>        </bean>
>>>
>>> <bean id="jmsTransactionManager"
>>> class="org.springframework.jms.connection.JmsTransactionManager">
>>>            <property name="connectionFactory" ref="jmsConnectionFactory"
>>> />
>>>        </bean>
>>>
>>>        <bean id="jmsConfig"
>>> class="org.apache.camel.component.jms.JmsConfiguration">
>>>            <property name="connectionFactory"
>>> ref="jmsConnectionFactory"/>
>>>            <property name="transactionManager"
>>> ref="jmsTransactionManager"/>
>>>            <property name="transacted" value="true"/>
>>>            <property name="concurrentConsumers" value="2"/>
>>>            <property name="timeToLive" value="86400000"/>
>>>                <property name="deliveryPersistent" value="true"/>
>>>                <property name="explicitQosEnabled" value="true"/>
>>>                <property name="priority" value="9"/>
>>>                <property name="transactedInOut" value="true"/>
>>>        </bean>
>>>
>>> <bean id="PROPAGATION_REQUIRED"
>>> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>>>            <property name="transactionManager"
>>> ref="jmsTransactionManager"/>
>>>            <property name="propagationBehaviorName"
>>> value="PROPAGATION_REQUIRED"/>
>>>        </bean>
>>>
>>>        <bean id="jms"
>>> class="org.apache.camel.component.jms.JmsComponent">
>>>                <property name="configuration" ref="jmsConfig"/>
>>>        </bean>
>>>
>>> What else do I watchout for?
>>>
>>> kr.
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> You can use transactions - ack mode TRANSACTED
>>>>
>>>> And then you need to setup a TX manager.
>>>>
>>>> Chapter 9 in the Camel in Action book. (and find examples in the
>>>> source code for the book)
>>>> Or check the Transactional Client EIP pattern at Camel wiki.
>>>>
>>>>
>>>>
>>>> On Wed, Apr 14, 2010 at 2:50 PM, lekkie <le...@gmail.com> wrote:
>>>>>
>>>>> I have this scenario where I 'd like to keep a message in the queue
>>>>> until
>>>>> the
>>>>> flow in my route has returned.
>>>>>
>>>>> See explanation below:
>>>>>
>>>>> <route>
>>>>>    <from uri="jms:${queue}"/>
>>>>>    <to uri="nmr:Webservice"/>
>>>>> </route>
>>>>>
>>>>> I'd like to finish processing <to uri="nmr:Webservice"/> - which means
>>>>> the
>>>>> message is successfully sent to nmr:Webservice - before an ack is sent
>>>>> to
>>>>> my
>>>>> message broker (jms:${queue}).
>>>>>
>>>>> What acknowledgement mode will ensure an ack is only sent after camel
>>>>> application returns from the <to uri="nmr:Webservice"/> call?
>>>>>
>>>>> In the case of an exception, I believe an ack will not be sent to the
>>>>> broker. Is my assumption correct?
>>>>>
>>>>>
>>>>> kr.
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
>>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28245266.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28251817.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JMS Message Acknowledgement & Persistence in Camel

Posted by lekkie <le...@gmail.com>.
I checked it out on Amazon and it says it has not been released.

Where else can I get it?



Claus Ibsen-2 wrote:
> 
> On Wed, Apr 14, 2010 at 6:50 PM, lekkie <le...@gmail.com> wrote:
>>
>> Thanks for the insight.
>>
>> I have gone ahead to implement the Transactional Client EIP pattern.
>>
>> However, I noticed that my transaction is redelivered only 4 times. I
>> used
>> JMSTransactionManager as my transaction manager and my redelivery
>> properties
>> says maxredelivery is 6. Also, my timetolive is 24hrs, but my failed
>> transaction is retried just 4 times.
>>
> 
> AMQ will send the failed message to its DLQ.
> Camel in Action chapter 9 explains this and have an example and unit test.
> 
> 
> 
>> How do I modify the number of time it is redelivered?
>>
>>
>> See my config below:
>> <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
>>                <property name="initialRedeliveryDelay" value="5000"/>
>>                <property name="maximumRedeliveries" value="6"/>
>>                <property name="useCollisionAvoidance" value="false"/>
>>                <property name="useExponentialBackOff" value="false"/>
>>        </bean>
>>
>> <bean id="jmsConnectionFactory"
>> class="org.apache.activemq.ActiveMQConnectionFactory">
>>                <property name="alwaysSessionAsync" value="false"/>
>>                <property name="alwaysSyncSend" value="true"/>
>>                <property
>> name="brokerURL"><value>${plusone-block-request-queue-url}</value></property>
>>                <property name="clientID" value=""/>
>>                <property name="closeTimeout" value="15000"/>
>>                <property name="copyMessageOnSend" value="true"/>
>>                <property name="disableTimeStampsByDefault"
>> value="false"/>
>>                <property name="dispatchAsync" value="false"/>
>>                <property name="objectMessageSerializationDefered"
>> value="false"/>
>>                <property name="optimizeAcknowledge" value="false"/>
>>                <property name="optimizedMessageDispatch" value="true"/>
>>                <property name="password" value=""/>
>>                <property name="producerWindowSize" value="0"/>
>>                <property name="statsEnabled" value="false"/>
>>                <property name="useAsyncSend" value="false"/>
>>                <property name="useCompression" value="false"/>
>>                <property name="useRetroactiveConsumer" value="false"/>
>>                <property name="userName" value=""/>
>>                <property name="watchTopicAdvisories" value="true"/>
>>                <property name="sendTimeout" value="0"/>
>>                <property name="redeliveryPolicy" ref="redeliveryPolicy"/>
>>        </bean>
>>
>> <bean id="jmsTransactionManager"
>> class="org.springframework.jms.connection.JmsTransactionManager">
>>            <property name="connectionFactory" ref="jmsConnectionFactory"
>> />
>>        </bean>
>>
>>        <bean id="jmsConfig"
>> class="org.apache.camel.component.jms.JmsConfiguration">
>>            <property name="connectionFactory"
>> ref="jmsConnectionFactory"/>
>>            <property name="transactionManager"
>> ref="jmsTransactionManager"/>
>>            <property name="transacted" value="true"/>
>>            <property name="concurrentConsumers" value="2"/>
>>            <property name="timeToLive" value="86400000"/>
>>                <property name="deliveryPersistent" value="true"/>
>>                <property name="explicitQosEnabled" value="true"/>
>>                <property name="priority" value="9"/>
>>                <property name="transactedInOut" value="true"/>
>>        </bean>
>>
>> <bean id="PROPAGATION_REQUIRED"
>> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>>            <property name="transactionManager"
>> ref="jmsTransactionManager"/>
>>            <property name="propagationBehaviorName"
>> value="PROPAGATION_REQUIRED"/>
>>        </bean>
>>
>>        <bean id="jms"
>> class="org.apache.camel.component.jms.JmsComponent">
>>                <property name="configuration" ref="jmsConfig"/>
>>        </bean>
>>
>> What else do I watchout for?
>>
>> kr.
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> You can use transactions - ack mode TRANSACTED
>>>
>>> And then you need to setup a TX manager.
>>>
>>> Chapter 9 in the Camel in Action book. (and find examples in the
>>> source code for the book)
>>> Or check the Transactional Client EIP pattern at Camel wiki.
>>>
>>>
>>>
>>> On Wed, Apr 14, 2010 at 2:50 PM, lekkie <le...@gmail.com> wrote:
>>>>
>>>> I have this scenario where I 'd like to keep a message in the queue
>>>> until
>>>> the
>>>> flow in my route has returned.
>>>>
>>>> See explanation below:
>>>>
>>>> <route>
>>>>    <from uri="jms:${queue}"/>
>>>>    <to uri="nmr:Webservice"/>
>>>> </route>
>>>>
>>>> I'd like to finish processing <to uri="nmr:Webservice"/> - which means
>>>> the
>>>> message is successfully sent to nmr:Webservice - before an ack is sent
>>>> to
>>>> my
>>>> message broker (jms:${queue}).
>>>>
>>>> What acknowledgement mode will ensure an ack is only sent after camel
>>>> application returns from the <to uri="nmr:Webservice"/> call?
>>>>
>>>> In the case of an exception, I believe an ack will not be sent to the
>>>> broker. Is my assumption correct?
>>>>
>>>>
>>>> kr.
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28245266.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28251817.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: JMS Message Acknowledgement & Persistence in Camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Apr 14, 2010 at 6:50 PM, lekkie <le...@gmail.com> wrote:
>
> Thanks for the insight.
>
> I have gone ahead to implement the Transactional Client EIP pattern.
>
> However, I noticed that my transaction is redelivered only 4 times. I used
> JMSTransactionManager as my transaction manager and my redelivery properties
> says maxredelivery is 6. Also, my timetolive is 24hrs, but my failed
> transaction is retried just 4 times.
>

AMQ will send the failed message to its DLQ.
Camel in Action chapter 9 explains this and have an example and unit test.



> How do I modify the number of time it is redelivered?
>
>
> See my config below:
> <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
>                <property name="initialRedeliveryDelay" value="5000"/>
>                <property name="maximumRedeliveries" value="6"/>
>                <property name="useCollisionAvoidance" value="false"/>
>                <property name="useExponentialBackOff" value="false"/>
>        </bean>
>
> <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>                <property name="alwaysSessionAsync" value="false"/>
>                <property name="alwaysSyncSend" value="true"/>
>                <property
> name="brokerURL"><value>${plusone-block-request-queue-url}</value></property>
>                <property name="clientID" value=""/>
>                <property name="closeTimeout" value="15000"/>
>                <property name="copyMessageOnSend" value="true"/>
>                <property name="disableTimeStampsByDefault" value="false"/>
>                <property name="dispatchAsync" value="false"/>
>                <property name="objectMessageSerializationDefered" value="false"/>
>                <property name="optimizeAcknowledge" value="false"/>
>                <property name="optimizedMessageDispatch" value="true"/>
>                <property name="password" value=""/>
>                <property name="producerWindowSize" value="0"/>
>                <property name="statsEnabled" value="false"/>
>                <property name="useAsyncSend" value="false"/>
>                <property name="useCompression" value="false"/>
>                <property name="useRetroactiveConsumer" value="false"/>
>                <property name="userName" value=""/>
>                <property name="watchTopicAdvisories" value="true"/>
>                <property name="sendTimeout" value="0"/>
>                <property name="redeliveryPolicy" ref="redeliveryPolicy"/>
>        </bean>
>
> <bean id="jmsTransactionManager"
> class="org.springframework.jms.connection.JmsTransactionManager">
>            <property name="connectionFactory" ref="jmsConnectionFactory" />
>        </bean>
>
>        <bean id="jmsConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>            <property name="connectionFactory" ref="jmsConnectionFactory"/>
>            <property name="transactionManager" ref="jmsTransactionManager"/>
>            <property name="transacted" value="true"/>
>            <property name="concurrentConsumers" value="2"/>
>            <property name="timeToLive" value="86400000"/>
>                <property name="deliveryPersistent" value="true"/>
>                <property name="explicitQosEnabled" value="true"/>
>                <property name="priority" value="9"/>
>                <property name="transactedInOut" value="true"/>
>        </bean>
>
> <bean id="PROPAGATION_REQUIRED"
> class="org.apache.camel.spring.spi.SpringTransactionPolicy">
>            <property name="transactionManager" ref="jmsTransactionManager"/>
>            <property name="propagationBehaviorName" value="PROPAGATION_REQUIRED"/>
>        </bean>
>
>        <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
>                <property name="configuration" ref="jmsConfig"/>
>        </bean>
>
> What else do I watchout for?
>
> kr.
>
>
>
> Claus Ibsen-2 wrote:
>>
>> You can use transactions - ack mode TRANSACTED
>>
>> And then you need to setup a TX manager.
>>
>> Chapter 9 in the Camel in Action book. (and find examples in the
>> source code for the book)
>> Or check the Transactional Client EIP pattern at Camel wiki.
>>
>>
>>
>> On Wed, Apr 14, 2010 at 2:50 PM, lekkie <le...@gmail.com> wrote:
>>>
>>> I have this scenario where I 'd like to keep a message in the queue until
>>> the
>>> flow in my route has returned.
>>>
>>> See explanation below:
>>>
>>> <route>
>>>    <from uri="jms:${queue}"/>
>>>    <to uri="nmr:Webservice"/>
>>> </route>
>>>
>>> I'd like to finish processing <to uri="nmr:Webservice"/> - which means
>>> the
>>> message is successfully sent to nmr:Webservice - before an ack is sent to
>>> my
>>> message broker (jms:${queue}).
>>>
>>> What acknowledgement mode will ensure an ack is only sent after camel
>>> application returns from the <to uri="nmr:Webservice"/> call?
>>>
>>> In the case of an exception, I believe an ack will not be sent to the
>>> broker. Is my assumption correct?
>>>
>>>
>>> kr.
>>> --
>>> View this message in context:
>>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28245266.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JMS Message Acknowledgement & Persistence in Camel

Posted by lekkie <le...@gmail.com>.
Thanks for the insight.

I have gone ahead to implement the Transactional Client EIP pattern.

However, I noticed that my transaction is redelivered only 4 times. I used
JMSTransactionManager as my transaction manager and my redelivery properties
says maxredelivery is 6. Also, my timetolive is 24hrs, but my failed
transaction is retried just 4 times.

How do I modify the number of time it is redelivered?


See my config below:
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
		<property name="initialRedeliveryDelay" value="5000"/>
		<property name="maximumRedeliveries" value="6"/>
		<property name="useCollisionAvoidance" value="false"/>
		<property name="useExponentialBackOff" value="false"/>
	</bean>

<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="alwaysSessionAsync" value="false"/>
		<property name="alwaysSyncSend" value="true"/>
		<property
name="brokerURL"><value>${plusone-block-request-queue-url}</value></property>
		<property name="clientID" value=""/>
		<property name="closeTimeout" value="15000"/>
		<property name="copyMessageOnSend" value="true"/>
		<property name="disableTimeStampsByDefault" value="false"/>
		<property name="dispatchAsync" value="false"/>
		<property name="objectMessageSerializationDefered" value="false"/>
		<property name="optimizeAcknowledge" value="false"/>
		<property name="optimizedMessageDispatch" value="true"/>
		<property name="password" value=""/>
		<property name="producerWindowSize" value="0"/>
		<property name="statsEnabled" value="false"/>
		<property name="useAsyncSend" value="false"/>
		<property name="useCompression" value="false"/>
		<property name="useRetroactiveConsumer" value="false"/>
		<property name="userName" value=""/>
		<property name="watchTopicAdvisories" value="true"/>
		<property name="sendTimeout" value="0"/>
		<property name="redeliveryPolicy" ref="redeliveryPolicy"/>
	</bean>

<bean id="jmsTransactionManager"
class="org.springframework.jms.connection.JmsTransactionManager">
	    <property name="connectionFactory" ref="jmsConnectionFactory" />	    	    
	</bean>
	
	<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
	    <property name="connectionFactory" ref="jmsConnectionFactory"/>
	    <property name="transactionManager" ref="jmsTransactionManager"/>
	    <property name="transacted" value="true"/>
	    <property name="concurrentConsumers" value="2"/>
	    <property name="timeToLive" value="86400000"/>
		<property name="deliveryPersistent" value="true"/>
		<property name="explicitQosEnabled" value="true"/>		
		<property name="priority" value="9"/>
		<property name="transactedInOut" value="true"/>		
	</bean>
	
<bean id="PROPAGATION_REQUIRED"
class="org.apache.camel.spring.spi.SpringTransactionPolicy">
	    <property name="transactionManager" ref="jmsTransactionManager"/>
	    <property name="propagationBehaviorName" value="PROPAGATION_REQUIRED"/>
	</bean>
	
  	<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
		<property name="configuration" ref="jmsConfig"/>		
	</bean>

What else do I watchout for?

kr.



Claus Ibsen-2 wrote:
> 
> You can use transactions - ack mode TRANSACTED
> 
> And then you need to setup a TX manager.
> 
> Chapter 9 in the Camel in Action book. (and find examples in the
> source code for the book)
> Or check the Transactional Client EIP pattern at Camel wiki.
> 
> 
> 
> On Wed, Apr 14, 2010 at 2:50 PM, lekkie <le...@gmail.com> wrote:
>>
>> I have this scenario where I 'd like to keep a message in the queue until
>> the
>> flow in my route has returned.
>>
>> See explanation below:
>>
>> <route>
>>    <from uri="jms:${queue}"/>
>>    <to uri="nmr:Webservice"/>
>> </route>
>>
>> I'd like to finish processing <to uri="nmr:Webservice"/> - which means
>> the
>> message is successfully sent to nmr:Webservice - before an ack is sent to
>> my
>> message broker (jms:${queue}).
>>
>> What acknowledgement mode will ensure an ack is only sent after camel
>> application returns from the <to uri="nmr:Webservice"/> call?
>>
>> In the case of an exception, I believe an ack will not be sent to the
>> broker. Is my assumption correct?
>>
>>
>> kr.
>> --
>> View this message in context:
>> http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28245266.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: JMS Message Acknowledgement & Persistence in Camel

Posted by Claus Ibsen <cl...@gmail.com>.
You can use transactions - ack mode TRANSACTED

And then you need to setup a TX manager.

Chapter 9 in the Camel in Action book. (and find examples in the
source code for the book)
Or check the Transactional Client EIP pattern at Camel wiki.



On Wed, Apr 14, 2010 at 2:50 PM, lekkie <le...@gmail.com> wrote:
>
> I have this scenario where I 'd like to keep a message in the queue until the
> flow in my route has returned.
>
> See explanation below:
>
> <route>
>    <from uri="jms:${queue}"/>
>    <to uri="nmr:Webservice"/>
> </route>
>
> I'd like to finish processing <to uri="nmr:Webservice"/> - which means the
> message is successfully sent to nmr:Webservice - before an ack is sent to my
> message broker (jms:${queue}).
>
> What acknowledgement mode will ensure an ack is only sent after camel
> application returns from the <to uri="nmr:Webservice"/> call?
>
> In the case of an exception, I believe an ack will not be sent to the
> broker. Is my assumption correct?
>
>
> kr.
> --
> View this message in context: http://old.nabble.com/JMS-Message-Acknowledgement---Persistence-in-Camel-tp28242166p28242166.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus