Oracle's Advanced Queueing functionality also includes JMS/XA drivers that can be used with Atomikos.
NOTE: this configuration procedure was last tested with Oracle version 10.2.0.2.0
|Disclaimer: this is how we used OracleAQ in conjunction with TransactionsEssentials. For another approach, see http://thinkfunctional.blogspot.com/2012/05/atomikos-and-oracle-aq-pooling-problem.html (third party blog post).|
If no queues exist then they need to be created first. The easiest way to get started is to create each queue of type AQ$_JMS_MESSAGE (see the DBMS_AQJMS PL/SQL package). Ask you DBA to do this for you…
JMS is just another way of accessing OracleAQ (or Oracle Streams, as it is also called). You need to enable the necessary priviliges for users to use JMS in Oracle. The following privileges are required:
Note: some of the above database objects may need to be defined first - please contact your DBA for further assistance.
//create and configure an oracle-specific XA connection factory oracle.jdbc.xa.client.OracleXADataSource xads = new oracle.jdbc.xa.client.OracleXADataSource(); xads.setUser ( "..." ); xads.setPassword("..."); xads.setURL("..."); XAQueueConnectionFactory xacf = AQjmsFactory.getXAQueueConnectionFactory ( xads ); AtomikosConnectionFactoryBean qcf = new AtomikosConnectionFactoryBean(); qcf.setUniqueResourceName ( "..." ); qcf.setXaConnectionFactory ( xacf );
IMPORTANTMake sure to configure the Oracle XAConnectionFactory as outlined above, or you will get problems like these: Known Problems
You should now be able to send/receive JMS messages to and from OracleAQ.