You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Travis Klotz <tr...@gmail.com> on 2011/07/06 23:26:55 UTC

ActiveMQComponent + JmsTransactions + CacheLevel

Does anybody know if when working with a Spring JmsTransactionManager
and the ActiveMQComponent, is it safe/possible to raise the
cacheLevelName above something other than CACHE_NONE?  When working
with the ActiveMQ's failover protocol, having to re-establish a new
connection after each message is causing me some major performance
problems.

Thanks,

Travis

Re: ActiveMQComponent + JmsTransactions + CacheLevel

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi Claus,

Sure thing... I will create an FAQ entry on the Camel site.

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/ActiveMQComponent-JmsTransactions-CacheLevel-tp4558968p4582478.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ActiveMQComponent + JmsTransactions + CacheLevel

Posted by Claus Ibsen <cl...@gmail.com>.
Ahswin excellent answer.

Do you mind creating a FAQ entry at the Camel site?


On Thu, Jul 7, 2011 at 8:17 PM, Ashwin Karpe <ak...@fusesource.com> wrote:
> Hi,
>
> You can raise it to any level if transactions are not involved. The main
> purpose of the cache is not to recycle connections, sessions or consumers
> and has nothing to do with transactions.
>
> There was a bug in the JMSSpringTemplate which caused connection and session
> objects to be recycled pos invocation in the absence of a thread pool. The
> side effect of this was since the connection object was recycled, maximum
> retry counts for failed transactions was ignored and retries would happen
> forever. The reason was that in the absence of a pool/cache, connection
> objects were garbage collected and re-created all the time which kept
> resetting the retry counter to zero.
>
> If you use local JMS transactions (aka non-XA), you might want to keep the
> cache level at CACHE_SESSION at the very least if you have several producers
> and consumers under the same session.
>
> For more details, please check out the following thread
>
> http://forum.springsource.org/showthread.php?34180-Transaction-rollback-with-CACHE_NONE-vs-CACHE_CONSUMER-SESSION
> http://forum.springsource.org/showthread.php?34180-Transaction-rollback-with-CACHE_NONE-vs-CACHE_CONSUMER-SESSION
>
> Cheers,
>
> Ashwin...
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer & Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQComponent-JmsTransactions-CacheLevel-tp4558968p4561929.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: ActiveMQComponent + JmsTransactions + CacheLevel

Posted by Travis Klotz <tr...@gmail.com>.
Ashwin,

Thanks for this, it helped a lot.  I ended up going with
CACHE_CONNECTION.  When I had it set at CACHE_SESSION it looked like I
dropped a message (1 out of 500k) during an ActiveMQ fail over test.
Not sure if it was from my CACHE_SESSION setting or something else,
but i'm getting very good throughput using CACHE_CONNECTION and have
not seen any message loss.

Travis

On Thu, Jul 7, 2011 at 1:17 PM, Ashwin Karpe <ak...@fusesource.com> wrote:
> Hi,
>
> You can raise it to any level if transactions are not involved. The main
> purpose of the cache is not to recycle connections, sessions or consumers
> and has nothing to do with transactions.
>
> There was a bug in the JMSSpringTemplate which caused connection and session
> objects to be recycled pos invocation in the absence of a thread pool. The
> side effect of this was since the connection object was recycled, maximum
> retry counts for failed transactions was ignored and retries would happen
> forever. The reason was that in the absence of a pool/cache, connection
> objects were garbage collected and re-created all the time which kept
> resetting the retry counter to zero.
>
> If you use local JMS transactions (aka non-XA), you might want to keep the
> cache level at CACHE_SESSION at the very least if you have several producers
> and consumers under the same session.
>
> For more details, please check out the following thread
>
> http://forum.springsource.org/showthread.php?34180-Transaction-rollback-with-CACHE_NONE-vs-CACHE_CONSUMER-SESSION
> http://forum.springsource.org/showthread.php?34180-Transaction-rollback-with-CACHE_NONE-vs-CACHE_CONSUMER-SESSION
>
> Cheers,
>
> Ashwin...
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer & Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQComponent-JmsTransactions-CacheLevel-tp4558968p4561929.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: ActiveMQComponent + JmsTransactions + CacheLevel

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

You can raise it to any level if transactions are not involved. The main
purpose of the cache is not to recycle connections, sessions or consumers
and has nothing to do with transactions.

There was a bug in the JMSSpringTemplate which caused connection and session
objects to be recycled pos invocation in the absence of a thread pool. The
side effect of this was since the connection object was recycled, maximum
retry counts for failed transactions was ignored and retries would happen
forever. The reason was that in the absence of a pool/cache, connection
objects were garbage collected and re-created all the time which kept
resetting the retry counter to zero.

If you use local JMS transactions (aka non-XA), you might want to keep the
cache level at CACHE_SESSION at the very least if you have several producers
and consumers under the same session.

For more details, please check out the following thread

http://forum.springsource.org/showthread.php?34180-Transaction-rollback-with-CACHE_NONE-vs-CACHE_CONSUMER-SESSION
http://forum.springsource.org/showthread.php?34180-Transaction-rollback-with-CACHE_NONE-vs-CACHE_CONSUMER-SESSION 

Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/ActiveMQComponent-JmsTransactions-CacheLevel-tp4558968p4561929.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: ActiveMQComponent + JmsTransactions + CacheLevel

Posted by Travis Klotz <tr...@gmail.com>.
Yes, I have read and understand that JavaDoc entry.  It says it MAY be
possible to raise the cache level when not explicitly doing XA
transactions on JBoss 4.  I'm asking what is the safe level to raise
it to when doing Locally managed (non-XA) transactions when working
with the ActiveMQComponent.  Can I just raise it back to
CACHE_CONSUMER?  Only to CACHE_CONNECTION?  Or do I need to leave it
at CACHE_NONE?

Travis

On Thu, Jul 7, 2011 at 11:21 AM, Ashwin Karpe <ak...@fusesource.com> wrote:
> Hi,
>
> Please check out the following link...
>
> http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setCacheLevel(int)
> http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setCacheLevel(int)
>
>
> Cheers,
>
> Ashwin...
>
> -----
> ---------------------------------------------------------
> Ashwin Karpe
> Apache Camel Committer & Sr Principal Consultant
> FUSESource (a Progress Software Corporation subsidiary)
> http://fusesource.com
>
> Blog: http://opensourceknowledge.blogspot.com
> ---------------------------------------------------------
> --
> View this message in context: http://camel.465427.n5.nabble.com/ActiveMQComponent-JmsTransactions-CacheLevel-tp4558968p4561612.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: ActiveMQComponent + JmsTransactions + CacheLevel

Posted by Ashwin Karpe <ak...@fusesource.com>.
Hi,

Please check out the following link...

http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setCacheLevel(int)
http://static.springsource.org/spring/docs/2.0.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setCacheLevel(int) 


Cheers,

Ashwin...

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: http://camel.465427.n5.nabble.com/ActiveMQComponent-JmsTransactions-CacheLevel-tp4558968p4561612.html
Sent from the Camel - Users mailing list archive at Nabble.com.