On Mon, Apr 16, 2018 at 6:08 AM, pragmaticjdev <amits...@gmail.com> wrote:
> I would like to revive this email thread since I have a exact similar use > case for which I am planning to use activemq - to keep the java objects in > sync between multiple nodes. This thread discusses a couple of approaches - > transacted session (does this refer to transactions?) Yes, this refers to transactions, either JMS transactions or XA transactions. A transaction allows you to roll back the work that you've done if some portion of the transaction fails. JMS transactions cover only interactions with the ActiveMQ broker (acking and publishing messages), whereas XA transactions can cover interactions with RDBMSes as well. http://activemq.apache.org/how-do-transactions-work.html has some additional details. > or acknowledgements > (AUTO_ACKNOWLEDGE or CLIENT_ACKNOWLEDGE). Using some form of explicit acknowledgement (CLIENT_ACKNOWLEDGE, INDIVIDUAL_ACKNOWLEDGE) instead of AUTO_ACKNOWLEDGE allows you to avoid acknowledging the message until you've actually consumed it, but doesn't allow you to roll back other operations if something fails. > There is no conclusion on this > discussion though, hence I wanted to bring it back up to get expert > opinions. Kindly suggest. Thanks! > I suspect that there is no conclusion in part because different options are best for different situations. http://activemq.apache.org/should-i-use-transactions.html recommends using transactions over explicit acknowledgement, but both can work depending on your needs, so it really comes down to what your needs are. If you need to roll back database transactions, use XA transactions. If you need the ability to roll back one or more JMS operation if another JMS operation fails but you don't need the ability to roll back database transactions, use JMS transactions to avoid the overhead of XA transactions. If you just need to ensure that messages are delivered at least once but don't need the ability to roll back any processing if an error occurs, use explicit acknowledgement. Tim