activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsahadevan <priyavira...@gmail.com>
Subject Re: ActiveMQ Embedded with Tomcat missing messages while restart
Date Fri, 02 Jun 2017 19:20:07 GMT
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 =
Context.getBean(Context.Name.TRANSACTION_MANAGER);
            TransactionStatus transaction =
transactionManager.getTransaction(new
DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED));
            updateDynamicBalance(new
Integer(message.getIntProperty("entityId")),new
Integer(message.getIntProperty("userId")),new
BigDecimal(message.getDoubleProperty("amount")),message.getStringProperty("mediationKey"));
            transaction.flush();
            return;
                 } 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"
destination="queue.jbilling.balance"/>
    </jms:listener-container>



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Embedded-with-Tomcat-missing-messages-while-restart-tp4726828p4726976.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message