JMS transactions + JDBC operations as one transaction


General J2EE: JMS transactions + JDBC operations as one transaction

  1. I need JDBC operations to be included in the JMS transactions.

    However, I only have one database ( Sybase ), and I would like to use Sybase via JConnect JDBC as the persistence for the JMS provider, but also use the same Sybase database for JDBC operations ... and have these external JDBC operations and JMS sessions "combined into a single transaction". ( That is, when I consume a message from the queue, I would do other JDBC operations ... and that all of these should be treated as one transaction ).

    So my questions are:

    1) Do I really need a transaction manager, given that under the hoods, I really only have one database ?

    2) How, in code and / or configuration, does one have a single transaction for JMS and other JDBC operations ??

    3) If one is using ActiveMQ or MantaRay as the JMS provider, how does one go about it ??

    4) With JBoss, it says from the link below ( also quoted below ) that transactions are JBossMQ does not require an XA datasource:

    Deploy the datasource for your database

     There are example datasources in docs/examples/jca. An XA datasource is not required for JBossMQ persistence. All work is done is separate transactions that only includes work on the JBossMQ tables. i.e. there is a single branch so there is no need for two phase commit.

    Does this mean that the you cannot have JBoss transactions and JDBC operations part of a single transaction ??
  2. Okay, presumably bsaed on this:

    ... that the J2EE container should handle it.

    1) But what about JBoss as mentoined earlier ?

    2) What if I am not using a EJB or any J2EE container, but a stand-alone JMS provider + transaction manager ( say. JOTM ) ?
  3. If you where using spring, it supports a transactions that you can bound to the JMS message and an operation.