activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Bertram <>
Subject Re: ActiveMQ Embedded with Tomcat missing messages while restart
Date Fri, 02 Jun 2017 20:10:57 GMT
I don't see in your code where you're calling rollback either on any Hibernate or JMS resource.

Typically in this kind of scenario you'd want the consumption of the message and the database
operation to be atomic to ensure the integrity of your data (i.e. one message equals one database
operation).  Without atomicity you risk losing or duplicating data.  These kinds of guarantees
are really easy to configure in a Java EE environment (e.g. using container-managed transactions
and an XA JDBC datasource), but I'm not familiar enough with Spring to make any recommendations.

The bottom line here is that I think your application and/or architecture is the problem here
and not the message broker.


----- Original Message -----
From: "rsahadevan" <>
Sent: Friday, June 2, 2017 2:20:07 PM
Subject: Re: ActiveMQ Embedded with Tomcat missing messages while restart

HI Justin,

What you understood is correct. Consumer is writing to database. I tried
with rollback and is not happening. Commit is failing in the DB and not
happening rollback into activemq_msgs. This is the reason I was thinking
about this approach .  Please let me know anything I am missing in config

 public void onMessage(Message message) {
        try {
            PlatformTransactionManager transactionManager =
            TransactionStatus transaction =
                 } catch (Exception e) {
            LOG.error("Generating payment", e);

Spring Config
    <jms:listener-container connection-factory="jmsConnectionFactory"
transaction-manager="transactionManager" acknowledge="transacted">
        <jms:listener ref="processBalanaceMDB"

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message