Announcement Announcement Module
Collapse
No announcement yet.
JMS transaction rollback failing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMS transaction rollback failing

    Hello, I've already asked a question here on Stackoverflow but I'm still looking for some help, so I'll try to explain my problem.
    I have a scheduled bean which has to receive a message from a queue and do something with it. If that something is successful, it commits the JMS transaction, otherwise it roll it back.
    After the first message is received, the transaction has to be rolled back, but in the log I can read only this:

    DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseSche
    duler-1) Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT

    DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseScheduler-1) Created JMS transaction on Session [Cached JMS Session: HornetQRASession->DelegatingSession [session=ClientSessionImpl [name=6d71cfce-2723-11e2-9bbc-c8bcc8d31780, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-invm-InVMConnectorFactory?server-id=0], discoveryGroupConfiguration=null], connectorConfig=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory?server-id=0, backupConfig=null], metaData=(jms-session=,)]@958a5d5]] from Connection [Shared JMS Connection: org.hornetq.jms.client.HornetQConnection@3b03074d]
    and no actual rollback. Also, on every subsequent read from the queue I see this:
    DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseSche
    duler-1) Participating in existing transaction
    At this point, if I restart JBoss, in the log file I can read:
    09:54:45,186 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseScheduler-1) Initiating transaction rollback
    2012-11-05 09:54:45,186 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseScheduler-1) Rolling back JMS transaction on Session [Cached JMS Session: HornetQRASession->DelegatingSession [session=ClientSessionImpl [name=3cb288a9-2726-11e2-9606-c8bcc8d31780, username=null, closed=false, factory = ClientSessionFactoryImpl [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-invm-InVMConnectorFactory?server-id=0], discoveryGroupConfiguration=null], connectorConfig=org-hornetq-core-remoting-impl-invm-InVMConnectorFactory?server-id=0, backupConfig=null], metaData=(jms-session=,)]@44877bf4]]
    2012-11-05 09:54:54,063 DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseScheduler-1) Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    So finally I see the rollback, and on every subsequent read from the queue a new transaction is created:
    DEBUG [org.springframework.jms.connection.JmsTransactionM anager] (baseSche
    duler-1) Creating new transaction with name [null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
    The logs are pretty clear, but I really can't understand what I did wrong. Did I forget to do some cleanup after the rollback?
    Thanks for your time

  • #2
    Ok, problem solved, finally. The cause was that I forgot to commit the transaction in the first else. That explains the different behaviour after server restart.

    Comment

    Working...
    X